diff --git a/.gitmodules b/.gitmodules index 9cfc2efcd..09418d3ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "Paper"] path = Paper url = https://github.com/PaperMC/Paper.git - branch = master + branch = progress/1.16.2 diff --git a/Paper b/Paper index ede98b682..1ba2f2145 160000 --- a/Paper +++ b/Paper @@ -1 +1 @@ -Subproject commit ede98b68207868ada5ec7ef08fbdb8ef25b9981a +Subproject commit 1ba2f2145204893955e76f57dd306d1285131e97 diff --git a/current-paper b/current-paper index 672412443..f213684e0 100644 --- a/current-paper +++ b/current-paper @@ -1 +1 @@ -1.16.1--d06dc961d894d612f5fb17ec1ef2410c4f7dcbbd +1.16.2--645f8ec4e739127d91a5a1a3862a86d696b1e915 diff --git a/patches/api/0001-Tuinity-API-Changes.patch b/patches/api/0001-Tuinity-API-Changes.patch index 081aadc8a..1bb7b5a02 100644 --- a/patches/api/0001-Tuinity-API-Changes.patch +++ b/patches/api/0001-Tuinity-API-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Tuinity API Changes diff --git a/pom.xml b/pom.xml -index cb37aea9d..4004ff5d3 100644 +index 1a34f688..95a99b7b 100644 --- a/pom.xml +++ b/pom.xml @@ -3,18 +3,18 @@ @@ -23,7 +23,7 @@ index cb37aea9d..4004ff5d3 100644 - com.destroystokyo.paper - paper-api + tuinity-api - 1.16.1-R0.1-SNAPSHOT + 1.16.2-R0.1-SNAPSHOT jar - Paper-API @@ -34,7 +34,7 @@ index cb37aea9d..4004ff5d3 100644 diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 6e01bf2d5..46c4d98ce 100644 +index 6e01bf2d..46c4d98c 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1447,6 +1447,14 @@ public interface Server extends PluginMessageRecipient { diff --git a/patches/api/0002-Rebrand.patch b/patches/api/0002-Rebrand.patch index 351e90013..24dc33063 100644 --- a/patches/api/0002-Rebrand.patch +++ b/patches/api/0002-Rebrand.patch @@ -5,10 +5,12 @@ Subject: [PATCH] Rebrand diff --git a/pom.xml b/pom.xml -index 12a5e929..84c9870e 100644 +index 95a99b7b..a7aca07e 100644 --- a/pom.xml +++ b/pom.xml -@@ -3,18 +3,18 @@ +@@ -1,20 +1,19 @@ +- + 4.0.0 @@ -22,7 +24,7 @@ index 12a5e929..84c9870e 100644 - tuinity-api + purpur-api - 1.16.1-R0.1-SNAPSHOT + 1.16.2-R0.1-SNAPSHOT jar - Tuinity-API @@ -32,7 +34,7 @@ index 12a5e929..84c9870e 100644 An enhanced plugin API for Minecraft servers. -@@ -149,7 +149,7 @@ +@@ -149,7 +148,7 @@ diff --git a/patches/api/0020-LivingEntity-playPickupItemAnimation.patch b/patches/api/0019-LivingEntity-playPickupItemAnimation.patch similarity index 100% rename from patches/api/0020-LivingEntity-playPickupItemAnimation.patch rename to patches/api/0019-LivingEntity-playPickupItemAnimation.patch diff --git a/patches/api/0019-World-getPlacementBlockData.patch b/patches/api/0019-World-getPlacementBlockData.patch deleted file mode 100644 index c9b81fe71..000000000 --- a/patches/api/0019-World-getPlacementBlockData.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sat, 19 Oct 2019 00:34:36 -0500 -Subject: [PATCH] World#getPlacementBlockData - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 9955d741..95042597 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -3458,6 +3458,16 @@ public interface World extends PluginMessageRecipient, Metadatable { - */ - @NotNull - net.pl3x.purpur.MoonPhase getMoonPhase(); -+ -+ /** -+ * Get the hypothetical BlockData that would apply if one tries to set the given BlockData -+ * -+ * @param blockData BlockData to try -+ * @param location Location to check -+ * @return Valid BlockData for location -+ */ -+ @NotNull -+ BlockData getPlacementBlockData(@NotNull BlockData blockData, @NotNull Location location); - // Purpur end - - /** diff --git a/patches/api/0021-SkeletonHorseTrapEvent-getPlayer.patch b/patches/api/0020-SkeletonHorseTrapEvent-getPlayer.patch similarity index 100% rename from patches/api/0021-SkeletonHorseTrapEvent-getPlayer.patch rename to patches/api/0020-SkeletonHorseTrapEvent-getPlayer.patch diff --git a/patches/api/0022-PaperPR-PlayerItemCooldownEvent.patch b/patches/api/0021-PaperPR-PlayerItemCooldownEvent.patch similarity index 100% rename from patches/api/0022-PaperPR-PlayerItemCooldownEvent.patch rename to patches/api/0021-PaperPR-PlayerItemCooldownEvent.patch diff --git a/patches/api/0023-EntityMoveEvent.patch b/patches/api/0022-EntityMoveEvent.patch similarity index 100% rename from patches/api/0023-EntityMoveEvent.patch rename to patches/api/0022-EntityMoveEvent.patch diff --git a/patches/api/0024-PaperPR-BellRingEvent.patch b/patches/api/0023-PaperPR-BellRingEvent.patch similarity index 100% rename from patches/api/0024-PaperPR-BellRingEvent.patch rename to patches/api/0023-PaperPR-BellRingEvent.patch diff --git a/patches/api/0025-Player-invulnerabilities.patch b/patches/api/0024-Player-invulnerabilities.patch similarity index 97% rename from patches/api/0025-Player-invulnerabilities.patch rename to patches/api/0024-Player-invulnerabilities.patch index b60bddf0f..903e57512 100644 --- a/patches/api/0025-Player-invulnerabilities.patch +++ b/patches/api/0024-Player-invulnerabilities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player invulnerabilities diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9dbfe3614..1dfe55402 100644 +index 9dbfe361..1dfe5540 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -1897,5 +1897,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/api/0026-Anvil-API.patch b/patches/api/0025-Anvil-API.patch similarity index 100% rename from patches/api/0026-Anvil-API.patch rename to patches/api/0025-Anvil-API.patch diff --git a/patches/api/0027-ItemStack-convenience-methods.patch b/patches/api/0026-ItemStack-convenience-methods.patch similarity index 99% rename from patches/api/0027-ItemStack-convenience-methods.patch rename to patches/api/0026-ItemStack-convenience-methods.patch index 9664fdffc..6a003f818 100644 --- a/patches/api/0027-ItemStack-convenience-methods.patch +++ b/patches/api/0026-ItemStack-convenience-methods.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack convenience methods diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 3a8438fb..e7167d11 100644 +index e203c5bf..e6ba1b17 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -8636,4 +8636,36 @@ public enum Material implements Keyed { +@@ -8635,4 +8635,36 @@ public enum Material implements Keyed { // } } diff --git a/patches/api/0028-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch b/patches/api/0027-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch similarity index 92% rename from patches/api/0028-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch rename to patches/api/0027-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch index 8e48d441d..3cda520f2 100644 --- a/patches/api/0028-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch +++ b/patches/api/0027-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Phantoms attracted to crystals and crystals shoot phantoms diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java -index d7f1b2c8..8d25b6f0 100644 +index b4209175..83c51bb5 100644 --- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java +++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java -@@ -205,4 +205,8 @@ public interface VanillaGoal extends Goal { +@@ -206,4 +206,8 @@ public interface VanillaGoal extends Goal { GoalKey ZOMBIE_ATTACK = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack")); GoalKey STROLL_VILLAGE_GOLEM = GoalKey.of(Creature.class, NamespacedKey.minecraft("stroll_village_golem")); GoalKey UNIVERSAL_ANGER_RESET = GoalKey.of(Mob.class, NamespacedKey.minecraft("universal_anger_reset")); diff --git a/patches/api/0030-ChatColor-conveniences.patch b/patches/api/0028-ChatColor-conveniences.patch similarity index 100% rename from patches/api/0030-ChatColor-conveniences.patch rename to patches/api/0028-ChatColor-conveniences.patch diff --git a/patches/api/0031-DragonEggPlaceEvent.patch b/patches/api/0029-DragonEggPlaceEvent.patch similarity index 98% rename from patches/api/0031-DragonEggPlaceEvent.patch rename to patches/api/0029-DragonEggPlaceEvent.patch index e8c31304d..9e1047b61 100644 --- a/patches/api/0031-DragonEggPlaceEvent.patch +++ b/patches/api/0029-DragonEggPlaceEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] DragonEggPlaceEvent diff --git a/src/main/java/net/pl3x/purpur/event/block/DragonEggPlaceEvent.java b/src/main/java/net/pl3x/purpur/event/block/DragonEggPlaceEvent.java new file mode 100644 -index 000000000..bdabfd2b5 +index 00000000..bdabfd2b --- /dev/null +++ b/src/main/java/net/pl3x/purpur/event/block/DragonEggPlaceEvent.java @@ -0,0 +1,47 @@ diff --git a/patches/api/0029-Ridables.patch b/patches/api/0030-Ridables.patch similarity index 97% rename from patches/api/0029-Ridables.patch rename to patches/api/0030-Ridables.patch index 608b9629b..e6a050996 100644 --- a/patches/api/0029-Ridables.patch +++ b/patches/api/0030-Ridables.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Ridables diff --git a/src/main/java/net/pl3x/purpur/event/entity/RidableSpacebarEvent.java b/src/main/java/net/pl3x/purpur/event/entity/RidableSpacebarEvent.java new file mode 100644 -index 000000000..c0ec5a130 +index 00000000..c0ec5a13 --- /dev/null +++ b/src/main/java/net/pl3x/purpur/event/entity/RidableSpacebarEvent.java @@ -0,0 +1,37 @@ @@ -48,7 +48,7 @@ index 000000000..c0ec5a130 + } +} diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 7808ade92..5abf3eaf3 100644 +index 7808ade9..5abf3eaf 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -695,4 +695,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent diff --git a/patches/server/0001-Tuinity-Server-Changes.patch b/patches/server/0001-Tuinity-Server-Changes.patch index c27eb5099..60d0c5814 100644 --- a/patches/server/0001-Tuinity-Server-Changes.patch +++ b/patches/server/0001-Tuinity-Server-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Tuinity Server Changes diff --git a/pom.xml b/pom.xml -index ef8ee637a8..6fd5968178 100644 +index 594ab9afb..ee19a2874 100644 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,11 @@ @@ -16,7 +16,7 @@ index ef8ee637a8..6fd5968178 100644 - paper + tuinity jar - 1.16.1-R0.1-SNAPSHOT + 1.16.2-R0.1-SNAPSHOT - Paper - https://papermc.io + Tuinity-Server @@ -65,7 +65,7 @@ index ef8ee637a8..6fd5968178 100644 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java -index dd07223978..85b25eace7 100644 +index dd0722397..85b25eace 100644 --- a/src/main/java/co/aikar/timings/MinecraftTimings.java +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -43,6 +43,9 @@ public final class MinecraftTimings { @@ -79,7 +79,7 @@ index dd07223978..85b25eace7 100644 private MinecraftTimings() {} diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java -index e33e889c29..5dfa065883 100644 +index e33e889c2..5dfa06588 100644 --- a/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java @@ -229,7 +229,8 @@ public class TimingsExport extends Thread { @@ -93,18 +93,9 @@ index e33e889c29..5dfa065883 100644 new TimingsExport(listeners, parent, history).start(); diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -index 49a38c6608..60d6469b81 100644 +index 49a38c660..255bbd6e4 100644 --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -@@ -13,7 +13,7 @@ import java.net.URL; - - public class PaperVersionFetcher implements VersionFetcher { - private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end -- private static final String GITHUB_BRANCH_NAME = "master"; -+ private static final String GITHUB_BRANCH_NAME = "ver/1.16"; // TODO TEMPORARY, REMOVE ONCE MASTER - private static @Nullable String mcVer; - - @Override @@ -24,8 +24,8 @@ public class PaperVersionFetcher implements VersionFetcher { @Nonnull @Override @@ -133,7 +124,7 @@ index 49a38c6608..60d6469b81 100644 switch (distance) { case -1: diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java -index e7624948ea..77df688880 100644 +index e7624948e..77df68888 100644 --- a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java +++ b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java @@ -186,6 +186,7 @@ public final class PaperTickList extends TickListServer { // extend to avo @@ -218,7 +209,7 @@ index e7624948ea..77df688880 100644 diff --git a/src/main/java/com/tuinity/tuinity/chunk/SingleThreadChunkRegionManager.java b/src/main/java/com/tuinity/tuinity/chunk/SingleThreadChunkRegionManager.java new file mode 100644 -index 0000000000..f599725e17 +index 000000000..f599725e1 --- /dev/null +++ b/src/main/java/com/tuinity/tuinity/chunk/SingleThreadChunkRegionManager.java @@ -0,0 +1,329 @@ @@ -554,10 +545,10 @@ index 0000000000..f599725e17 \ No newline at end of file diff --git a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java new file mode 100644 -index 0000000000..1c7b858ed5 +index 000000000..996be9b7f --- /dev/null +++ b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java -@@ -0,0 +1,279 @@ +@@ -0,0 +1,273 @@ +package com.tuinity.tuinity.config; + +import com.destroystokyo.paper.util.SneakyThrow; @@ -693,12 +684,6 @@ index 0000000000..1c7b858ed5 + lagCompensateBlockBreaking = TuinityConfig.getBoolean("lag-compensate-block-breaking", true); + } + -+ public static boolean pistonsCanPushTileEntities; -+ -+ private static void pistonsCanPushTileEntities() { -+ pistonsCanPushTileEntities = TuinityConfig.getBoolean("pistons-can-push-tile-entities", false); -+ } -+ + public static final class WorldConfig { + + public final String worldName; @@ -840,7 +825,7 @@ index 0000000000..1c7b858ed5 \ No newline at end of file diff --git a/src/main/java/com/tuinity/tuinity/util/CachedLists.java b/src/main/java/com/tuinity/tuinity/util/CachedLists.java new file mode 100644 -index 0000000000..a54f516ba7 +index 000000000..a54f516ba --- /dev/null +++ b/src/main/java/com/tuinity/tuinity/util/CachedLists.java @@ -0,0 +1,53 @@ @@ -899,7 +884,7 @@ index 0000000000..a54f516ba7 +} diff --git a/src/main/java/com/tuinity/tuinity/util/TickThread.java b/src/main/java/com/tuinity/tuinity/util/TickThread.java new file mode 100644 -index 0000000000..08ed243259 +index 000000000..08ed24325 --- /dev/null +++ b/src/main/java/com/tuinity/tuinity/util/TickThread.java @@ -0,0 +1,41 @@ @@ -947,7 +932,7 @@ index 0000000000..08ed243259 \ No newline at end of file diff --git a/src/main/java/com/tuinity/tuinity/util/maplist/IteratorSafeOrderedReferenceSet.java b/src/main/java/com/tuinity/tuinity/util/maplist/IteratorSafeOrderedReferenceSet.java new file mode 100644 -index 0000000000..b0f1e21e6e +index 000000000..b0f1e21e6 --- /dev/null +++ b/src/main/java/com/tuinity/tuinity/util/maplist/IteratorSafeOrderedReferenceSet.java @@ -0,0 +1,271 @@ @@ -1224,10 +1209,10 @@ index 0000000000..b0f1e21e6e +} diff --git a/src/main/java/com/tuinity/tuinity/voxel/AABBVoxelShape.java b/src/main/java/com/tuinity/tuinity/voxel/AABBVoxelShape.java new file mode 100644 -index 0000000000..76593df295 +index 000000000..56b955227 --- /dev/null +++ b/src/main/java/com/tuinity/tuinity/voxel/AABBVoxelShape.java -@@ -0,0 +1,246 @@ +@@ -0,0 +1,237 @@ +package com.tuinity.tuinity.voxel; + +import it.unimi.dsi.fastutil.doubles.DoubleArrayList; @@ -1242,21 +1227,15 @@ index 0000000000..76593df295 +public final class AABBVoxelShape extends VoxelShape { + + public final AxisAlignedBB aabb; -+ private boolean isEmpty; + + public AABBVoxelShape(AxisAlignedBB aabb) { + super(VoxelShapes.getFullUnoptimisedCube().getShape()); + this.aabb = aabb; -+ this.isEmpty = (fuzzyEquals(aabb.minX, aabb.maxX) && fuzzyEquals(aabb.minY, aabb.maxY) && fuzzyEquals(aabb.minZ, aabb.maxZ)); -+ } -+ -+ static boolean fuzzyEquals(double d0, double d1) { -+ return Math.abs(d0 - d1) <= 1.0e-7; + } + + @Override + public boolean isEmpty() { -+ return this.isEmpty; ++ return this.aabb.isEmpty(); + } + + @Override @@ -1379,9 +1358,6 @@ index 0000000000..76593df295 + + @Override + public double a(EnumDirection.EnumAxis enumdirection_enumaxis, AxisAlignedBB axisalignedbb, double d0) { // collide -+ if (this.isEmpty) { -+ return d0; -+ } + if (Math.abs(d0) < 1.0e-7) { + return 0.0; + } @@ -1475,7 +1451,7 @@ index 0000000000..76593df295 + } +} diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java -index ed9b2f9adf..d54bf71409 100644 +index ed9b2f9ad..d54bf7140 100644 --- a/src/main/java/net/minecraft/server/AxisAlignedBB.java +++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java @@ -13,6 +13,119 @@ public class AxisAlignedBB { @@ -1623,7 +1599,7 @@ index ed9b2f9adf..d54bf71409 100644 return d0 >= this.minX && d0 < this.maxX && d1 >= this.minY && d1 < this.maxY && d2 >= this.minZ && d2 < this.maxZ; } diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index 3b0c8971c6..e69b7dbc7a 100644 +index 4d574f83a..f0e5ba3b2 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java @@ -16,9 +16,9 @@ public class BaseBlockPosition implements Comparable { @@ -1658,31 +1634,8 @@ index 3b0c8971c6..e69b7dbc7a 100644 this.e = i; } -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index db198811dd..52ebdfcc03 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -92,6 +92,18 @@ public class BiomeBase { - return new WorldGenCarverWrapper<>(worldgencarverabstract, c0); - } - -+ // Tuinity start - optimise biome conversion -+ private org.bukkit.block.Biome bukkitBiome; -+ -+ public final org.bukkit.block.Biome getBukkitBiome() { -+ if (this.bukkitBiome == null) { -+ this.bukkitBiome = org.bukkit.block.Biome.valueOf(IRegistry.BIOME.getKey(this).getKey().toUpperCase(java.util.Locale.ENGLISH)); -+ } -+ -+ return this.bukkitBiome; -+ } -+ // Tuinity end - optimise biome conversion -+ - protected BiomeBase(BiomeBase.a biomebase_a) { - if (biomebase_a.a != null && biomebase_a.b != null && biomebase_a.c != null && biomebase_a.d != null && biomebase_a.e != null && biomebase_a.f != null && biomebase_a.g != null && biomebase_a.j != null) { - this.m = biomebase_a.a; diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index 7b0cc78334..a53e096515 100644 +index 440c959b1..82e07b357 100644 --- a/src/main/java/net/minecraft/server/BlockBase.java +++ b/src/main/java/net/minecraft/server/BlockBase.java @@ -176,8 +176,8 @@ public abstract class BlockBase { @@ -1693,7 +1646,7 @@ index 7b0cc78334..a53e096515 100644 - public int f(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { + @Deprecated public final int getOpacity(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { return this.f(iblockdata, iblockaccess, blockposition); } // Tuinity - OBFHELPER + @Deprecated public int f(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { // Tuinity - OBFHELPER - return iblockdata.i(iblockaccess, blockposition) ? iblockaccess.H() : (iblockdata.a(iblockaccess, blockposition) ? 0 : 1); + return iblockdata.i(iblockaccess, blockposition) ? iblockaccess.J() : (iblockdata.a(iblockaccess, blockposition) ? 0 : 1); } @@ -289,14 +289,14 @@ public abstract class BlockBase { @@ -1734,7 +1687,7 @@ index 7b0cc78334..a53e096515 100644 + this.fluid = this.getBlock().d(this.p()); // Tuinity - moved from getFluid() + this.isTicking = this.getBlock().isTicking(this.p()); // Tuinity - moved from isTicking() if (!this.getBlock().o()) { - this.a = new BlockBase.BlockData.a(this.p()); + this.a = new BlockBase.BlockData.Cache(this.p()); } + this.shapeExceedsCube = this.a == null || this.a.c; // Tuinity - moved from actual method to here @@ -1805,18 +1758,9 @@ index 7b0cc78334..a53e096515 100644 public SoundEffectType getStepSound() { diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java -index 44b9bfcdc7..dba774018c 100644 +index 12a023044..9e5e6de52 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -10,7 +10,7 @@ import javax.annotation.Nullable; - public class BlockChest extends BlockChestAbstract implements IBlockWaterlogged { - - public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING; -- public static final BlockStateEnum c = BlockProperties.aF; -+ public static final BlockStateEnum c = BlockProperties.aF; public static final BlockStateEnum getChestTypeEnum() { return BlockChest.c; } // Tuinity - OBFHELPER - public static final BlockStateBoolean d = BlockProperties.C; public static final BlockStateBoolean waterlogged() { return d; } // Paper OBFHELPER - protected static final VoxelShape e = Block.a(1.0D, 0.0D, 0.0D, 15.0D, 14.0D, 15.0D); - protected static final VoxelShape f = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 16.0D); @@ -195,7 +195,7 @@ public class BlockChest extends BlockChestAbstract implements I @Override public void remove(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { @@ -1826,86 +1770,11 @@ index 44b9bfcdc7..dba774018c 100644 if (tileentity instanceof IInventory) { InventoryUtils.dropInventory(world, blockposition, (IInventory) tileentity); -diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java -index c3133814f1..4f10ca5ada 100644 ---- a/src/main/java/net/minecraft/server/BlockPiston.java -+++ b/src/main/java/net/minecraft/server/BlockPiston.java -@@ -270,7 +270,10 @@ public class BlockPiston extends BlockDirectional { - return false; - } - -- return !iblockdata.getBlock().isTileEntity(); -+ // Tuinity start - pushable TE's -+ TileEntity tileEntity; -+ return !iblockdata.getBlock().isTileEntity() || ((tileEntity = world.getTileEntity(blockposition)) != null && tileEntity.isPushable()); -+ // Tuinity end - pushable TE's - } else { - return false; - } -@@ -369,7 +372,7 @@ public class BlockPiston extends BlockDirectional { - - for (k = list.size() - 1; k >= 0; --k) { - // Paper start - fix a variety of piston desync dupes -- boolean allowDesync = com.destroystokyo.paper.PaperConfig.allowPistonDuplication; -+ boolean allowDesync = com.destroystokyo.paper.PaperConfig.allowPistonDuplication && !list1.get(k).getBlock().isTileEntity(); // Tuinity - pushable TE's - BlockPosition oldPos = blockposition3 = (BlockPosition) list.get(k); - iblockdata1 = allowDesync ? world.getType(oldPos) : null; - // Paper end - fix a variety of piston desync dupes -@@ -381,10 +384,29 @@ public class BlockPiston extends BlockDirectional { - iblockdata1 = world.getType(oldPos); - map.replace(oldPos, iblockdata1); - } -- world.setTileEntity(blockposition3, BlockPistonMoving.a(allowDesync ? list1.get(k) : iblockdata1, enumdirection, flag, false)); -+ // Tuinity start - pushable TE's -+ TileEntity tileEntity = world.getTileEntity(oldPos); -+ if (tileEntity != null) { -+ if (!tileEntity.isPushable()) { -+ tileEntity = null; -+ } else { -+ // ensure the death of world tied state -+ if (tileEntity instanceof IInventory) { -+ MCUtil.closeInventory((IInventory)tileEntity, org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); -+ } -+ if (tileEntity instanceof TileEntityLectern) { -+ MCUtil.closeInventory(((TileEntityLectern)tileEntity).inventory, org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); -+ } -+ -+ // now copy -+ tileEntity = tileEntity.createCopyForPush((WorldServer)world, oldPos, blockposition3, iblockdata1); -+ } -+ } -+ // Tuinity end - pushable TE's - if (!allowDesync) { -- world.setTypeAndData(oldPos, Blocks.AIR.getBlockData(), 2 | 4 | 16 | 1024); // set air to prevent later physics updates from seeing this block -+ world.setTypeAndDataRaw(oldPos, Blocks.AIR.getBlockData(), null); // Tuinity - don't fire logic for removing the old block - } -+ world.setTileEntity(blockposition3, BlockPistonMoving.createPistonTile(allowDesync ? list1.get(k) : iblockdata1, enumdirection, flag, false, tileEntity)); // Tuinity - pushable TE's - // Paper end - fix a variety of piston desync dupes - aiblockdata[j++] = iblockdata1; - } -diff --git a/src/main/java/net/minecraft/server/BlockPistonMoving.java b/src/main/java/net/minecraft/server/BlockPistonMoving.java -index 4bf66420f5..bf76615d72 100644 ---- a/src/main/java/net/minecraft/server/BlockPistonMoving.java -+++ b/src/main/java/net/minecraft/server/BlockPistonMoving.java -@@ -21,7 +21,12 @@ public class BlockPistonMoving extends BlockTileEntity { - } - - public static TileEntity a(IBlockData iblockdata, EnumDirection enumdirection, boolean flag, boolean flag1) { -- return new TileEntityPiston(iblockdata, enumdirection, flag, flag1); -+ // Tuinity start - add tileEntity parameter -+ return createPistonTile(iblockdata, enumdirection, flag, flag1, null); -+ } -+ public static TileEntity createPistonTile(IBlockData iblockdata, EnumDirection enumdirection, boolean flag, boolean flag1, TileEntity tileEntity) { -+ return new TileEntityPiston(iblockdata, enumdirection, flag, flag1, tileEntity); -+ // Tuinity end - add tileEntity parameter - } - - @Override diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index a2ee39b7ef..c77f71b6de 100644 +index 2d887af90..2291135ea 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -387,10 +387,10 @@ public class BlockPosition extends BaseBlockPosition { +@@ -449,10 +449,10 @@ public class BlockPosition extends BaseBlockPosition { } public final BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return d(i, j, k);} // Paper - OBFHELPER @@ -1920,7 +1789,7 @@ index a2ee39b7ef..c77f71b6de 100644 return this; } -@@ -400,12 +400,18 @@ public class BlockPosition extends BaseBlockPosition { +@@ -462,12 +462,18 @@ public class BlockPosition extends BaseBlockPosition { } public final BlockPosition.MutableBlockPosition setValues(final BaseBlockPosition baseblockposition) { return this.g(baseblockposition); } // Paper - OBFHELPER @@ -1943,7 +1812,7 @@ index a2ee39b7ef..c77f71b6de 100644 } public BlockPosition.MutableBlockPosition a(EnumAxisCycle enumaxiscycle, int i, int j, int k) { -@@ -420,8 +426,11 @@ public class BlockPosition extends BaseBlockPosition { +@@ -482,8 +488,11 @@ public class BlockPosition extends BaseBlockPosition { return this.d(baseblockposition.getX() + i, baseblockposition.getY() + j, baseblockposition.getZ() + k); } @@ -1957,7 +1826,7 @@ index a2ee39b7ef..c77f71b6de 100644 } public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) { -@@ -445,21 +454,30 @@ public class BlockPosition extends BaseBlockPosition { +@@ -511,21 +520,30 @@ public class BlockPosition extends BaseBlockPosition { } } @@ -1999,10 +1868,67 @@ index a2ee39b7ef..c77f71b6de 100644 @Override public BlockPosition immutableCopy() { diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 7e8e154733..b87bfb1dee 100644 +index 299d7d7a5..ac6e5e330 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -375,7 +375,7 @@ public class Chunk implements IChunkAccess { +@@ -91,6 +91,56 @@ public class Chunk implements IChunkAccess { + private final int[] inventoryEntityCounts = new int[16]; + // Paper end + ++ // Tuinity start - optimise hard collision handling ++ final com.destroystokyo.paper.util.maplist.EntityList[] hardCollidingEntities = new com.destroystokyo.paper.util.maplist.EntityList[16]; ++ ++ { ++ for (int i = 0, len = this.hardCollidingEntities.length; i < len; ++i) { ++ this.hardCollidingEntities[i] = new com.destroystokyo.paper.util.maplist.EntityList(); ++ } ++ } ++ ++ public final void getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, List into, Predicate predicate) { ++ // copied from getEntities ++ int min = MathHelper.floor((axisalignedbb.minY - 2.0D) / 16.0D); ++ int max = MathHelper.floor((axisalignedbb.maxY + 2.0D) / 16.0D); ++ ++ min = MathHelper.clamp(min, 0, this.hardCollidingEntities.length - 1); ++ max = MathHelper.clamp(max, 0, this.hardCollidingEntities.length - 1); ++ ++ for (int k = min; k <= max; ++k) { ++ com.destroystokyo.paper.util.maplist.EntityList entityList = this.hardCollidingEntities[k]; ++ Entity[] entities = entityList.getRawData(); ++ ++ for (int i = 0, len = entityList.size(); i < len; ++i) { ++ Entity entity1 = entities[i]; ++ if (entity1.shouldBeRemoved) continue; // Paper ++ ++ if (entity1 != entity && entity1.getBoundingBox().intersects(axisalignedbb)) { ++ if (predicate == null || predicate.test(entity1)) { ++ into.add(entity1); ++ } ++ ++ if (!(entity1 instanceof EntityEnderDragon)) { ++ continue; ++ } ++ ++ EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon)entity1).children; ++ int l = aentitycomplexpart.length; ++ ++ for (int i1 = 0; i1 < l; ++i1) { ++ EntityComplexPart entitycomplexpart = aentitycomplexpart[i1]; ++ ++ if (entitycomplexpart != entity && entitycomplexpart.getBoundingBox().intersects(axisalignedbb) && (predicate == null || predicate.test(entitycomplexpart))) { ++ into.add(entitycomplexpart); ++ } ++ } ++ } ++ } ++ } ++ } ++ // Tuinity end - optimise hard collision handling ++ + public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage, ChunkConverter chunkconverter, TickList ticklist, TickList ticklist1, long i, @Nullable ChunkSection[] achunksection, @Nullable Consumer consumer) { + this.sections = new ChunkSection[16]; + this.e = Maps.newHashMap(); +@@ -327,7 +377,7 @@ public class Chunk implements IChunkAccess { Entry entry = (Entry) iterator.next(); if (ChunkStatus.FULL.h().contains(entry.getKey())) { @@ -2011,62 +1937,7 @@ index 7e8e154733..b87bfb1dee 100644 } } -@@ -510,8 +510,35 @@ public class Chunk implements IChunkAccess { - return this.setType(blockposition, iblockdata, flag, true); - } - -+ // Tuinity start -+ final void setTypeAndDataRaw(BlockPosition blockposition, IBlockData iblockdata) { -+ // copied from setType -+ int i = blockposition.getX() & 15; -+ int j = blockposition.getY(); -+ int k = blockposition.getZ() & 15; -+ ChunkSection chunksection = this.sections[j >> 4]; -+ -+ if (chunksection == Chunk.a) { -+ if (iblockdata.isAir()) { -+ return; -+ } -+ -+ chunksection = new ChunkSection(j >> 4 << 4, this, this.world, true); // Paper - Anti-Xray - Add parameters -+ this.sections[j >> 4] = chunksection; -+ } -+ -+ chunksection.setType(i, j & 15, k, iblockdata); -+ } -+ // Tuinity end -+ - @Nullable - public IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag, boolean doPlace) { -+ // Tuinity start - add tileEntity parameter -+ return this.setType(blockposition, iblockdata, flag, doPlace, null); -+ } -+ @Nullable -+ public IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag, boolean doPlace, TileEntity newTileEntity) { -+ // Tuinity end - add tileEntity parameter - // CraftBukkit end - int i = blockposition.getX() & 15; - int j = blockposition.getY(); -@@ -570,6 +597,10 @@ public class Chunk implements IChunkAccess { - } - - if (block instanceof ITileEntity) { -+ // Tuinity start - add tileEntity parameter -+ if (newTileEntity != null) { -+ this.world.setTileEntity(blockposition, newTileEntity); -+ } else { // Tuinity end - add tileEntity parameter - tileentity = this.a(blockposition, Chunk.EnumTileEntityState.CHECK); - if (tileentity == null) { - tileentity = ((ITileEntity) block).createTile(this.world); -@@ -577,6 +608,7 @@ public class Chunk implements IChunkAccess { - } else { - tileentity.invalidateBlockCache(); - } -+ } // Tuinity - add tileEntity parameter - } - - this.s = true; -@@ -592,6 +624,7 @@ public class Chunk implements IChunkAccess { +@@ -544,6 +594,7 @@ public class Chunk implements IChunkAccess { @Override public void a(Entity entity) { @@ -2074,7 +1945,16 @@ index 7e8e154733..b87bfb1dee 100644 this.q = true; int i = MathHelper.floor(entity.locX() / 16.0D); int j = MathHelper.floor(entity.locZ() / 16.0D); -@@ -661,6 +694,7 @@ public class Chunk implements IChunkAccess { +@@ -590,7 +641,7 @@ public class Chunk implements IChunkAccess { + entity.chunkY = k; + entity.chunkZ = this.loc.z; + this.entities.add(entity); // Paper - per chunk entity list +- this.entitySlices[k].add(entity); ++ this.entitySlices[k].add(entity); if (entity.hardCollides()) this.hardCollidingEntities[k].add(entity); // Tuinity - optimise hard colliding entities + // Paper start + if (entity instanceof EntityItem) { + itemCounts[k]++; +@@ -613,6 +664,7 @@ public class Chunk implements IChunkAccess { } public void a(Entity entity, int i) { @@ -2082,7 +1962,16 @@ index 7e8e154733..b87bfb1dee 100644 if (i < 0) { i = 0; } -@@ -918,6 +952,7 @@ public class Chunk implements IChunkAccess { +@@ -627,7 +679,7 @@ public class Chunk implements IChunkAccess { + entity.entitySlice = null; + entity.inChunk = false; + } +- if (!this.entitySlices[i].remove(entity)) { ++ if (entity.hardCollides()) this.hardCollidingEntities[i].remove(entity); if (!this.entitySlices[i].remove(entity)) { // Tuinity - optimise hard colliding entities + return; + } + if (entity instanceof EntityItem) { +@@ -870,6 +922,7 @@ public class Chunk implements IChunkAccess { } public void a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, List list, @Nullable Predicate predicate) { @@ -2090,7 +1979,7 @@ index 7e8e154733..b87bfb1dee 100644 int i = MathHelper.floor((axisalignedbb.minY - 2.0D) / 16.0D); int j = MathHelper.floor((axisalignedbb.maxY + 2.0D) / 16.0D); -@@ -957,6 +992,7 @@ public class Chunk implements IChunkAccess { +@@ -909,6 +962,7 @@ public class Chunk implements IChunkAccess { } public void a(@Nullable EntityTypes entitytypes, AxisAlignedBB axisalignedbb, List list, Predicate predicate) { @@ -2098,7 +1987,7 @@ index 7e8e154733..b87bfb1dee 100644 int i = MathHelper.floor((axisalignedbb.minY - 2.0D) / 16.0D); int j = MathHelper.floor((axisalignedbb.maxY + 2.0D) / 16.0D); -@@ -987,6 +1023,7 @@ public class Chunk implements IChunkAccess { +@@ -939,6 +993,7 @@ public class Chunk implements IChunkAccess { } public void a(Class oclass, AxisAlignedBB axisalignedbb, List list, @Nullable Predicate predicate) { @@ -2106,7 +1995,7 @@ index 7e8e154733..b87bfb1dee 100644 int i = MathHelper.floor((axisalignedbb.minY - 2.0D) / 16.0D); int j = MathHelper.floor((axisalignedbb.maxY + 2.0D) / 16.0D); -@@ -1174,7 +1211,7 @@ public class Chunk implements IChunkAccess { +@@ -1126,7 +1181,7 @@ public class Chunk implements IChunkAccess { IBlockData iblockdata = this.getType(blockposition); IBlockData iblockdata1 = Block.b(iblockdata, (GeneratorAccess) this.world, blockposition); @@ -2116,7 +2005,7 @@ index 7e8e154733..b87bfb1dee 100644 this.n[i].clear(); diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index eaed04f786..25086275f4 100644 +index 3c7b225ed..0c4aed5f5 100644 --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java +++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java @@ -31,7 +31,7 @@ public abstract class ChunkMapDistance { @@ -2285,10 +2174,23 @@ index eaed04f786..25086275f4 100644 for (java.util.Iterator>>> iterator = this.tickets.long2ObjectEntrySet().fastIterator(); iterator.hasNext();) { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 3a5a9aba11..6b954db2e4 100644 +index 45c142c22..6c41eb14d 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -120,7 +120,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -22,6 +22,12 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + ++// Tuinity start ++import it.unimi.dsi.fastutil.objects.Object2BooleanLinkedOpenHashMap; ++import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; ++import it.unimi.dsi.fastutil.objects.Object2BooleanMap; ++// Tuinity end ++ + public class ChunkProviderServer extends IChunkProvider { + + private static final List b = ChunkStatus.a(); static final List getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER +@@ -121,7 +127,7 @@ public class ChunkProviderServer extends IChunkProvider { return (Chunk)this.getChunkAt(x, z, ChunkStatus.FULL, true); } @@ -2297,7 +2199,7 @@ index 3a5a9aba11..6b954db2e4 100644 public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { if (Thread.currentThread() != this.serverThread) { -@@ -182,9 +182,9 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -183,9 +189,9 @@ public class ChunkProviderServer extends IChunkProvider { try { if (onLoad != null) { @@ -2309,7 +2211,7 @@ index 3a5a9aba11..6b954db2e4 100644 } } catch (Throwable thr) { if (thr instanceof ThreadDeath) { -@@ -209,6 +209,164 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -210,6 +216,164 @@ public class ChunkProviderServer extends IChunkProvider { } // Paper end - rewrite ticklistserver @@ -2474,7 +2376,7 @@ index 3a5a9aba11..6b954db2e4 100644 public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier supplier) { this.world = worldserver; this.serverThreadQueue = new ChunkProviderServer.a(worldserver); -@@ -544,6 +702,8 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -545,6 +709,8 @@ public class ChunkProviderServer extends IChunkProvider { Arrays.fill(this.cacheChunk, (Object) null); } @@ -2483,7 +2385,7 @@ index 3a5a9aba11..6b954db2e4 100644 private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { // Paper start - add isUrgent - old sig left in place for dirty nms plugins return getChunkFutureMainThread(i, j, chunkstatus, flag, false); -@@ -562,9 +722,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -563,9 +729,12 @@ public class ChunkProviderServer extends IChunkProvider { PlayerChunk.State currentChunkState = PlayerChunk.getChunkState(playerchunk.getTicketLevel()); currentlyUnloading = (oldChunkState.isAtLeast(PlayerChunk.State.BORDER) && !currentChunkState.isAtLeast(PlayerChunk.State.BORDER)); } @@ -2496,12 +2398,12 @@ index 3a5a9aba11..6b954db2e4 100644 if (isUrgent) this.chunkMapDistance.markUrgent(chunkcoordintpair); // Paper if (this.a(playerchunk, l)) { GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); -@@ -575,12 +738,20 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -576,12 +745,20 @@ public class ChunkProviderServer extends IChunkProvider { playerchunk = this.getChunk(k); gameprofilerfiller.exit(); if (this.a(playerchunk, l)) { + this.chunkMapDistance.removeTicketAtLevel(TicketType.REQUIRED_LOAD, chunkcoordintpair, l, identifier); // Tuinity - throw (IllegalStateException) SystemUtils.c(new IllegalStateException("No chunk holder after ticket has been added")); + throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException("No chunk holder after ticket has been added"))); } } - } @@ -2518,7 +2420,7 @@ index 3a5a9aba11..6b954db2e4 100644 if (isUrgent) { future.thenAccept(either -> this.chunkMapDistance.clearUrgent(chunkcoordintpair)); } -@@ -599,8 +770,8 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -600,8 +777,8 @@ public class ChunkProviderServer extends IChunkProvider { return !this.a(playerchunk, k); } @@ -2529,7 +2431,7 @@ index 3a5a9aba11..6b954db2e4 100644 long k = ChunkCoordIntPair.pair(i, j); PlayerChunk playerchunk = this.getChunk(k); -@@ -637,6 +808,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -638,6 +815,7 @@ public class ChunkProviderServer extends IChunkProvider { public boolean tickDistanceManager() { // Paper - private -> public if (chunkMapDistance.delayDistanceManagerTick) return false; // Paper @@ -2537,7 +2439,7 @@ index 3a5a9aba11..6b954db2e4 100644 boolean flag = this.chunkMapDistance.a(this.playerChunkMap); boolean flag1 = this.playerChunkMap.b(); -@@ -646,6 +818,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -647,6 +825,7 @@ public class ChunkProviderServer extends IChunkProvider { this.clearCache(); return true; } @@ -2545,7 +2447,7 @@ index 3a5a9aba11..6b954db2e4 100644 } public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER -@@ -734,7 +907,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -735,7 +914,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().enter("purge"); this.world.timings.doChunkMap.startTiming(); // Spigot this.chunkMapDistance.purgeTickets(); @@ -2554,7 +2456,7 @@ index 3a5a9aba11..6b954db2e4 100644 this.tickDistanceManager(); this.world.timings.doChunkMap.stopTiming(); // Spigot this.world.getMethodProfiler().exitEnter("chunks"); -@@ -744,12 +917,22 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -745,12 +924,22 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.doChunkUnload.startTiming(); // Spigot this.world.getMethodProfiler().exitEnter("unload"); this.playerChunkMap.unloadChunks(booleansupplier); @@ -2572,13 +2474,13 @@ index 3a5a9aba11..6b954db2e4 100644 + // chunk map that will give the same behaviour as previous - without COW. + final com.destroystokyo.paper.util.maplist.ChunkList entityTickingChunks = new com.destroystokyo.paper.util.maplist.ChunkList(); + boolean isTickingChunks; -+ final it.unimi.dsi.fastutil.objects.Object2BooleanLinkedOpenHashMap pendingEntityTickingChunkChanges = new it.unimi.dsi.fastutil.objects.Object2BooleanLinkedOpenHashMap<>(16, 0.8f); ++ final Object2BooleanLinkedOpenHashMap pendingEntityTickingChunkChanges = new Object2BooleanLinkedOpenHashMap<>(16, 0.8f); + // Tuinity end - optimise chunk tick iteration + private void tickChunks() { long i = this.world.getTime(); long j = i - this.lastTickTime; -@@ -821,19 +1004,21 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -822,19 +1011,21 @@ public class ChunkProviderServer extends IChunkProvider { //List list = Lists.newArrayList(this.playerChunkMap.f()); // Paper //Collections.shuffle(list); // Paper // Paper - moved up @@ -2608,7 +2510,7 @@ index 3a5a9aba11..6b954db2e4 100644 ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); if (!this.playerChunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, false)) { // Paper - optimise isOutsideOfRange -@@ -845,11 +1030,27 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -846,11 +1037,27 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.chunkTicks.startTiming(); // Spigot // Paper this.world.a(chunk, k); this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper @@ -2623,8 +2525,8 @@ index 3a5a9aba11..6b954db2e4 100644 + if (!this.pendingEntityTickingChunkChanges.isEmpty()) { + // iterate backwards: fastutil maps have better remove times when iterating backwards + // (this is due to the fact that we likely wont shift entries on remove calls) -+ for (it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator> iterator = this.pendingEntityTickingChunkChanges.object2BooleanEntrySet().fastIterator(this.pendingEntityTickingChunkChanges.object2BooleanEntrySet().last()); iterator.hasPrevious();) { -+ it.unimi.dsi.fastutil.objects.Object2BooleanMap.Entry entry = iterator.previous(); ++ for (ObjectBidirectionalIterator> iterator = this.pendingEntityTickingChunkChanges.object2BooleanEntrySet().fastIterator(this.pendingEntityTickingChunkChanges.object2BooleanEntrySet().last()); iterator.hasPrevious();) { ++ Object2BooleanMap.Entry entry = iterator.previous(); + + if (entry.getBooleanValue()) { + this.entityTickingChunks.add(entry.getKey()); @@ -2638,7 +2540,7 @@ index 3a5a9aba11..6b954db2e4 100644 this.world.getMethodProfiler().enter("customSpawners"); if (flag1) { try (co.aikar.timings.Timing ignored = this.world.timings.miscMobSpawning.startTiming()) { // Paper - timings -@@ -861,7 +1062,25 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -862,7 +1069,25 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().exit(); } @@ -2664,7 +2566,7 @@ index 3a5a9aba11..6b954db2e4 100644 } private void a(long i, Consumer consumer) { -@@ -1001,44 +1220,11 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -1002,44 +1227,11 @@ public class ChunkProviderServer extends IChunkProvider { ChunkProviderServer.this.world.getMethodProfiler().c("runTask"); super.executeTask(runnable); } @@ -2712,7 +2614,7 @@ index 3a5a9aba11..6b954db2e4 100644 try { boolean execChunkTask = com.destroystokyo.paper.io.chunk.ChunkTaskManager.pollChunkWaitQueue() || ChunkProviderServer.this.world.asyncChunkTaskManager.pollNextChunkTask(); // Paper diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index ac58fcb798..742c59cb05 100644 +index 335bb1dcb..e74d21048 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -24,6 +24,14 @@ public class ChunkRegionLoader { @@ -2744,7 +2646,7 @@ index ac58fcb798..742c59cb05 100644 nbttagcompound1.setString("Status", ichunkaccess.getChunkStatus().d()); ChunkConverter chunkconverter = ichunkaccess.p(); diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 3588fe1001..cf54336b86 100644 +index e52df8096..cebd808e2 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -96,6 +96,7 @@ public class ChunkSection { @@ -2756,7 +2658,7 @@ index 3588fe1001..cf54336b86 100644 return this.nonEmptyBlockCount == 0; } diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index 7948b915bf..7e32a2eab9 100644 +index f6c9bdbf5..51ea295d6 100644 --- a/src/main/java/net/minecraft/server/ChunkStatus.java +++ b/src/main/java/net/minecraft/server/ChunkStatus.java @@ -109,7 +109,7 @@ public class ChunkStatus { @@ -2778,7 +2680,7 @@ index 7948b915bf..7e32a2eab9 100644 } diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index e65fe633f5..ed817893e6 100644 +index 26b48b5ff..353b61aa5 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -52,6 +52,7 @@ public class DataBits { @@ -2806,7 +2708,7 @@ index e65fe633f5..ed817893e6 100644 //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper int j = this.b(i); diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 95ef962868..73163b417a 100644 +index 95ef96286..73163b417 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -163,6 +163,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { @@ -2818,7 +2720,7 @@ index 95ef962868..73163b417a 100644 T t0 = this.h.a(this.a.a(i)); diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 8b2755a3b9..578f7809cb 100644 +index 1c878265b..5907caa74 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -170,6 +170,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -2830,7 +2732,7 @@ index 8b2755a3b9..578f7809cb 100644 this.setPVP(dedicatedserverproperties.pvp); this.setAllowFlight(dedicatedserverproperties.allowFlight); diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java -index 550232cb38..229c3b0f0c 100644 +index 550232cb3..229c3b0f0 100644 --- a/src/main/java/net/minecraft/server/EULA.java +++ b/src/main/java/net/minecraft/server/EULA.java @@ -70,7 +70,7 @@ public class EULA { @@ -2843,7 +2745,7 @@ index 550232cb38..229c3b0f0c 100644 throwable = throwable1; throw throwable1; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 5a8bcd91dc..db62601ea7 100644 +index c87de4b5b..42dd8a0e3 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -136,7 +136,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -2855,7 +2757,7 @@ index 5a8bcd91dc..db62601ea7 100644 public boolean noclip; public float I; protected final Random random; -@@ -212,6 +212,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -207,6 +207,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } // CraftBukkit end @@ -2867,10 +2769,52 @@ index 5a8bcd91dc..db62601ea7 100644 + } + // Tuinity end + - // Paper start - /** - * Overriding this field will cause memory leaks. -@@ -625,7 +633,40 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + // Paper start - optimise entity tracking + final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this); + +@@ -222,6 +230,41 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + } + // Paper end - optimise entity tracking + ++ // Tuinity start ++ /** ++ * Overriding this field will cause memory leaks. ++ */ ++ private final boolean hardCollides; ++ ++ private static final java.util.Map, Boolean> cachedOverrides = java.util.Collections.synchronizedMap(new java.util.WeakHashMap<>()); ++ { ++ Boolean hardCollides = cachedOverrides.get(this.getClass()); ++ if (hardCollides == null) { ++ try { ++ java.lang.reflect.Method getHardCollisionBoxEntityMethod = Entity.class.getMethod("j", Entity.class); ++ java.lang.reflect.Method hasHardCollisionBoxMethod = Entity.class.getMethod("aY"); ++ if (!this.getClass().getMethod(hasHardCollisionBoxMethod.getName(), hasHardCollisionBoxMethod.getParameterTypes()).equals(hasHardCollisionBoxMethod) ++ || !this.getClass().getMethod(getHardCollisionBoxEntityMethod.getName(), getHardCollisionBoxEntityMethod.getParameterTypes()).equals(getHardCollisionBoxEntityMethod)) { ++ hardCollides = Boolean.TRUE; ++ } else { ++ hardCollides = Boolean.FALSE; ++ } ++ cachedOverrides.put(this.getClass(), hardCollides); ++ } ++ catch (ThreadDeath thr) { throw thr; } ++ catch (Throwable thr) { ++ // shouldn't happen, just explode ++ throw new RuntimeException(thr); ++ } ++ } ++ this.hardCollides = hardCollides.booleanValue(); ++ } ++ ++ public final boolean hardCollides() { ++ return this.hardCollides; ++ } ++ // Tuinity end ++ + public Entity(EntityTypes entitytypes, World world) { + this.id = Entity.entityCount.incrementAndGet(); + this.passengers = Lists.newArrayList(); +@@ -590,7 +633,39 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return this.onGround; } @@ -2896,7 +2840,6 @@ index 5a8bcd91dc..db62601ea7 100644 + return this.moveStartZ; + } + // Tuinity end - detailed watchdog information -+ public void move(EnumMoveType enummovetype, Vec3D vec3d) { + // Tuinity start - detailed watchdog information + com.tuinity.tuinity.util.TickThread.ensureTickThread("Cannot move an entity off-main"); @@ -2911,16 +2854,16 @@ index 5a8bcd91dc..db62601ea7 100644 if (this.noclip) { this.a(this.getBoundingBox().c(vec3d)); this.recalcPosition(); -@@ -653,7 +694,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -618,7 +693,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke // Paper end vec3d = this.a(vec3d, enummovetype); -- Vec3D vec3d1 = this.f(vec3d); +- Vec3D vec3d1 = this.g(vec3d); + Vec3D vec3d1 = this.performCollision(vec3d); // Tuinity - optimise collisions if (vec3d1.g() > 1.0E-7D) { this.a(this.getBoundingBox().c(vec3d1)); -@@ -770,6 +811,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -734,6 +809,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.world.getMethodProfiler().exit(); } @@ -2933,8 +2876,8 @@ index 5a8bcd91dc..db62601ea7 100644 + // Tuinity end - detailed watchdog information } - protected BlockPosition ak() { -@@ -850,6 +898,132 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + protected BlockPosition ao() { +@@ -814,6 +896,132 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return d0; } @@ -3064,37 +3007,34 @@ index 5a8bcd91dc..db62601ea7 100644 + } + // Tuinity end - optimise entity movement + - private Vec3D f(Vec3D vec3d) { + private Vec3D g(Vec3D vec3d) { AxisAlignedBB axisalignedbb = this.getBoundingBox(); VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); -@@ -885,6 +1059,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -849,6 +1057,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return vec3d1; } -+ public static double getXZSquared(Vec3D vec3d) { return Entity.b(vec3d); } // Tuinity - OBFHELPER - public static double b(Vec3D vec3d) { ++ public static double getXZSquared(Vec3D vec3d) { return Entity.c(vec3d); } // Tuinity - OBFHELPER + public static double c(Vec3D vec3d) { return vec3d.x * vec3d.x + vec3d.z * vec3d.z; } -@@ -1091,6 +1266,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - - - @Nullable public final AxisAlignedBB getCollisionBox(){return ay();} //Paper - OBFHELPER -+ @Nullable public final AxisAlignedBB getHardCollisionBox() { return this.ay(); } // Tuinity - OBFHELPER - @Nullable public AxisAlignedBB ay() { - return null; - } -@@ -1974,8 +2150,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1928,11 +2137,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + return EnumInteractionResult.PASS; } - public final AxisAlignedBB getHardCollisionBox(Entity entity){ return j(entity);}//Paper - OBFHELPER -- @Nullable -- public AxisAlignedBB j(Entity entity) { -+ @Nullable public AxisAlignedBB getHardCollisionBoxWith(Entity entity) { return this.j(entity); } // Tuinity - OBFHELPER -+ @Nullable public AxisAlignedBB j(Entity entity) { // Tuinity - OBFHELPER - return null; +- public boolean j(Entity entity) { ++ public final boolean hardCollidesWith(Entity other) { return this.j(other); } // Tuinity - OBFHELPER ++ public boolean j(Entity entity) { // Tuinity - diff on change, hard colliding entities override this + return entity.aY() && !this.isSameVehicle(entity); } -@@ -3299,12 +3475,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +- public boolean aY() { ++ public final boolean collisionBoxIsHard() { return this.aY(); } // Tuinity - OBFHELPER ++ public boolean aY() { // Tuinity - diff on change, hard colliding entities override this + return false; + } + +@@ -3257,12 +3468,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return this.locBlock; } @@ -3111,7 +3051,7 @@ index 5a8bcd91dc..db62601ea7 100644 } public void setMot(double d0, double d1, double d2) { -@@ -3361,7 +3541,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -3317,7 +3532,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } // Paper end if (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2) { @@ -3121,11 +3061,24 @@ index 5a8bcd91dc..db62601ea7 100644 int i = MathHelper.floor(d0); int j = MathHelper.floor(d1); int k = MathHelper.floor(d2); +diff --git a/src/main/java/net/minecraft/server/EntityCat.java b/src/main/java/net/minecraft/server/EntityCat.java +index 314886398..79de11ce2 100644 +--- a/src/main/java/net/minecraft/server/EntityCat.java ++++ b/src/main/java/net/minecraft/server/EntityCat.java +@@ -292,7 +292,7 @@ public class EntityCat extends EntityTameableAnimal { + + WorldServer worldserver = worldaccess.getMinecraftWorld(); + +- if (worldserver instanceof WorldServer && ((WorldServer) worldserver).getStructureManager().a(this.getChunkCoordinates(), true, StructureGenerator.SWAMP_HUT).e()) { ++ if (worldserver instanceof WorldServer && ((WorldServer) worldserver).getStructureManager().getStructureStarts(this.getChunkCoordinates(), true, StructureGenerator.SWAMP_HUT, worldaccess).e()) { // Tuinity - fix deadlock on chunk gen + this.setCatType(10); + this.setPersistent(); + } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 1a61bc7c8a..b114346837 100644 +index b92e74349..aba9f08db 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2832,7 +2832,11 @@ public abstract class EntityLiving extends Entity { +@@ -2835,7 +2835,11 @@ public abstract class EntityLiving extends Entity { return; } // Paper - end don't run getEntities if we're not going to use its result @@ -3138,7 +3091,7 @@ index 1a61bc7c8a..b114346837 100644 if (!list.isEmpty()) { // Paper - move up -@@ -2861,6 +2865,9 @@ public abstract class EntityLiving extends Entity { +@@ -2864,6 +2868,9 @@ public abstract class EntityLiving extends Entity { this.C(entity); } } @@ -3149,7 +3102,7 @@ index 1a61bc7c8a..b114346837 100644 } diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index f75c09d44a..bfb931268d 100644 +index 831298e3b..7ab013058 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -74,6 +74,7 @@ public class EntityTrackerEntry { @@ -3161,7 +3114,7 @@ index f75c09d44a..bfb931268d 100644 if (!list.equals(this.p)) { diff --git a/src/main/java/net/minecraft/server/Fluid.java b/src/main/java/net/minecraft/server/Fluid.java -index 05fa52c0b1..8ffc5db509 100644 +index 05fa52c0b..8ffc5db50 100644 --- a/src/main/java/net/minecraft/server/Fluid.java +++ b/src/main/java/net/minecraft/server/Fluid.java @@ -9,8 +9,12 @@ public final class Fluid extends IBlockDataHolder { @@ -3187,7 +3140,7 @@ index 05fa52c0b1..8ffc5db509 100644 public float getHeight(IBlockAccess iblockaccess, BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/HeightMap.java b/src/main/java/net/minecraft/server/HeightMap.java -index 068b92c5c4..a43c4ca3ea 100644 +index 068b92c5c..a43c4ca3e 100644 --- a/src/main/java/net/minecraft/server/HeightMap.java +++ b/src/main/java/net/minecraft/server/HeightMap.java @@ -19,7 +19,25 @@ public class HeightMap { @@ -3271,7 +3224,7 @@ index 068b92c5c4..a43c4ca3ea 100644 this.i = heightmap_use; this.j = predicate; diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 10a5901db1..9117504767 100644 +index 10a5901db..911750476 100644 --- a/src/main/java/net/minecraft/server/IBlockData.java +++ b/src/main/java/net/minecraft/server/IBlockData.java @@ -8,6 +8,19 @@ public class IBlockData extends BlockBase.BlockData { @@ -3295,7 +3248,7 @@ index 10a5901db1..9117504767 100644 super(block, immutablemap, mapcodec); } diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java -index 582a5695ba..5601088cd5 100644 +index 582a5695b..5601088cd 100644 --- a/src/main/java/net/minecraft/server/IChunkLoader.java +++ b/src/main/java/net/minecraft/server/IChunkLoader.java @@ -21,7 +21,7 @@ public class IChunkLoader implements AutoCloseable { @@ -3308,7 +3261,7 @@ index 582a5695ba..5601088cd5 100644 // Paper - nuke IOWorker } diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index 1cc40b1f0a..3ce2f7497a 100644 +index 25e54a1fa..b66c802d5 100644 --- a/src/main/java/net/minecraft/server/ICollisionAccess.java +++ b/src/main/java/net/minecraft/server/ICollisionAccess.java @@ -46,6 +46,11 @@ public interface ICollisionAccess extends IBlockAccess { @@ -3324,19 +3277,49 @@ index 1cc40b1f0a..3ce2f7497a 100644 return this.d(entity, axisalignedbb, predicate).allMatch(VoxelShape::isEmpty); } finally { if (entity != null) entity.collisionLoadChunks = false; } // Paper diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 267a6baae8..0edcb775e9 100644 +index 1cb8ba7cd..882b82d89 100644 --- a/src/main/java/net/minecraft/server/IEntityAccess.java +++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -69,6 +69,7 @@ public interface IEntityAccess { +@@ -52,16 +52,26 @@ public interface IEntityAccess { + return this.b(oclass, axisalignedbb, IEntitySelector.g); + } + ++ // Tuinity start - optimise hard collision ++ /** ++ * Not guaranteed to only return hard colliding entities ++ */ ++ default List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { ++ return this.getEntities(entity, axisalignedbb, predicate); ++ } ++ // Tuinity end - optimise hard collision ++ + default Stream c(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { + if (axisalignedbb.a() < 1.0E-7D) { + return Stream.empty(); + } else { AxisAlignedBB axisalignedbb1 = axisalignedbb.g(1.0E-7D); - // Paper start +- return this.getEntities(entity, axisalignedbb1, predicate.and((entity1) -> { + if (predicate == null) predicate = (e) -> true; // Tuinity - allow nullable - Predicate effectivePredicate = predicate.and((entity1) -> { - return entity == null || !entity.isSameVehicle(entity1); - }); ++ predicate = predicate.and((entity1) -> { // Tuinity - optimise entity hard collisions // Tuinity - allow nullable + boolean flag; + +- if (entity1.getBoundingBox().c(axisalignedbb1)) { ++ if (true || entity1.getBoundingBox().c(axisalignedbb1)) { // Tuinity - always true, wtf did they think this.getEntities(entity, axisalignedbb1) does? + label25: + { + if (entity == null) { +@@ -79,7 +89,7 @@ public interface IEntityAccess { + + flag = false; + return flag; +- })).stream().map(Entity::getBoundingBox).map(VoxelShapes::a); ++ }); return ((entity != null && entity.hardCollides()) ? this.getEntities(entity, axisalignedbb1, predicate) : this.getHardCollidingEntities(entity, axisalignedbb1, predicate)).stream().map(Entity::getBoundingBox).map(VoxelShapes::a); // Tuinity - optimise entity hard collisions + } + } + diff --git a/src/main/java/net/minecraft/server/LightEngineStorage.java b/src/main/java/net/minecraft/server/LightEngineStorage.java -index b98e60772b..e0bbfe1422 100644 +index b98e60772..e0bbfe142 100644 --- a/src/main/java/net/minecraft/server/LightEngineStorage.java +++ b/src/main/java/net/minecraft/server/LightEngineStorage.java @@ -23,7 +23,8 @@ public abstract class LightEngineStorage> e @@ -3367,36 +3350,24 @@ index b98e60772b..e0bbfe1422 100644 while (objectiterator.hasNext()) { entry = (Entry) objectiterator.next(); -diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 87810f007a..8238306d9b 100644 ---- a/src/main/java/net/minecraft/server/MCUtil.java -+++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -48,6 +48,20 @@ public final class MCUtil { - new ThreadFactoryBuilder().setNameFormat("Paper Object Cleaner").build() - ); - -+ // Tuinity start -+ private static org.bukkit.entity.HumanEntity[] EMPTY_HUMAN_ARRAY = new org.bukkit.entity.HumanEntity[0]; -+ public static void closeInventory(IInventory inventory, org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { -+ List viewers = inventory.getViewers(); -+ if (viewers.isEmpty()) { -+ return; -+ } -+ -+ for (org.bukkit.entity.HumanEntity viewer : viewers.toArray(EMPTY_HUMAN_ARRAY)) { -+ viewer.closeInventory(reason); -+ } -+ } -+ // Tuinity end -+ - public static final long INVALID_CHUNK_KEY = getCoordinateKey(Integer.MAX_VALUE, Integer.MAX_VALUE); - +diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java +index ec8498c3d..ceaa92400 100644 +--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java ++++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java +@@ -20,7 +20,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { + private static final int MAX_PRIORITIES = PlayerChunkMap.GOLDEN_TICKET + 2; + private boolean isChunkLightStatus(long pair) { +- PlayerChunk playerChunk = playerChunkMap.getUpdatingChunk(pair); ++ PlayerChunk playerChunk = playerChunkMap.getVisibleChunk(pair); // Tuinity - mt-safe access + if (playerChunk == null) { + return false; + } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3130c68e73..d6b1cb8c48 100644 +index bbe793ca3..615a71a78 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -987,7 +987,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { @@ -3523,7 +3494,7 @@ index 3130c68e73..d6b1cb8c48 100644 return !this.canOversleep(); }); isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); -@@ -1261,6 +1317,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant> { @@ -3742,19 +3713,19 @@ index eb28c4df8d..54e374cc94 100644 } return true; diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 8335d00336..e0ee524093 100644 +index 5094a5d6f..72fdbf153 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -19,7 +19,7 @@ public class PacketPlayOutMapChunk implements Packet { @Nullable - private BiomeStorage e; + private int[] e; private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER - private List g; + private List g; private List getTileEntityData() { return this.g; } // Tuinity - OBFHELPER private boolean h; - private boolean i; -@@ -32,14 +32,16 @@ public class PacketPlayOutMapChunk implements Packet { + // Paper start - Async-Anti-Xray - Set the ready flag to true +@@ -31,14 +31,16 @@ public class PacketPlayOutMapChunk implements Packet { // Paper start private final java.util.List extraPackets = new java.util.ArrayList<>(); @@ -3768,14 +3739,14 @@ index 8335d00336..e0ee524093 100644 return extraPackets; } // Paper end -- public PacketPlayOutMapChunk(Chunk chunk, int i, boolean flag) { -+ public PacketPlayOutMapChunk(Chunk chunk, int i, boolean flag) { final int chunkSectionBitSet = i; // Tuinity - handle oversized chunk data packets more robustly +- public PacketPlayOutMapChunk(Chunk chunk, int i) { ++ public PacketPlayOutMapChunk(Chunk chunk, int i) { final int chunkSectionBitSet = i; // Tuinity - handle oversized chunk data packets more robustly ChunkPacketInfo chunkPacketInfo = chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); -@@ -48,29 +50,10 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -46,27 +48,12 @@ public class PacketPlayOutMapChunk implements Packet { + this.b = chunkcoordintpair.z; this.h = i == 65535; - this.i = flag; this.d = new NBTTagCompound(); - Iterator iterator = chunk.f().iterator(); - @@ -3789,7 +3760,7 @@ index 8335d00336..e0ee524093 100644 - } - - if (this.h) { -- this.e = chunk.getBiomeIndex().b(); +- this.e = chunk.getBiomeIndex().a(); - } - - this.f = new byte[this.a(chunk, i)]; @@ -3797,20 +3768,20 @@ index 8335d00336..e0ee524093 100644 - if (chunkPacketInfo != null) { - chunkPacketInfo.setData(this.getData()); - } -- this.c = this.writeChunk(new PacketDataSerializer(this.k()), chunk, i, chunkPacketInfo); -- // Paper end +- this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); ++ // Tuinity - move this after the tile entity logic, we need to determine whether we're going to split ++ // Tuinity - before writing chunk block data ++ // Tuinity - note: for future maintenance, git will prefer the smallest diff, so if moving the TE code is ++ // Tuinity - a smaller diff, do that, else move the chunk writing - this makes sure the start/end is correct ++ Iterator iterator; // Tuinity - move declaration up ++ Entry entry; // Tuinity - move delcaration up + // Paper end this.g = Lists.newArrayList(); -+ // Tuinity start - moved code up (moved declaration of Iterator + Entry up) -+ Iterator iterator; -+ Entry entry; iterator = chunk.getTileEntities().entrySet().iterator(); - int totalTileEntities = 0; // Paper - -@@ -82,7 +65,15 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -79,8 +66,16 @@ public class PacketPlayOutMapChunk implements Packet { + int j = blockposition.getY() >> 4; if (this.f() || (i & 1 << j) != 0) { - // Paper start - improve oversized chunk data packet handling -- if (++totalTileEntities > TE_LIMIT) { + // Tuinity start - improve oversized chunk data packet handling + ++totalTileEntities; + if (totalTileEntities > TE_SPLIT_LIMIT) { @@ -3819,16 +3790,18 @@ index 8335d00336..e0ee524093 100644 + this.extraPackets.clear(); + break; + } -+ if (totalTileEntities > TE_LIMIT) { // Tuinity end + // Paper start - improve oversized chunk data packet handling +- if (++totalTileEntities > TE_LIMIT) { ++ if (totalTileEntities > TE_LIMIT) { // Tuinity end - improve oversized chunk data packet handling PacketPlayOutTileEntityData updatePacket = tileentity.getUpdatePacket(); if (updatePacket != null) { this.extraPackets.add(updatePacket); -@@ -96,7 +87,69 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -94,7 +89,42 @@ public class PacketPlayOutMapChunk implements Packet { this.g.add(nbttagcompound); } } -+ iterator = chunk.f().iterator(); // Tuinity - moved declaration of Iterator and Entry up -+ // Tuinity - moved this all up ++ // Tuinity start - moved after tile entity gathering ++ iterator = chunk.f().iterator(); // Declared earlier + + while (iterator.hasNext()) { + entry = (Entry) iterator.next(); @@ -3838,7 +3811,7 @@ index 8335d00336..e0ee524093 100644 + } + + if (this.h) { -+ this.e = chunk.getBiomeIndex().b(); ++ this.e = chunk.getBiomeIndex().a(); + } + + this.f = new byte[this.a(chunk, i)]; @@ -3846,36 +3819,8 @@ index 8335d00336..e0ee524093 100644 + if (chunkPacketInfo != null) { + chunkPacketInfo.setData(this.getData()); + } -+ this.c = this.writeChunk(new PacketDataSerializer(this.k()), chunk, i, chunkPacketInfo); -+ // Paper end -+ // Tuinity start - move this all up -+// this.g = Lists.newArrayList(); -+// iterator = chunk.getTileEntities().entrySet().iterator(); -+// int totalTileEntities = 0; // Paper -+// -+// while (iterator.hasNext()) { -+// entry = (Entry) iterator.next(); -+// BlockPosition blockposition = (BlockPosition) entry.getKey(); -+// TileEntity tileentity = (TileEntity) entry.getValue(); -+// int j = blockposition.getY() >> 4; -+// -+// if (this.f() || (i & 1 << j) != 0) { -+// // Paper start - improve oversized chunk data packet handling -+// if (++totalTileEntities > TE_LIMIT) { -+// PacketPlayOutTileEntityData updatePacket = tileentity.getUpdatePacket(); -+// if (updatePacket != null) { -+// this.extraPackets.add(updatePacket); -+// continue; -+// } -+// } -+// // Paper end -+// NBTTagCompound nbttagcompound = tileentity.b(); -+// if (tileentity instanceof TileEntitySkull) { TileEntitySkull.sanitizeTileEntityUUID(nbttagcompound); } // Paper -+// -+// this.g.add(nbttagcompound); -+// } -+// } -+ // Tuinity end - move this all up ++ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); ++ // Tuinity end - moved after tile entity gathering chunk.world.chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks + // Tuinity start - improve oversized chunk data packet handling + if (this.mustSplit) { @@ -3886,14 +3831,15 @@ index 8335d00336..e0ee524093 100644 + chunkSectionBitSetCopy ^= trailingBit; // move on to the next + + if (chunk.getSections()[sectionIndex] != null) { -+ this.extraPackets.add(new PacketPlayOutMapChunk(chunk, trailingBit, false)); ++ this.extraPackets.add(new PacketPlayOutMapChunk(chunk, trailingBit)); + } + } -+ } // Tuinity end - improve oversized chunk data packet handling ++ } ++ // Tuinity end - improve oversized chunk data packet handling } // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag -@@ -189,7 +242,7 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -185,7 +215,7 @@ public class PacketPlayOutMapChunk implements Packet { for (int l = achunksection.length; k < l; ++k) { ChunkSection chunksection = achunksection[k]; @@ -3902,7 +3848,7 @@ index 8335d00336..e0ee524093 100644 j |= 1 << k; chunksection.writeChunkSection(packetdataserializer, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info } -@@ -206,7 +259,7 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -202,7 +232,7 @@ public class PacketPlayOutMapChunk implements Packet { for (int l = achunksection.length; k < l; ++k) { ChunkSection chunksection = achunksection[k]; @@ -3912,23 +3858,32 @@ index 8335d00336..e0ee524093 100644 } } diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index d7f0df123b..ec55785af2 100644 +index a0555b132..9caf6598f 100644 --- a/src/main/java/net/minecraft/server/PathfinderNormal.java +++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -538,7 +538,7 @@ public class PathfinderNormal extends PathfinderAbstract { - if (!iblockdata.a(iblockaccess, blockposition, PathMode.LAND)) { - return PathType.BLOCKED; - } else { -- Fluid fluid = iblockaccess.getFluid(blockposition); -+ Fluid fluid = iblockdata.getFluid(); // Tuinity - remove another getType call +@@ -475,7 +475,7 @@ public class PathfinderNormal extends PathfinderAbstract { + return PathType.DANGER_FIRE; + } - return fluid.a((Tag) TagsFluid.WATER) ? PathType.WATER : (fluid.a((Tag) TagsFluid.LAVA) ? PathType.LAVA : PathType.OPEN); - } +- if (iblockaccess.getFluid(blockposition_mutableblockposition).a((Tag) TagsFluid.WATER)) { ++ if (iblockdata.getFluid().a((Tag) TagsFluid.WATER)) { // Tuinity - remove another getType call + return PathType.WATER_BORDER; + } + } // Paper +@@ -505,7 +505,7 @@ public class PathfinderNormal extends PathfinderAbstract { + } else if (iblockdata.a(Blocks.COCOA)) { + return PathType.COCOA; + } else { +- Fluid fluid = iblockaccess.getFluid(blockposition); ++ Fluid fluid = iblockdata.getFluid(); // Tuinity - remove another get type call + + return fluid.a((Tag) TagsFluid.WATER) ? PathType.WATER : (fluid.a((Tag) TagsFluid.LAVA) ? PathType.LAVA : (a(iblockdata) ? PathType.DAMAGE_FIRE : (BlockDoor.l(iblockdata) && !(Boolean) iblockdata.get(BlockDoor.OPEN) ? PathType.DOOR_WOOD_CLOSED : (block instanceof BlockDoor && material == Material.ORE && !(Boolean) iblockdata.get(BlockDoor.OPEN) ? PathType.DOOR_IRON_CLOSED : (block instanceof BlockDoor && (Boolean) iblockdata.get(BlockDoor.OPEN) ? PathType.DOOR_OPEN : (block instanceof BlockMinecartTrackAbstract ? PathType.RAIL : (block instanceof BlockLeaves ? PathType.LEAVES : (!block.a((Tag) TagsBlock.FENCES) && !block.a((Tag) TagsBlock.WALLS) && (!(block instanceof BlockFenceGate) || (Boolean) iblockdata.get(BlockFenceGate.OPEN)) ? (!iblockdata.a(iblockaccess, blockposition, PathMode.LAND) ? PathType.BLOCKED : PathType.OPEN) : PathType.FENCE)))))))); + } diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index c14cdb6024..8ec21eb955 100644 +index 92a5a5cef..9f1dd6e1a 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -494,6 +494,7 @@ public class PlayerChunk { +@@ -501,6 +501,7 @@ public class PlayerChunk { // Paper end - per player view distance } @@ -3936,7 +3891,7 @@ index c14cdb6024..8ec21eb955 100644 public CompletableFuture> a(ChunkStatus chunkstatus, PlayerChunkMap playerchunkmap) { int i = chunkstatus.c(); CompletableFuture> completablefuture = (CompletableFuture) this.statusFutures.get(i); -@@ -549,6 +550,7 @@ public class PlayerChunk { +@@ -556,6 +557,7 @@ public class PlayerChunk { } protected void a(PlayerChunkMap playerchunkmap) { @@ -3944,7 +3899,7 @@ index c14cdb6024..8ec21eb955 100644 ChunkStatus chunkstatus = getChunkStatus(this.oldTicketLevel); ChunkStatus chunkstatus1 = getChunkStatus(this.ticketLevel); boolean flag = this.oldTicketLevel <= PlayerChunkMap.GOLDEN_TICKET; -@@ -558,7 +560,8 @@ public class PlayerChunk { +@@ -565,7 +567,8 @@ public class PlayerChunk { // CraftBukkit start // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins. if (playerchunk_state.isAtLeast(PlayerChunk.State.BORDER) && !playerchunk_state1.isAtLeast(PlayerChunk.State.BORDER)) { @@ -3954,7 +3909,7 @@ index c14cdb6024..8ec21eb955 100644 Chunk chunk = (Chunk)either.left().orElse(null); if (chunk != null) { playerchunkmap.callbackExecutor.execute(() -> { -@@ -623,7 +626,8 @@ public class PlayerChunk { +@@ -630,7 +633,8 @@ public class PlayerChunk { if (!flag2 && flag3) { // Paper start - cache ticking ready status int expectCreateCount = ++this.fullChunkCreateCount; @@ -3964,7 +3919,7 @@ index c14cdb6024..8ec21eb955 100644 if (either.left().isPresent() && PlayerChunk.this.fullChunkCreateCount == expectCreateCount) { // note: Here is a very good place to add callbacks to logic waiting on this. Chunk fullChunk = either.left().get(); -@@ -654,7 +658,8 @@ public class PlayerChunk { +@@ -661,7 +665,8 @@ public class PlayerChunk { if (!flag4 && flag5) { // Paper start - cache ticking ready status @@ -3974,7 +3929,7 @@ index c14cdb6024..8ec21eb955 100644 if (either.left().isPresent()) { // note: Here is a very good place to add callbacks to logic waiting on this. Chunk tickingChunk = either.left().get(); -@@ -685,12 +690,20 @@ public class PlayerChunk { +@@ -692,12 +697,20 @@ public class PlayerChunk { } // Paper start - cache ticking ready status @@ -3997,7 +3952,7 @@ index c14cdb6024..8ec21eb955 100644 -@@ -702,6 +715,17 @@ public class PlayerChunk { +@@ -709,6 +722,17 @@ public class PlayerChunk { if (flag6 && !flag7) { this.entityTickingFuture.complete(PlayerChunk.UNLOADED_CHUNK); this.isEntityTickingReady = false; // Paper - cache chunk ticking stage @@ -4015,7 +3970,7 @@ index c14cdb6024..8ec21eb955 100644 this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; } -@@ -728,7 +752,8 @@ public class PlayerChunk { +@@ -735,7 +759,8 @@ public class PlayerChunk { // CraftBukkit start // ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins. if (!playerchunk_state.isAtLeast(PlayerChunk.State.BORDER) && playerchunk_state1.isAtLeast(PlayerChunk.State.BORDER)) { @@ -4026,10 +3981,10 @@ index c14cdb6024..8ec21eb955 100644 if (chunk != null) { playerchunkmap.callbackExecutor.execute(() -> { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 03a79ff992..d59ef07e1c 100644 +index 8a069cfcb..66d6c15ab 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -119,31 +119,28 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -121,31 +121,28 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { @@ -4072,7 +4027,7 @@ index 03a79ff992..d59ef07e1c 100644 task.run(); } } -@@ -198,6 +195,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -200,6 +197,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper end - no-tick view distance void addPlayerToDistanceMaps(EntityPlayer player) { @@ -4080,7 +4035,7 @@ index 03a79ff992..d59ef07e1c 100644 int chunkX = MCUtil.getChunkCoordinate(player.locX()); int chunkZ = MCUtil.getChunkCoordinate(player.locZ()); // Note: players need to be explicitly added to distance maps before they can be updated -@@ -228,6 +226,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -230,6 +228,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } void removePlayerFromDistanceMaps(EntityPlayer player) { @@ -4088,7 +4043,7 @@ index 03a79ff992..d59ef07e1c 100644 // Paper start - use distance map to optimise tracker for (int i = 0, len = TRACKING_RANGE_TYPES.length; i < len; ++i) { this.playerEntityTrackerTrackMaps[i].remove(player); -@@ -245,6 +244,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -247,6 +246,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } void updateMaps(EntityPlayer player) { @@ -4096,11 +4051,10 @@ index 03a79ff992..d59ef07e1c 100644 int chunkX = MCUtil.getChunkCoordinate(player.locX()); int chunkZ = MCUtil.getChunkCoordinate(player.locZ()); // Note: players need to be explicitly added to distance maps before they can be updated -@@ -276,6 +276,30 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -277,6 +277,29 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } // Paper end - private final java.util.concurrent.ExecutorService lightThread; -+ + // Tuinity start + public static enum RegionData implements com.tuinity.tuinity.chunk.SingleThreadChunkRegionManager.RegionDataCreator { + // Tuinity start - optimise notify() @@ -4124,10 +4078,10 @@ index 03a79ff992..d59ef07e1c 100644 + public final com.tuinity.tuinity.chunk.SingleThreadChunkRegionManager dataRegionManager; + // Tuiniy end + + private final java.util.concurrent.ExecutorService lightThread; public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i, boolean flag) { super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag); - //this.visibleChunks = this.updatingChunks.clone(); // Paper - no more cloning -@@ -442,6 +466,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -444,6 +467,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { PlayerChunkMap.this.sendChunk(player, new ChunkCoordIntPair(rangeX, rangeZ), null, true, false); // unloaded, loaded }); // Paper end - no-tick view distance @@ -4137,7 +4091,7 @@ index 03a79ff992..d59ef07e1c 100644 } // Paper start - Chunk Prioritization public void queueHolderUpdate(PlayerChunk playerchunk) { -@@ -754,6 +781,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -756,6 +782,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @Nullable private PlayerChunk a(long i, int j, @Nullable PlayerChunk playerchunk, int k) { @@ -4145,7 +4099,7 @@ index 03a79ff992..d59ef07e1c 100644 if (k > PlayerChunkMap.GOLDEN_TICKET && j > PlayerChunkMap.GOLDEN_TICKET) { return playerchunk; } else { -@@ -776,6 +804,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -778,6 +805,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { playerchunk.a(j); } else { playerchunk = new PlayerChunk(new ChunkCoordIntPair(i), j, this.lightEngine, this.p, this); @@ -4153,7 +4107,7 @@ index 03a79ff992..d59ef07e1c 100644 } this.updatingChunks.put(i, playerchunk); -@@ -968,7 +997,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -970,7 +998,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, chunkPos.x, chunkPos.z, @@ -4162,7 +4116,7 @@ index 03a79ff992..d59ef07e1c 100644 if (!chunk.isNeedsSaving()) { return; -@@ -1002,7 +1031,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1004,7 +1032,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { asyncSaveData = ChunkRegionLoader.getAsyncSaveData(this.world, chunk); } @@ -4171,7 +4125,7 @@ index 03a79ff992..d59ef07e1c 100644 asyncSaveData, chunk); chunk.setLastSaved(this.world.getTime()); -@@ -1041,6 +1070,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1043,6 +1071,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.lightEngine.a(ichunkaccess.getPos()); this.lightEngine.queueUpdate(); this.worldLoadListener.a(ichunkaccess.getPos(), (ChunkStatus) null); @@ -4179,7 +4133,7 @@ index 03a79ff992..d59ef07e1c 100644 } } -@@ -1057,6 +1087,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1059,6 +1088,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } protected boolean b() { @@ -4187,7 +4141,7 @@ index 03a79ff992..d59ef07e1c 100644 if (!this.updatingChunksModified) { return false; } else { -@@ -1244,7 +1275,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1246,7 +1276,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } // Paper end this.mailboxWorldGen.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); @@ -4199,7 +4153,7 @@ index 03a79ff992..d59ef07e1c 100644 } protected void c(ChunkCoordIntPair chunkcoordintpair) { -@@ -1496,6 +1530,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1498,6 +1531,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } public void setViewDistance(int i) { // Paper - public @@ -4207,7 +4161,7 @@ index 03a79ff992..d59ef07e1c 100644 int j = MathHelper.clamp(i + 1, 3, 33); // Paper - diff on change, these make the lower view distance limit 2 and the upper 32 if (j != this.viewDistance) { -@@ -1509,6 +1544,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1511,6 +1545,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - no-tick view distance public final void setNoTickViewDistance(int viewDistance) { @@ -4215,7 +4169,7 @@ index 03a79ff992..d59ef07e1c 100644 viewDistance = viewDistance == -1 ? -1 : MathHelper.clamp(viewDistance, 2, 32); this.noTickViewDistance = viewDistance; -@@ -2035,23 +2071,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -2037,23 +2072,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final void processTrackQueue() { this.world.timings.tracker1.startTiming(); try { @@ -4250,7 +4204,7 @@ index 03a79ff992..d59ef07e1c 100644 // Paper end - optimised tracker diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 6259ff4a57..ddb56ffd2b 100644 +index bc613281d..d32f423c5 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -322,19 +322,24 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -4296,7 +4250,7 @@ index 6259ff4a57..ddb56ffd2b 100644 this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); return; } -@@ -975,7 +982,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -969,7 +976,7 @@ public class PlayerConnection implements PacketListenerPlayIn { } if (this.teleportPos != null) { @@ -4305,7 +4259,7 @@ index 6259ff4a57..ddb56ffd2b 100644 this.A = this.e; this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); } -@@ -999,7 +1006,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -993,7 +1000,7 @@ public class PlayerConnection implements PacketListenerPlayIn { double d2 = this.player.locZ(); double d3 = this.player.locY(); double d4 = packetplayinflying.a(this.player.locX());double toX = d4; // Paper - OBFHELPER @@ -4314,7 +4268,7 @@ index 6259ff4a57..ddb56ffd2b 100644 double d6 = packetplayinflying.c(this.player.locZ());double toZ = d6; // Paper - OBFHELPER float f = packetplayinflying.a(this.player.yaw); float f1 = packetplayinflying.b(this.player.pitch); -@@ -1007,7 +1014,12 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1001,7 +1008,12 @@ public class PlayerConnection implements PacketListenerPlayIn { double d8 = d5 - this.m; double d9 = d6 - this.n; double d10 = this.player.getMot().g(); @@ -4328,7 +4282,7 @@ index 6259ff4a57..ddb56ffd2b 100644 if (this.player.isSleeping()) { if (d11 > 1.0D) { -@@ -1040,7 +1052,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1034,7 +1046,7 @@ public class PlayerConnection implements PacketListenerPlayIn { speed = player.abilities.walkSpeed * 10f; } // Paper start - Prevent moving into unloaded chunks @@ -4337,15 +4291,15 @@ index 6259ff4a57..ddb56ffd2b 100644 this.internalTeleport(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch, Collections.emptySet()); return; } -@@ -1096,6 +1108,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1090,6 +1102,7 @@ public class PlayerConnection implements PacketListenerPlayIn { } this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); + boolean didCollide = toX != this.player.locX() || toY != this.player.locY() || toZ != this.player.locZ(); // Tuinity - needed here as the difference in Y can be reset - also note: this is only a guess at whether collisions took place, floating point errors can make this true when it shouldn't be... - this.player.c(packetplayinflying.b()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move + this.player.setOnGround(packetplayinflying.b()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move // Paper start - prevent position desync if (this.teleportPos != null) { -@@ -1120,7 +1133,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1114,7 +1127,7 @@ public class PlayerConnection implements PacketListenerPlayIn { } this.player.setLocation(d4, d5, d6, f, f1); @@ -4355,7 +4309,7 @@ index 6259ff4a57..ddb56ffd2b 100644 } else { // CraftBukkit start - fire PlayerMoveEvent diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -index 7ea293f38d..e698dd2260 100644 +index 7ea293f38..e698dd226 100644 --- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java +++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java @@ -13,10 +13,30 @@ public class PlayerConnectionUtils { @@ -4403,7 +4357,7 @@ index 7ea293f38d..e698dd2260 100644 }); throw CancelledPacketHandleException.INSTANCE; diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 6d192b2744..f5de49e3e3 100644 +index 6d192b274..f5de49e3e 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -21,14 +21,29 @@ public class PlayerInteractManager { @@ -4538,7 +4492,7 @@ index 6d192b2744..f5de49e3e3 100644 this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); // CraftBukkit - SPIGOT-5196 } diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 3b03c28ee5..6ac9f437e8 100644 +index 5b0cd414c..a3ac88350 100644 --- a/src/main/java/net/minecraft/server/ProtoChunk.java +++ b/src/main/java/net/minecraft/server/ProtoChunk.java @@ -179,14 +179,11 @@ public class ProtoChunk implements IChunkAccess { @@ -4574,24 +4528,33 @@ index 3b03c28ee5..6ac9f437e8 100644 } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 939b518266..7f2382a895 100644 +index 1751fb693..850673aa6 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -28,14 +28,349 @@ public class RegionFile implements AutoCloseable { +@@ -5,6 +5,7 @@ import java.io.BufferedInputStream; + import java.io.BufferedOutputStream; + import java.io.ByteArrayInputStream; + import java.io.ByteArrayOutputStream; ++import java.io.DataInput; + import java.io.DataInputStream; + import java.io.DataOutputStream; + import java.io.File; +@@ -29,15 +30,350 @@ public class RegionFile implements AutoCloseable { private static final Logger LOGGER = LogManager.getLogger(); - private static final ByteBuffer b = ByteBuffer.allocateDirect(1); + private static final ByteBuffer c = ByteBuffer.allocateDirect(1); private final FileChannel dataFile; -- private final java.nio.file.Path d; -- private final RegionFileCompression e; -+ private final java.nio.file.Path d; private final java.nio.file.Path getContainingDataFolder() { return this.d; } // Tuinity - OBFHELPER -+ private final RegionFileCompression e; private final RegionFileCompression getRegionFileCompression() { return this.e; } // Tuinity - OBFHELPER - private final ByteBuffer f; -- private final IntBuffer g; +- private final java.nio.file.Path e; +- private final RegionFileCompression f; ++ private final java.nio.file.Path e; private final java.nio.file.Path getContainingDataFolder() { return this.e; } // Tuinity - OBFHELPER ++ private final RegionFileCompression f; private final RegionFileCompression getRegionFileCompression() { return this.f; } // Tuinity - OBFHELPER + private final ByteBuffer g; - private final IntBuffer h; -+ private final IntBuffer g; private final IntBuffer getOffsets() { return this.g; } // Tuinity - OBFHELPER -+ private final IntBuffer h; private final IntBuffer getTimestamps() { return this.h; } // Tuinity - OBFHELPER - private final RegionFileBitSet freeSectors; - public final File file; +- private final IntBuffer i; ++ private final IntBuffer h; private final IntBuffer getOffsets() { return this.h; } // Tuinity - OBFHELPER ++ private final IntBuffer i; private final IntBuffer getTimestamps() { return this.i; } // Tuinity - OBFHELPER + @VisibleForTesting + protected final RegionFileBitSet freeSectors; + public final File file; // Paper + // Tuinity start - try to recover from RegionFile header corruption + private static long roundToSectors(long bytes) { @@ -4635,7 +4598,7 @@ index 939b518266..7f2382a895 100644 + + InputStream input = compression.wrap(new ByteArrayInputStream(chunkData.array(), chunkData.position(), chunkDataLength - chunkData.position())); + -+ return NBTCompressedStreamTools.readNBT(new DataInputStream(new BufferedInputStream(input))); ++ return NBTCompressedStreamTools.readNBT((java.io.DataInput)new DataInputStream(new BufferedInputStream(input))); + } catch (Exception ex) { + return null; + } @@ -4768,7 +4731,7 @@ index 939b518266..7f2382a895 100644 + try { + chunkData = Files.readAllBytes(regionFile.toPath()); + } catch (Exception ex) { -+ MinecraftServer.LOGGER.error("Failed to read oversized chunk data in file " + regionFile.getAbsolutePath(), ex); ++ MinecraftServer.LOGGER.error("Failed to read oversized chunk data in file " + regionFile.getAbsolutePath() + ", data will be lost", ex); + continue; + } + @@ -4779,7 +4742,7 @@ index 939b518266..7f2382a895 100644 + for (RegionFileCompression compressionType : RegionFileCompression.getCompressionTypes().values()) { + try { + DataInputStream in = new DataInputStream(new BufferedInputStream(compressionType.wrap(new ByteArrayInputStream(chunkData)))); // typical java -+ compound = NBTCompressedStreamTools.readNBT(in); ++ compound = NBTCompressedStreamTools.readNBT((DataInput)in); + compression = compressionType; + break; // reaches here iff readNBT does not throw + } catch (Exception ex) { @@ -4931,7 +4894,7 @@ index 939b518266..7f2382a895 100644 public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper // Paper start - Cache chunk status -@@ -63,10 +398,21 @@ public class RegionFile implements AutoCloseable { +@@ -65,11 +401,22 @@ public class RegionFile implements AutoCloseable { // Paper end public RegionFile(File file, File file1, boolean flag) throws IOException { @@ -4948,37 +4911,59 @@ index 939b518266..7f2382a895 100644 + this(java_nio_file_path, java_nio_file_path1, regionfilecompression, flag, false); + } + public RegionFile(java.nio.file.Path java_nio_file_path, java.nio.file.Path java_nio_file_path1, RegionFileCompression regionfilecompression, boolean flag, boolean canRecalcHeader) throws IOException { + this.g = ByteBuffer.allocateDirect(8192); + this.canRecalcHeader = canRecalcHeader; + // Tuinity end - add can recalc flag this.file = java_nio_file_path.toFile(); // Paper - this.f = ByteBuffer.allocateDirect(8192); - initOversizedState(); -@@ -95,12 +441,15 @@ public class RegionFile implements AutoCloseable { + initOversizedState(); // Paper + this.freeSectors = new RegionFileBitSet(); +@@ -97,14 +444,16 @@ public class RegionFile implements AutoCloseable { RegionFile.LOGGER.warn("Region file {} has truncated header: {}", java_nio_file_path, i); } -- for (int j = 0; j < 1024; ++j) { +- long j = Files.size(java_nio_file_path); ++ final long j = Files.size(java_nio_file_path); final long regionFileSize = j; + + boolean needsHeaderRecalc = false; // Tuinity - recalculate header on header corruption + boolean hasBackedUp = false; // Tuinity - recalculate header on header corruption -+ -+ for (int j = 0; j < 1024; ++j) { // Tuinity - diff on change, we expect j to be the header location - int k = this.g.get(j); + for (int k = 0; k < 1024; ++k) { +- int l = this.h.get(k); ++ int l = this.h.get(k); final int headerLocation = k; // Tuinity - we expect this to be the header location - if (k != 0) { -- int l = b(k); -- int i1 = a(k); -+ int l = b(k); // Tuinity - diff on change, we expect l to be offset in file -+ int i1 = a(k); // Tuinity - diff on change, we expect i1 to be sector length of region + if (l != 0) { +- int i1 = b(l); +- int j1 = a(l); ++ final int i1 = b(l); final int offset = i1; // Tuinity - we expect this to be offset in file in sectors ++ int j1 = a(l); final int sectorLength; // Tuinity - diff on change, we expect this to be sector length of region - watch out for reassignments // Spigot start - if (i1 == 255) { + if (j1 == 255) { // We're maxed out, so we need to read the proper length from the section -@@ -110,20 +459,87 @@ public class RegionFile implements AutoCloseable { +@@ -112,33 +461,105 @@ public class RegionFile implements AutoCloseable { + this.dataFile.read(realLen, i1 * 4096); + j1 = (realLen.getInt(0) + 4) / 4096 + 1; } ++ sectorLength = j1; // Tuinity - diff on change, we expect this to be sector length of region // Spigot end -- this.freeSectors.a(l, i1); + if (i1 < 2) { + RegionFile.LOGGER.warn("Region file {} has invalid sector at index: {}; sector {} overlaps with header", java_nio_file_path, k, i1); +- this.h.put(k, 0); +- } else if (j1 == 0) { ++ //this.h.put(k, 0); // Tuinity - we catch this, but need it in the header for the summary change ++ } else if (j1 <= 0) { // Tuinity - <= 0, not == + RegionFile.LOGGER.warn("Region file {} has an invalid sector at index: {}; size has to be > 0", java_nio_file_path, k); +- this.h.put(k, 0); ++ //this.h.put(k, 0); // Tuinity - we catch this, but need it in the header for the summary change + } else if ((long) i1 * 4096L > j) { + RegionFile.LOGGER.warn("Region file {} has an invalid sector at index: {}; sector {} is out of bounds", java_nio_file_path, k, i1); +- this.h.put(k, 0); ++ //this.h.put(k, 0); // Tuinity - we catch this, but need it in the header for the summary change + } else { +- this.freeSectors.a(i1, j1); ++ //this.freeSectors.a(i1, j1); // Tuinity - move this down so we can check if it fails to allocate + } + // Tuinity start - recalculate header on header corruption -+ if (l < 0 || i1 < 0 || (l + i1) < 0) { ++ if (offset < 2 || sectorLength <= 0 || ((long)offset * 4096L) > regionFileSize) { + if (canRecalcHeader) { + MinecraftServer.LOGGER.error("Detected invalid header for regionfile " + this.file.getAbsolutePath() + "! Recalculating header..."); + needsHeaderRecalc = true; @@ -4986,27 +4971,30 @@ index 939b518266..7f2382a895 100644 + } else { + // location = chunkX | (chunkZ << 5); + MinecraftServer.LOGGER.fatal("Detected invalid header for regionfile " + this.file.getAbsolutePath() + -+ "! Cannot recalculate, removing local chunk (" + (j & 31) + "," + (j >>> 5) + ") from header"); ++ "! Cannot recalculate, removing local chunk (" + (headerLocation & 31) + "," + (headerLocation >>> 5) + ") from header"); + if (!hasBackedUp) { + hasBackedUp = true; + this.backupRegionFile(); + } -+ this.getTimestamps().put(j, 0); // be consistent, delete the timestamp too -+ this.getOffsets().put(j, 0); // delete the entry from header ++ this.getTimestamps().put(headerLocation, 0); // be consistent, delete the timestamp too ++ this.getOffsets().put(headerLocation, 0); // delete the entry from header + continue; + } + } -+ boolean failedToAllocate = !this.freeSectors.tryAllocate(l, i1); -+ if (failedToAllocate && !canRecalcHeader) { ++ boolean failedToAllocate = !this.freeSectors.tryAllocate(offset, sectorLength); ++ if (failedToAllocate) { ++ MinecraftServer.LOGGER.error("Overlapping allocation by local chunk (" + (headerLocation & 31) + "," + (headerLocation >>> 5) + ") in regionfile " + this.file.getAbsolutePath()); ++ } ++ if (failedToAllocate & !canRecalcHeader) { + // location = chunkX | (chunkZ << 5); + MinecraftServer.LOGGER.fatal("Detected invalid header for regionfile " + this.file.getAbsolutePath() + -+ "! Cannot recalculate, removing local chunk (" + (j & 31) + "," + (j >>> 5) + ") from header"); ++ "! Cannot recalculate, removing local chunk (" + (headerLocation & 31) + "," + (headerLocation >>> 5) + ") from header"); + if (!hasBackedUp) { + hasBackedUp = true; + this.backupRegionFile(); + } -+ this.getTimestamps().put(j, 0); // be consistent, delete the timestamp too -+ this.getOffsets().put(j, 0); // delete the entry from header ++ this.getTimestamps().put(headerLocation, 0); // be consistent, delete the timestamp too ++ this.getOffsets().put(headerLocation, 0); // delete the entry from header + continue; + } + needsHeaderRecalc |= failedToAllocate; @@ -5016,8 +5004,8 @@ index 939b518266..7f2382a895 100644 + + // Tuinity start - recalculate header on header corruption + // we move the recalc here so comparison to old header is correct when logging to console -+ if (needsHeaderRecalc) { // true if header gave us overlapping allocations -+ MinecraftServer.LOGGER.error("Recalculating regionfile " + this.file.getAbsolutePath() + ", header gave conflicting offsets & locations"); ++ if (needsHeaderRecalc) { // true if header gave us overlapping allocations or had other issues ++ MinecraftServer.LOGGER.error("Recalculating regionfile " + this.file.getAbsolutePath() + ", header gave erroneous offsets & locations"); + this.recalculateHeader(); + } + // Tuinity end @@ -5031,7 +5019,7 @@ index 939b518266..7f2382a895 100644 - String s = "c." + chunkcoordintpair.x + "." + chunkcoordintpair.z + ".mcc"; + String s = "c." + chunkcoordintpair.x + "." + chunkcoordintpair.z + ".mcc"; // Tuinity - diff on change - return this.d.resolve(s); + return this.e.resolve(s); } + // Tuinity start @@ -5062,7 +5050,7 @@ index 939b518266..7f2382a895 100644 @Nullable public synchronized DataInputStream getReadStream(ChunkCoordIntPair chunkCoordIntPair) throws IOException { return a(chunkCoordIntPair);} // Paper - OBFHELPER @Nullable public synchronized DataInputStream a(ChunkCoordIntPair chunkcoordintpair) throws IOException { -@@ -147,6 +563,12 @@ public class RegionFile implements AutoCloseable { +@@ -162,6 +583,12 @@ public class RegionFile implements AutoCloseable { this.dataFile.read(bytebuffer, (long) (j * 4096)); ((java.nio.Buffer) bytebuffer).flip(); if (bytebuffer.remaining() < 5) { @@ -5075,7 +5063,7 @@ index 939b518266..7f2382a895 100644 RegionFile.LOGGER.error("Chunk {} header is truncated: expected {} but read {}", chunkcoordintpair, l, bytebuffer.remaining()); return null; } else { -@@ -155,6 +577,12 @@ public class RegionFile implements AutoCloseable { +@@ -170,6 +597,12 @@ public class RegionFile implements AutoCloseable { if (i1 == 0) { RegionFile.LOGGER.warn("Chunk {} is allocated, but stream is missing", chunkcoordintpair); @@ -5088,7 +5076,7 @@ index 939b518266..7f2382a895 100644 return null; } else { int j1 = i1 - 1; -@@ -167,9 +595,21 @@ public class RegionFile implements AutoCloseable { +@@ -182,9 +615,21 @@ public class RegionFile implements AutoCloseable { return this.a(chunkcoordintpair, b(b0)); } else if (j1 > bytebuffer.remaining()) { RegionFile.LOGGER.error("Chunk {} stream is truncated: expected {} but read {}", chunkcoordintpair, j1, bytebuffer.remaining()); @@ -5110,7 +5098,7 @@ index 939b518266..7f2382a895 100644 return null; } else { return this.a(chunkcoordintpair, b0, a(bytebuffer, j1)); -@@ -332,10 +772,15 @@ public class RegionFile implements AutoCloseable { +@@ -347,10 +792,15 @@ public class RegionFile implements AutoCloseable { } private ByteBuffer b() { @@ -5122,21 +5110,21 @@ index 939b518266..7f2382a895 100644 ByteBuffer bytebuffer = ByteBuffer.allocate(5); bytebuffer.putInt(1); -- bytebuffer.put((byte) (this.e.a() | 128)); -+ bytebuffer.put((byte) (compressionType.a() | 128)); // Tuinity - replace with compressionType +- bytebuffer.put((byte) (this.f.a() | 128)); ++ bytebuffer.put((byte) (compressionType.compressionTypeId() | 128)); // Tuinity - replace with compressionType ((java.nio.Buffer) bytebuffer).flip(); return bytebuffer; } -@@ -372,6 +817,7 @@ public class RegionFile implements AutoCloseable { +@@ -387,6 +837,7 @@ public class RegionFile implements AutoCloseable { }; } + private final void flushHeader() throws IOException { this.b(); } // Tuinity - OBFHELPER private void c() throws IOException { - ((java.nio.Buffer) this.f).position(0); - this.dataFile.write(this.f, 0L); + ((java.nio.Buffer) this.g).position(0); + this.dataFile.write(this.g, 0L); diff --git a/src/main/java/net/minecraft/server/RegionFileBitSet.java b/src/main/java/net/minecraft/server/RegionFileBitSet.java -index 1ebdf73cc9..cfa3ecb031 100644 +index 1ebdf73cc..cfa3ecb03 100644 --- a/src/main/java/net/minecraft/server/RegionFileBitSet.java +++ b/src/main/java/net/minecraft/server/RegionFileBitSet.java @@ -4,18 +4,42 @@ import java.util.BitSet; @@ -5184,10 +5172,10 @@ index 1ebdf73cc9..cfa3ecb031 100644 int j = 0; diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 867dc074bc..60b4171a3a 100644 +index d64f7ad92..33624f838 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -14,12 +14,43 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final +@@ -15,12 +15,43 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final public final Long2ObjectLinkedOpenHashMap cache = new Long2ObjectLinkedOpenHashMap(); private final File b; private final boolean c; @@ -5231,7 +5219,7 @@ index 867dc074bc..60b4171a3a 100644 // Paper start public synchronized RegionFile getRegionFileIfLoaded(ChunkCoordIntPair chunkcoordintpair) { // Paper - synchronize for async io -@@ -53,9 +84,9 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final +@@ -54,9 +85,9 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final this.b.mkdirs(); } @@ -5243,7 +5231,7 @@ index 867dc074bc..60b4171a3a 100644 this.cache.putAndMoveToFirst(i, regionfile1); // Paper start -@@ -144,6 +175,13 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final +@@ -145,6 +176,13 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final return null; } // CraftBukkit end @@ -5257,10 +5245,10 @@ index 867dc074bc..60b4171a3a 100644 try { // Paper DataInputStream datainputstream = regionfile.a(chunkcoordintpair); // Paper start -@@ -159,6 +197,16 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final +@@ -160,6 +198,16 @@ public class RegionFileCache implements AutoCloseable { // Paper - no final try { if (datainputstream != null) { - nbttagcompound = NBTCompressedStreamTools.a(datainputstream); + nbttagcompound = NBTCompressedStreamTools.a((DataInput) datainputstream); + // Tuinity start - recover from corrupt regionfile header + if (this.isChunkData) { + ChunkCoordIntPair chunkPos = ChunkRegionLoader.getChunkCoordinate(nbttagcompound); @@ -5270,12 +5258,12 @@ index 867dc074bc..60b4171a3a 100644 + return this.readFromRegionFile(regionfile, chunkcoordintpair); + } + } -+ // Tuinity end ++ // Tuinity end - recover from corrupt regionfile header return nbttagcompound; } diff --git a/src/main/java/net/minecraft/server/RegionFileCompression.java b/src/main/java/net/minecraft/server/RegionFileCompression.java -index 3382d678e6..29137f4959 100644 +index 3382d678e..3b7894256 100644 --- a/src/main/java/net/minecraft/server/RegionFileCompression.java +++ b/src/main/java/net/minecraft/server/RegionFileCompression.java @@ -13,7 +13,7 @@ import javax.annotation.Nullable; @@ -5298,7 +5286,15 @@ index 3382d678e6..29137f4959 100644 return (RegionFileCompression) RegionFileCompression.d.get(i); } -@@ -53,6 +53,7 @@ public class RegionFileCompression { +@@ -45,6 +45,7 @@ public class RegionFileCompression { + return RegionFileCompression.d.containsKey(i); + } + ++ public final int compressionTypeId() { return this.a(); } // Tuinity - OBFHELPER + public int a() { + return this.e; + } +@@ -53,6 +54,7 @@ public class RegionFileCompression { return (OutputStream) this.g.wrap(outputstream); } @@ -5306,8 +5302,41 @@ index 3382d678e6..29137f4959 100644 public InputStream a(InputStream inputstream) throws IOException { return (InputStream) this.f.wrap(inputstream); } +diff --git a/src/main/java/net/minecraft/server/StructureManager.java b/src/main/java/net/minecraft/server/StructureManager.java +index f199368a6..2598ae371 100644 +--- a/src/main/java/net/minecraft/server/StructureManager.java ++++ b/src/main/java/net/minecraft/server/StructureManager.java +@@ -35,8 +35,13 @@ public class StructureManager { + + // Paper start - remove structure streams + public java.util.List> getFeatureStarts(SectionPosition sectionPosition, StructureGenerator structureGenerator) { ++ // Tuinity start - add world parameter ++ return this.getFeatureStarts(sectionPosition, structureGenerator, null); ++ } ++ public java.util.List> getFeatureStarts(SectionPosition sectionPosition, StructureGenerator structureGenerator, IWorldReader world) { ++ // Tuinity end - add world parameter + java.util.List> list = new ObjectArrayList<>(); +- for (Long curLong: getLevel().getChunkAt(sectionPosition.a(), sectionPosition.c(), ChunkStatus.STRUCTURE_REFERENCES).b(structureGenerator)) { ++ for (Long curLong: (world == null ? getLevel() : world).getChunkAt(sectionPosition.a(), sectionPosition.c(), ChunkStatus.STRUCTURE_REFERENCES).b(structureGenerator)) { // Tuinity - fix deadlock on world gen - chunk can be unloaded while generating, so we should be using the generator's regionlimitedaccess so we always get the chunk + SectionPosition sectionPosition1 = SectionPosition.a(new ChunkCoordIntPair(curLong), 0); + StructureStart structurestart = a(sectionPosition1, structureGenerator, getLevel().getChunkAt(sectionPosition1.a(), sectionPosition1.c(), ChunkStatus.STRUCTURE_STARTS)); + if (structurestart != null && structurestart.e()) { +@@ -65,8 +70,12 @@ public class StructureManager { + } + + public StructureStart a(BlockPosition blockposition, boolean flag, StructureGenerator structuregenerator) { ++ // Tuinity start - add world parameter ++ return this.getStructureStarts(blockposition,flag, structuregenerator, null); ++ } ++ public StructureStart getStructureStarts(BlockPosition blockposition, boolean flag, StructureGenerator structuregenerator, IWorldReader world) { + // Paper start - remove structure streams +- for (StructureStart structurestart : getFeatureStarts(SectionPosition.a(blockposition), structuregenerator)) { ++ for (StructureStart structurestart : getFeatureStarts(SectionPosition.a(blockposition), structuregenerator, world)) { // Tuinity end - add world parameter + if (structurestart.c().b(blockposition)) { + if (!flag) { + return structurestart; diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index e41cb8613e..c19ffb925a 100644 +index e41cb8613..c19ffb925 100644 --- a/src/main/java/net/minecraft/server/Ticket.java +++ b/src/main/java/net/minecraft/server/Ticket.java @@ -5,17 +5,17 @@ import java.util.Objects; @@ -5344,7 +5373,7 @@ index e41cb8613e..c19ffb925a 100644 return j != 0L && i - this.d > j; } diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 5c789b25f1..4657b05a42 100644 +index 5c789b25f..4657b05a4 100644 --- a/src/main/java/net/minecraft/server/TicketType.java +++ b/src/main/java/net/minecraft/server/TicketType.java @@ -26,7 +26,8 @@ public class TicketType { @@ -5357,579 +5386,48 @@ index 5c789b25f1..4657b05a42 100644 public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 67fda8bd5a..e1f1d6e33f 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -12,7 +12,7 @@ import org.bukkit.inventory.InventoryHolder; - import co.aikar.timings.MinecraftTimings; // Paper - import co.aikar.timings.Timing; // Paper - --public abstract class TileEntity implements KeyedObject { // Paper -+public abstract class TileEntity implements KeyedObject, Cloneable { // Paper // Tuinity - - public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper - // CraftBukkit start - data containers -@@ -27,7 +27,7 @@ public abstract class TileEntity implements KeyedObject { // Paper - protected BlockPosition position; - protected boolean f; - @Nullable -- private IBlockData c; -+ private IBlockData c; protected final IBlockData getBlockDataCache() { return this.c; } public final void setBlockDataCache(final IBlockData value) { this.c = value; } // Tuinity - OBFHELPER - private boolean g; - - public TileEntity(TileEntityTypes tileentitytypes) { -@@ -35,6 +35,51 @@ public abstract class TileEntity implements KeyedObject { // Paper - this.tileType = tileentitytypes; - } - -+ // Tuinity start - pushable TE's -+ public boolean isPushable() { -+ if (!com.tuinity.tuinity.config.TuinityConfig.pistonsCanPushTileEntities) { -+ return false; -+ } -+ IBlockData block = this.getBlock(); -+ if (this.isRemoved() || !this.tileType.isValidBlock(block.getBlock())) { -+ return false; -+ } -+ EnumPistonReaction reaction = block.getPushReaction(); -+ return reaction == EnumPistonReaction.NORMAL || reaction == EnumPistonReaction.PUSH_ONLY; -+ } -+ -+ @Override -+ protected final TileEntity clone() { -+ try { -+ return (TileEntity)super.clone(); -+ } catch (final Throwable thr) { -+ if (thr instanceof ThreadDeath) { -+ throw (ThreadDeath)thr; -+ } -+ throw new InternalError(thr); -+ } -+ } -+ -+ // this method presumes the old TE has been completely dropped from worldstate and has no ties to it anymore (this -+ // includes players interacting with them) -+ public TileEntity createCopyForPush(WorldServer world, BlockPosition oldPos, BlockPosition newPos, IBlockData blockData) { -+ final TileEntity copy = this.clone(); -+ -+ copy.world = world; -+ copy.position = newPos; -+ -+ // removed is manually set to false after placing the entity into the world. -+ copy.setBlockDataCache(blockData); -+ -+ return copy; -+ } -+ -+ // updates TE state to its new position -+ public void onPostPush() { -+ this.update(); -+ } -+ // Tuinity end - pushable TE's -+ - // Paper start - private String tileEntityKeyString = null; - private MinecraftKey tileEntityKey = null; -diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java -index 2858ea1f3e..453f1301b4 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBeacon.java -+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java -@@ -35,7 +35,7 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic - @Nullable - public IChatBaseComponent customName; - public ChestLock chestLock; -- private final IContainerProperties containerProperties; -+ private IContainerProperties containerProperties; // Tuinity - need non-final for `createCopyForPush` - // CraftBukkit start - add fields and methods - public PotionEffect getPrimaryEffect() { - return (this.primaryEffect != null) ? CraftPotionUtil.toBukkit(new MobEffect(this.primaryEffect, getLevel(), getAmplification(), true, true)) : null; -@@ -46,10 +46,10 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic - } - // CraftBukkit end - -- public TileEntityBeacon() { -- super(TileEntityTypes.BEACON); -- this.chestLock = ChestLock.a; -- this.containerProperties = new IContainerProperties() { -+ // Tuinity start - pushable TE's -+ protected final IContainerProperties getNewContainerProperties() { -+ // moved from constructor - this should be re-copied if it changes -+ return new IContainerProperties() { - @Override - public int getProperty(int i) { - switch (i) { -@@ -90,6 +90,22 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic - }; - } - -+ @Override -+ public TileEntity createCopyForPush(WorldServer world, BlockPosition oldPos, BlockPosition newPos, IBlockData blockData) { -+ TileEntityBeacon copy = (TileEntityBeacon)super.createCopyForPush(world, oldPos, newPos, blockData); -+ -+ copy.containerProperties = copy.getNewContainerProperties(); // old properties retains reference to old te -+ -+ return copy; -+ } -+ // Tuinity end - pushable TE's -+ -+ public TileEntityBeacon() { -+ super(TileEntityTypes.BEACON); -+ this.chestLock = ChestLock.a; -+ this.containerProperties = this.getNewContainerProperties(); // Tuinity - move into function -+ } -+ - @Override - public void tick() { - int i = this.position.getX(); -diff --git a/src/main/java/net/minecraft/server/TileEntityBeehive.java b/src/main/java/net/minecraft/server/TileEntityBeehive.java -index 6dc91d985a..9da356de6b 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBeehive.java -+++ b/src/main/java/net/minecraft/server/TileEntityBeehive.java -@@ -12,6 +12,13 @@ public class TileEntityBeehive extends TileEntity implements ITickable { - public BlockPosition flowerPos = null; - public int maxBees = 3; // CraftBukkit - allow setting max amount of bees a hive can hold - -+ // Tuinity start - pushable TE's -+ @Override -+ public boolean isPushable() { -+ return false; // TODO until there is a good solution to making the already existing bees in the world re-acquire this position, this cannot be done. -+ } -+ // Tuinity end - pushable TE's -+ - public TileEntityBeehive() { - super(TileEntityTypes.BEEHIVE); - } -diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java -index 276eba954b..e38a494d7b 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java -+++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java -@@ -24,7 +24,7 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl - private boolean[] j; - private Item k; - public int fuelLevel; -- protected final IContainerProperties a; -+ protected IContainerProperties a; protected final void setContainerProperties(IContainerProperties value) { this.a = value; } // Tuinity - OBFHELPER // Tuinity - need non-final for `createCopyForPush` - // CraftBukkit start - add fields and methods - private int lastTick = MinecraftServer.currentTick; - public List transaction = new java.util.ArrayList(); -@@ -56,10 +56,10 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl - } - // CraftBukkit end - -- public TileEntityBrewingStand() { -- super(TileEntityTypes.BREWING_STAND); -- this.items = NonNullList.a(5, ItemStack.b); -- this.a = new IContainerProperties() { -+ // Tuinity start - pushable TE's -+ protected final IContainerProperties getNewContainerProperties() { -+ // moved from constructor - this should be re-copied if it changes -+ return new IContainerProperties() { - @Override - public int getProperty(int i) { - switch (i) { -@@ -91,6 +91,22 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl - }; - } - -+ @Override -+ public TileEntity createCopyForPush(WorldServer world, BlockPosition oldPos, BlockPosition newPos, IBlockData blockData) { -+ TileEntityBrewingStand copy = (TileEntityBrewingStand)super.createCopyForPush(world, oldPos, newPos, blockData); -+ -+ copy.setContainerProperties(copy.getNewContainerProperties()); // old properties retains reference to old te -+ -+ return copy; -+ } -+ // Tuinity end - pushable TE's -+ -+ public TileEntityBrewingStand() { -+ super(TileEntityTypes.BREWING_STAND); -+ this.items = NonNullList.a(5, ItemStack.b); -+ this.a = this.getNewContainerProperties(); -+ } -+ - @Override - protected IChatBaseComponent getContainerName() { - return new ChatMessage("container.brewing"); -diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index 17498eae50..0a73895999 100644 ---- a/src/main/java/net/minecraft/server/TileEntityChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityChest.java -@@ -46,6 +46,22 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic - } - // CraftBukkit end - -+ // Tuinity start -+ @Override -+ public boolean isPushable() { -+ if (!super.isPushable()) { -+ return false; -+ } -+ // what should happen when a double chest is moved is generally just a mess to deal with in the current -+ // codebase. -+ IBlockData type = this.getBlock(); -+ if (type.getBlock() == Blocks.CHEST || type.getBlock() == Blocks.TRAPPED_CHEST) { -+ return type.get(BlockChest.getChestTypeEnum()) == BlockPropertyChestType.SINGLE; -+ } -+ return false; -+ } -+ // Tuinity end -+ - protected TileEntityChest(TileEntityTypes tileentitytypes) { - super(tileentitytypes); - this.items = NonNullList.a(27, ItemStack.b); -diff --git a/src/main/java/net/minecraft/server/TileEntityConduit.java b/src/main/java/net/minecraft/server/TileEntityConduit.java -index ade8301227..7e9470caa5 100644 ---- a/src/main/java/net/minecraft/server/TileEntityConduit.java -+++ b/src/main/java/net/minecraft/server/TileEntityConduit.java -@@ -16,15 +16,32 @@ public class TileEntityConduit extends TileEntity implements ITickable { - private static final Block[] b = new Block[]{Blocks.PRISMARINE, Blocks.PRISMARINE_BRICKS, Blocks.SEA_LANTERN, Blocks.DARK_PRISMARINE}; - public int a; - private float c; -- private boolean g; -+ private boolean g; private final void setActive(boolean value) { this.g = value; } // Tuinity - OBFHELPER - private boolean h; -- private final List i; -+ private final List i; private final List getPositionsActivating() { return this.i; } // Tuinity - OBFHELPER - @Nullable - private EntityLiving target; - @Nullable - private UUID k; - private long l; - -+ // Tuinity start - make TE's pushable -+ @Override -+ public TileEntity createCopyForPush(WorldServer world, BlockPosition oldPos, BlockPosition newPos, IBlockData blockData) { -+ final TileEntityConduit copy = (TileEntityConduit)super.createCopyForPush(world, oldPos, newPos, blockData); -+ -+ // the following states need to be re-calculated -+ copy.getPositionsActivating().clear(); -+ copy.setActive(false); -+ copy.target = null; -+ // also set our state because the copy and this share the same activating block list -+ this.setActive(false); -+ this.target = null; -+ -+ return copy; -+ } -+ // Tuinity end - make TE's pushable -+ - public TileEntityConduit() { - this(TileEntityTypes.CONDUIT); - } -diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index f4f50fb837..59aa2f8a79 100644 ---- a/src/main/java/net/minecraft/server/TileEntityFurnace.java -+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -32,14 +32,14 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I - public double cookSpeedMultiplier = 1.0; // Paper - cook speed multiplier API - public int cookTime; - public int cookTimeTotal; -- protected final IContainerProperties b; -+ protected IContainerProperties b; protected final void setContainerProperties(IContainerProperties value) { this.b = value; } // Tuinity - OBFHELPER // Tuinity - need non-final for `createCopyForPush` - private final Object2IntOpenHashMap n; - protected final Recipes c; - -- protected TileEntityFurnace(TileEntityTypes tileentitytypes, Recipes recipes) { -- super(tileentitytypes); -- this.items = NonNullList.a(3, ItemStack.b); -- this.b = new IContainerProperties() { -+ // Tuinity start - pushable TE's -+ protected final IContainerProperties getNewContainerProperties() { -+ // moved from constructor - this should be re-copied if it changes -+ return new IContainerProperties() { - @Override - public int getProperty(int i) { - switch (i) { -@@ -79,7 +79,23 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I - return 4; - } - }; -+ } -+ -+ @Override -+ public TileEntity createCopyForPush(WorldServer world, BlockPosition oldPos, BlockPosition newPos, IBlockData blockData) { -+ TileEntityFurnace copy = (TileEntityFurnace)super.createCopyForPush(world, oldPos, newPos, blockData); -+ -+ copy.setContainerProperties(copy.getNewContainerProperties()); // old properties retains reference to old te -+ -+ return copy; -+ } -+ // Tuinity end - pushable TE's -+ -+ protected TileEntityFurnace(TileEntityTypes tileentitytypes, Recipes recipes) { -+ super(tileentitytypes); -+ this.items = NonNullList.a(3, ItemStack.b); - this.n = new Object2IntOpenHashMap(); -+ this.b = this.getNewContainerProperties(); - this.c = recipes; - } - -diff --git a/src/main/java/net/minecraft/server/TileEntityJukeBox.java b/src/main/java/net/minecraft/server/TileEntityJukeBox.java -index 33c7dc56da..75eb1b8b29 100644 ---- a/src/main/java/net/minecraft/server/TileEntityJukeBox.java -+++ b/src/main/java/net/minecraft/server/TileEntityJukeBox.java -@@ -4,6 +4,13 @@ public class TileEntityJukeBox extends TileEntity implements Clearable { - - private ItemStack a; - -+ // Tuinity start - pushable TE's -+ @Override -+ public boolean isPushable() { -+ return false; // disabled due to buggy sound -+ } -+ // Tuinity end - pushable TE's -+ - public TileEntityJukeBox() { - super(TileEntityTypes.JUKEBOX); - this.a = ItemStack.b; -diff --git a/src/main/java/net/minecraft/server/TileEntityLectern.java b/src/main/java/net/minecraft/server/TileEntityLectern.java -index b2ceb6c179..b955d5d661 100644 ---- a/src/main/java/net/minecraft/server/TileEntityLectern.java -+++ b/src/main/java/net/minecraft/server/TileEntityLectern.java -@@ -17,7 +17,7 @@ import org.bukkit.inventory.InventoryHolder; - public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory, ICommandListener { // CraftBukkit - ICommandListener - - // CraftBukkit start - add fields and methods -- public final IInventory inventory = new LecternInventory(); -+ public IInventory inventory = new LecternInventory(); // Tuinity - need non-final for `createCopyForPush` - public class LecternInventory implements IInventory { - - public List transaction = new ArrayList<>(); -@@ -137,29 +137,48 @@ public class TileEntityLectern extends TileEntity implements Clearable, ITileInv - @Override - public void clear() {} - }; -- private final IContainerProperties containerProperties = new IContainerProperties() { -- @Override -- public int getProperty(int i) { -- return i == 0 ? TileEntityLectern.this.page : 0; -- } -+ // Tuinity start - pushable TE's -+ private IContainerProperties containerProperties = this.getNewContainerProperties(); // Tuinity - need non-final for `createCopyForPush` -+ -+ protected final IContainerProperties getNewContainerProperties() { -+ return new IContainerProperties() { -+ @Override -+ public int getProperty(int i) { -+ return i == 0 ? TileEntityLectern.this.page : 0; -+ } -+ -+ @Override -+ public void setProperty(int i, int j) { -+ if (i == 0) { -+ TileEntityLectern.this.setPage(j); -+ } - -- @Override -- public void setProperty(int i, int j) { -- if (i == 0) { -- TileEntityLectern.this.setPage(j); - } - -- } -+ @Override -+ public int a() { -+ return 1; -+ } -+ }; -+ } -+ // Tuinity end - pushable TE's - -- @Override -- public int a() { -- return 1; -- } -- }; - private ItemStack book; - private int page; - private int maxPage; - -+ // Tuinity start - pushable TE's -+ @Override -+ public TileEntity createCopyForPush(WorldServer world, BlockPosition oldPos, BlockPosition newPos, IBlockData blockData) { -+ TileEntityLectern copy = (TileEntityLectern)super.createCopyForPush(world, oldPos, newPos, blockData); -+ -+ copy.inventory = copy.new LecternInventory(); -+ copy.containerProperties = copy.getNewContainerProperties(); // old properties retains reference to old te -+ -+ return copy; -+ } -+ // Tuinity end - pushable TE's -+ - public TileEntityLectern() { - super(TileEntityTypes.LECTERN); - this.book = ItemStack.b; -diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java -index e7b7e468fc..faf5e4aff0 100644 ---- a/src/main/java/net/minecraft/server/TileEntityPiston.java -+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java -@@ -5,10 +5,10 @@ import java.util.List; - - public class TileEntityPiston extends TileEntity implements ITickable { - -- private IBlockData a; -+ private IBlockData a; protected final IBlockData getBlockData() { return this.a; } // Tuinity - OBFHELPER - private EnumDirection b; - private boolean c; -- private boolean g; -+ private boolean g; protected final boolean isSource() { return this.g; } // Tuinity - OBFHELPER - private static final ThreadLocal h = ThreadLocal.withInitial(() -> { - return null; - }); -@@ -16,12 +16,27 @@ public class TileEntityPiston extends TileEntity implements ITickable { - private float j; - private long k; - -+ // Tuinity start - pushable TE's -+ private TileEntity tileEntity; -+ -+ @Override -+ public boolean isPushable() { -+ return false; // fuck no. -+ } -+ // Tuinity end - pushable TE's -+ - public TileEntityPiston() { - super(TileEntityTypes.PISTON); - } - - public TileEntityPiston(IBlockData iblockdata, EnumDirection enumdirection, boolean flag, boolean flag1) { -+ // Tuinity start - add tileEntity parameter -+ this(iblockdata, enumdirection, flag, flag1, null); -+ } -+ public TileEntityPiston(IBlockData iblockdata, EnumDirection enumdirection, boolean flag, boolean flag1, TileEntity tileEntity) { - this(); -+ this.tileEntity = tileEntity; -+ // Tuinity end - add tileEntity parameter - this.a = iblockdata; - this.b = enumdirection; - this.c = flag; -@@ -30,7 +45,7 @@ public class TileEntityPiston extends TileEntity implements ITickable { - - @Override - public NBTTagCompound b() { -- return this.save(new NBTTagCompound()); -+ return this.save(new NBTTagCompound(), false); // Tuinity - clients don't need the copied tile entity. - } - - public boolean d() { -@@ -238,7 +253,27 @@ public class TileEntityPiston extends TileEntity implements ITickable { - iblockdata = Block.b(this.a, (GeneratorAccess) this.world, this.position); - } - -- this.world.setTypeAndData(this.position, iblockdata, 3); -+ // Tuinity start - pushable TE's -+ if ((iblockdata.isAir() && !this.isSource()) && !this.getBlockData().isAir()) { -+ // if the block can't exist at the location anymore, we need to fire drops for it, as -+ // setTypeAndData wont. -+ -+ // careful - the previous pos is moving_piston, which wont fire drops. So we're safe from dupes. -+ // but the setAir should be before the drop. -+ this.world.setAir(this.position, false); -+ Block.dropItems(this.getBlockData(), this.world, this.position, null, null, ItemStack.NULL_ITEM); -+ } else { -+ if (iblockdata.getBlock() == this.getBlockData().getBlock() && this.tileEntity != null) { -+ // need to set to air before else the setTypeAndData call will create a new TE and override -+ // the old one -+ this.world.setAir(this.position, false); -+ } -+ this.world.setTypeAndData(this.position, iblockdata, 3, iblockdata.getBlock() == this.getBlockData().getBlock() ? this.tileEntity : null); -+ } -+ if (this.tileEntity != null && this.world.getType(this.position).getBlock() == this.getBlockData().getBlock()) { -+ this.tileEntity.onPostPush(); -+ } -+ // Tuinity end - pushable TE's - this.world.a(this.position, iblockdata.getBlock(), this.position); - } - } -@@ -263,7 +298,12 @@ public class TileEntityPiston extends TileEntity implements ITickable { - iblockdata = (IBlockData) iblockdata.set(BlockProperties.C, false); - } - -- this.world.setTypeAndData(this.position, iblockdata, 67); -+ // Tuinity start - pushable TE's -+ this.world.setTypeAndData(this.position, iblockdata, 67, this.tileEntity); -+ if (this.tileEntity != null && this.world.getType(this.position).getBlock() == this.getBlockData().getBlock()) { -+ this.tileEntity.onPostPush(); -+ } -+ // Tuinity end - pushable TE's - this.world.a(this.position, iblockdata.getBlock(), this.position); - } - } -@@ -290,16 +330,34 @@ public class TileEntityPiston extends TileEntity implements ITickable { - this.j = this.i; - this.c = nbttagcompound.getBoolean("extending"); - this.g = nbttagcompound.getBoolean("source"); -+ // Tuinity start - pushable TE's -+ if (nbttagcompound.hasKey("Tuinity.tileEntity")) { -+ NBTTagCompound compound = nbttagcompound.getCompound("Tuinity.tileEntity"); -+ if (!compound.isEmpty()) { -+ this.tileEntity = TileEntity.create(this.getBlockData(), compound); -+ } -+ } -+ // Tuinity end - pushable TE's - } - - @Override - public NBTTagCompound save(NBTTagCompound nbttagcompound) { -+ // Tuinity start - add saveTile param -+ return this.save(nbttagcompound, true); -+ } -+ public NBTTagCompound save(NBTTagCompound nbttagcompound, boolean saveTile) { -+ // Tuinity end - add saveTile param - super.save(nbttagcompound); - nbttagcompound.set("blockState", GameProfileSerializer.a(this.a)); - nbttagcompound.setInt("facing", this.b.c()); - nbttagcompound.setFloat("progress", this.j); - nbttagcompound.setBoolean("extending", this.c); - nbttagcompound.setBoolean("source", this.g); -+ // Tuinity start - pushable TE's -+ if (saveTile && this.tileEntity != null) { -+ nbttagcompound.set("Tuinity.tileEntity", this.tileEntity.save(new NBTTagCompound())); -+ } -+ // Tuinity end - pushable TE's - return nbttagcompound; - } - diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index a038397028..2cdc6cf8ce 100644 +index 2484293b1..1496c43fc 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -51,6 +51,10 @@ public class UserCache { - private final File h; - private static final TypeToken> i = new TypeToken>() { - }; +@@ -49,6 +49,11 @@ public class UserCache { + private final File g; + private final AtomicLong h = new AtomicLong(); + + // Tuinity start + protected final java.util.concurrent.locks.ReentrantLock stateLock = new java.util.concurrent.locks.ReentrantLock(); + protected final java.util.concurrent.locks.ReentrantLock lookupLock = new java.util.concurrent.locks.ReentrantLock(); + // Tuinity end - ++ public UserCache(GameProfileRepository gameprofilerepository, File file) { - this.g = gameprofilerepository; -@@ -98,7 +102,7 @@ public class UserCache { - this.a(gameprofile, (Date) null); + this.e = gameprofilerepository; + this.g = file; +@@ -56,6 +61,7 @@ public class UserCache { } -- private synchronized void a(GameProfile gameprofile, Date date) { // Paper - synchronize -+ private void a(GameProfile gameprofile, Date date) { // Paper - synchronize // Tuinity - allow better concurrency - UUID uuid = gameprofile.getId(); - - if (date == null) { -@@ -111,6 +115,7 @@ public class UserCache { - - UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date); - + private void a(UserCache.UserCacheEntry usercache_usercacheentry) { + try { this.stateLock.lock(); // Tuinity - allow better concurrency - //if (this.e.containsKey(uuid)) { // Paper - UserCache.UserCacheEntry usercache_usercacheentry1 = (UserCache.UserCacheEntry) this.e.get(uuid); - if (usercache_usercacheentry1 != null) { // Paper -@@ -122,12 +127,14 @@ public class UserCache { - this.d.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercache_usercacheentry); - this.e.put(uuid, usercache_usercacheentry); - this.f.addFirst(gameprofile); + GameProfile gameprofile = usercache_usercacheentry.a(); + + usercache_usercacheentry.a(this.d()); +@@ -70,6 +76,7 @@ public class UserCache { + if (uuid != null) { + this.d.put(uuid, usercache_usercacheentry); + } + } finally { this.stateLock.unlock(); } // Tuinity - allow better concurrency - if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled + + } + +@@ -107,7 +114,7 @@ public class UserCache { + } + + public void saveProfile(GameProfile gameprofile) { a(gameprofile); } // Paper - OBFHELPER +- public synchronized void a(GameProfile gameprofile) { // Paper - synchronize ++ public void a(GameProfile gameprofile) { // Paper - synchronize // Tuinity - allow better concurrency + Calendar calendar = Calendar.getInstance(); + + calendar.setTime(new Date()); +@@ -124,8 +131,9 @@ public class UserCache { } @Nullable @@ -5937,48 +5435,44 @@ index a038397028..2cdc6cf8ce 100644 + public GameProfile getProfile(String s) { // Paper - synchronize // Tuinity start - allow better concurrency String s1 = s.toLowerCase(Locale.ROOT); + boolean stateLocked = true; try { this.stateLock.lock(); // Tuinity - allow better concurrency - UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1); + UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.c.get(s1); + boolean flag = false; - if (usercache_usercacheentry != null && (new Date()).getTime() >= usercache_usercacheentry.c.getTime()) { -@@ -143,8 +150,12 @@ public class UserCache { - gameprofile = usercache_usercacheentry.a(); - this.f.remove(gameprofile); - this.f.addFirst(gameprofile); +@@ -139,10 +147,14 @@ public class UserCache { + GameProfile gameprofile; + + if (usercache_usercacheentry != null) { + stateLocked = false; this.stateLock.unlock(); // Tuinity - allow better concurrency + usercache_usercacheentry.a(this.d()); + gameprofile = usercache_usercacheentry.a(); } else { + stateLocked = false; this.stateLock.unlock(); // Tuinity - allow better concurrency + try { this.lookupLock.lock(); // Tuinity - allow better concurrency - gameprofile = a(this.g, s); // Spigot - use correct case for offline players + gameprofile = a(this.e, s); // Spigot - use correct case for offline players + } finally { this.lookupLock.unlock(); } // Tuinity - allow better concurrency if (gameprofile != null) { this.a(gameprofile); - usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1); -@@ -153,6 +164,7 @@ public class UserCache { + flag = false; +@@ -154,6 +166,7 @@ public class UserCache { + } - if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled - return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); + return gameprofile; + } finally { if (stateLocked) { this.stateLock.unlock(); } } // Tuinity - allow better concurrency } // Paper start -@@ -252,6 +264,7 @@ public class UserCache { +@@ -287,7 +300,9 @@ public class UserCache { } - private List a(int i) { + private Stream a(int i) { + try { this.stateLock.lock(); // Tuinity - allow better concurrency - List list = Lists.newArrayList(); - List list1 = Lists.newArrayList(Iterators.limit(this.f.iterator(), i)); - Iterator iterator = list1.iterator(); -@@ -266,6 +279,7 @@ public class UserCache { - } - - return list; + return ImmutableList.copyOf(this.d.values()).stream().sorted(Comparator.comparing(UserCache.UserCacheEntry::c).reversed()).limit((long) i); + } finally { this.stateLock.unlock(); } // Tuinity - allow better concurrency } - class UserCacheEntry { + private static JsonElement a(UserCache.UserCacheEntry usercache_usercacheentry, DateFormat dateformat) { diff --git a/src/main/java/net/minecraft/server/Vec3D.java b/src/main/java/net/minecraft/server/Vec3D.java -index 3048ba0081..84858ba392 100644 +index 3048ba008..84858ba39 100644 --- a/src/main/java/net/minecraft/server/Vec3D.java +++ b/src/main/java/net/minecraft/server/Vec3D.java @@ -4,7 +4,7 @@ import java.util.EnumSet; @@ -6012,10 +5506,10 @@ index 3048ba0081..84858ba392 100644 return this.x * this.x + this.y * this.y + this.z * this.z; } diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index 303f6b0953..c1e149f204 100644 +index b926cebd0..adacfce6f 100644 --- a/src/main/java/net/minecraft/server/VillagePlace.java +++ b/src/main/java/net/minecraft/server/VillagePlace.java -@@ -155,7 +155,7 @@ public class VillagePlace extends RegionFileSection { +@@ -165,7 +165,7 @@ public class VillagePlace extends RegionFileSection { data = this.getData(chunkcoordintpair); } com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, @@ -6025,7 +5519,7 @@ index 303f6b0953..c1e149f204 100644 } // Paper end diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java -index c2b8c98206..3a98e242e0 100644 +index eb926b74e..700660dd9 100644 --- a/src/main/java/net/minecraft/server/VoxelShape.java +++ b/src/main/java/net/minecraft/server/VoxelShape.java @@ -8,11 +8,11 @@ import javax.annotation.Nullable; @@ -6042,8 +5536,12 @@ index c2b8c98206..3a98e242e0 100644 this.a = voxelshapediscrete; } -@@ -51,6 +51,12 @@ public abstract class VoxelShape { - return (VoxelShape) (this.isEmpty() ? VoxelShapes.a() : new VoxelShapeArray(this.a, new DoubleListOffset(this.a(EnumDirection.EnumAxis.X), d0), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Y), d1), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Z), d2))); +@@ -48,9 +48,15 @@ public abstract class VoxelShape { + + public final VoxelShape offset(double x, double y, double z) { return this.a(x, y, z); } // Paper - OBFHELPER + public VoxelShape a(double d0, double d1, double d2) { +- return (VoxelShape) (this.isEmpty() ? VoxelShapes.a() : new VoxelShapeArray(this.a, new DoubleListOffset(this.a(EnumDirection.EnumAxis.X), d0), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Y), d1), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Z), d2))); ++ return (VoxelShape) (this.isEmpty() ? VoxelShapes.a() : new VoxelShapeArray(this.a, new DoubleListOffset(this.a(EnumDirection.EnumAxis.X), d0), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Y), d1), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Z), d2))); // Tuinity - diff on change, copied into VoxelShapeArray override } + // Tuinity start - optimise multi-aabb shapes @@ -6064,7 +5562,7 @@ index c2b8c98206..3a98e242e0 100644 List list = Lists.newArrayList(); diff --git a/src/main/java/net/minecraft/server/VoxelShapeArray.java b/src/main/java/net/minecraft/server/VoxelShapeArray.java -index caf297fe97..8d68c783f6 100644 +index 3c29cb145..43b0b4c34 100644 --- a/src/main/java/net/minecraft/server/VoxelShapeArray.java +++ b/src/main/java/net/minecraft/server/VoxelShapeArray.java @@ -3,6 +3,7 @@ package net.minecraft.server; @@ -6103,7 +5601,7 @@ index caf297fe97..8d68c783f6 100644 int j = voxelshapediscrete.c() + 1; @@ -27,6 +42,18 @@ public final class VoxelShapeArray extends VoxelShape { } else { - throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException("Lengths of point arrays must be consistent with the size of the VoxelShape.")); + throw (IllegalArgumentException) SystemUtils.c((Throwable) (new IllegalArgumentException("Lengths of point arrays must be consistent with the size of the VoxelShape."))); } + // Tuinity start - optimise multi-aabb shapes + this.boundingBoxesRepresentation = boundingBoxesRepresentation == null ? this.getBoundingBoxesRepresentation().toArray(EMPTY) : boundingBoxesRepresentation; // Tuinity - optimise multi-aabb shapes @@ -6171,7 +5669,7 @@ index caf297fe97..8d68c783f6 100644 + // Tuinity end - optimise multi-aabb shapes } diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index 1fa7061f7a..52aee91d2d 100644 +index e21c747b6..6667e699c 100644 --- a/src/main/java/net/minecraft/server/VoxelShapes.java +++ b/src/main/java/net/minecraft/server/VoxelShapes.java @@ -17,18 +17,81 @@ public final class VoxelShapes { @@ -6287,7 +5785,7 @@ index 1fa7061f7a..52aee91d2d 100644 + public static boolean abstract_c(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) { + // Tuinity end - optimise voxelshape if (operatorboolean.apply(false, false)) { - throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException()); + throw (IllegalArgumentException) SystemUtils.c((Throwable) (new IllegalArgumentException())); } else if (voxelshape == voxelshape1) { @@ -314,6 +391,7 @@ public final class VoxelShapes { } @@ -6298,9 +5796,20 @@ index 1fa7061f7a..52aee91d2d 100644 return voxelshape != b() && voxelshape1 != b() ? (voxelshape.isEmpty() && voxelshape1.isEmpty() ? false : !c(b(), b(voxelshape, voxelshape1, OperatorBoolean.OR), OperatorBoolean.ONLY_FIRST)) : true; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a173d2562e..8c47db51a0 100644 +index 287db5203..4834f7569 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java +@@ -74,8 +74,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + public boolean captureBlockStates = false; + public boolean captureTreeGeneration = false; +- public Map capturedBlockStates = new HashMap<>(); // Paper +- public Map capturedTileEntities = new HashMap<>(); ++ public Map capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper // Tuinity ++ public Map capturedTileEntities = new java.util.LinkedHashMap<>(); // Tuinity + public List captureDrops; + public long ticksPerAnimalSpawns; + public long ticksPerMonsterSpawns; @@ -94,6 +94,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper public final ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray @@ -6310,67 +5819,23 @@ index a173d2562e..8c47db51a0 100644 public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPosition lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; -@@ -121,6 +123,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -125,6 +127,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper - this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Tuinity - Server Config this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit -@@ -397,13 +400,41 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - } - } - -+ // Tuinity start -+ // Does not affect TE. This simply just a raw set type - runs no logic. -+ final void setTypeAndDataRaw(final BlockPosition pos, final IBlockData blockData, final TileEntity tileEntity) { -+ Chunk chunk = this.getChunkAt(pos.getX() >> 4, pos.getZ() >> 4); -+ IBlockData old = chunk.getType(pos); -+ chunk.setTypeAndDataRaw(pos, blockData); -+ if (tileEntity == null) { -+ this.removeTileEntity(pos); -+ } else { -+ this.setTileEntity(pos, tileEntity); -+ } -+ ((WorldServer)this).getChunkProvider().flagDirty(pos); -+ this.notifyPoiChange(pos, old, blockData); -+ } -+ // Tuinity end -+ - @Override - public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { -- return this.a(blockposition, iblockdata, i, 512); -+ // Tuinity start - add tileEntity parameter -+ return this.setTypeAndData(blockposition, iblockdata, i, null); -+ } -+ // Up to the caller to handle previous tile state. -+ public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i, TileEntity tileEntity) { -+ return this.setTypeAndData(blockposition, iblockdata, i, 512, tileEntity); -+ // Tuinity end - add tileEntity parameter - } +@@ -369,6 +372,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @Override public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { -+ // Tuinity start - add tileEntity parameter -+ return this.setTypeAndData(blockposition, iblockdata, i, j, null); -+ } -+ public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i, int j, TileEntity tileEntity) { -+ // Tuinity end - add tileEntity parameter + com.tuinity.tuinity.util.TickThread.softEnsureTickThread("Async set type call"); // Tuinity // CraftBukkit start - tree generation if (this.captureTreeGeneration) { // Paper start -@@ -436,7 +467,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - } - // CraftBukkit end - -- IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag -+ IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0, tileEntity); // CraftBukkit custom NO_PLACE flag // Tuinity - add tileEntity parameter - this.chunkPacketBlockController.onBlockChange(this, blockposition, iblockdata, iblockdata1, i); // Paper - Anti-Xray - - if (iblockdata1 == null) { -@@ -504,6 +535,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -469,6 +473,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start - Split off from above in order to directly send client and physic updates public void notifyAndUpdatePhysics(BlockPosition blockposition, Chunk chunk, IBlockData oldBlock, IBlockData newBlock, IBlockData actualBlock, int i, int j) { @@ -6378,15 +5843,7 @@ index a173d2562e..8c47db51a0 100644 IBlockData iblockdata = newBlock; IBlockData iblockdata1 = oldBlock; IBlockData iblockdata2 = actualBlock; -@@ -552,6 +584,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - } - // CraftBukkit end - -+ public final void notifyPoiChange(BlockPosition blockposition, IBlockData old, IBlockData neww) { this.a(blockposition, old, neww); } // Tuinity - OBFHELPER - public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} - - public boolean setAir(BlockPosition blockposition) { return this.a(blockposition, false); } // Paper - OBFHELPER -@@ -936,6 +969,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -901,6 +906,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return; // Paper end } @@ -6394,29 +5851,39 @@ index a173d2562e..8c47db51a0 100644 } // Paper start - Prevent armor stands from doing entity lookups @Override -@@ -1031,7 +1065,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - while (iterator.hasNext()) { - TileEntity tileentity1 = (TileEntity) iterator.next(); +@@ -1080,10 +1086,44 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return this.getChunkAt(i, j, ChunkStatus.FULL, false); + } -- if (tileentity1.getPosition().equals(blockposition)) { -+ if (tileentity != tileentity1 && tileentity1.getPosition().equals(blockposition)) { // Tuinity - don't remove us if we double set... - tileentity1.an_(); - iterator.remove(); - } -@@ -1120,6 +1154,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { - // copied from below - List list = Lists.newArrayList(); -+ // Tuinity start - add list parameter -+ return this.getHardCollidingEntities(entity, axisalignedbb, predicate, list); ++ // Tuinity start - optimise hard collision handling ++ @Override ++ public List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { ++ return this.getHardCollidingEntities(entity, axisalignedbb, predicate, Lists.newArrayList()); + } ++ + public List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate, List list) { -+ // Tuinity end - add list parameter - int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); - int j = MathHelper.floor((axisalignedbb.maxX + 2.0D) / 16.0D); - int k = MathHelper.floor((axisalignedbb.minZ - 2.0D) / 16.0D); -@@ -1143,8 +1182,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - ++ // copied from below ++ int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); ++ int j = MathHelper.floor((axisalignedbb.maxX + 2.0D) / 16.0D); ++ int k = MathHelper.floor((axisalignedbb.minZ - 2.0D) / 16.0D); ++ int l = MathHelper.floor((axisalignedbb.maxZ + 2.0D) / 16.0D); ++ ++ ChunkProviderServer chunkProvider = ((WorldServer)this).getChunkProvider(); ++ ++ for (int i1 = i; i1 <= j; ++i1) { ++ for (int j1 = k; j1 <= l; ++j1) { ++ Chunk chunk = chunkProvider.getChunkAtIfLoadedMainThread(i1, j1); ++ ++ if (chunk != null) { ++ chunk.getHardCollidingEntities(entity, axisalignedbb, list, predicate); ++ } ++ } ++ } ++ ++ return list; ++ } ++ // Tuinity end - optimise hard collision handling ++ @Override public List getEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, @Nullable Predicate predicate) { - this.getMethodProfiler().c("getEntities"); @@ -6431,7 +5898,7 @@ index a173d2562e..8c47db51a0 100644 int j = MathHelper.floor((axisalignedbb.maxX + 2.0D) / 16.0D); int k = MathHelper.floor((axisalignedbb.minZ - 2.0D) / 16.0D); diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index b651eb87bb..5cba3b0e61 100644 +index f01186988..f52132604 100644 --- a/src/main/java/net/minecraft/server/WorldBorder.java +++ b/src/main/java/net/minecraft/server/WorldBorder.java @@ -47,11 +47,43 @@ public class WorldBorder { @@ -6472,8 +5939,7 @@ index b651eb87bb..5cba3b0e61 100644 public double a(Entity entity) { return this.b(entity.locX(), entity.locZ()); } -- -+ + public final VoxelShape asVoxelShape(){ return c();} // Paper - OBFHELPER + public final VoxelShape getCollisionShape() { return this.c(); } // Tuinity - OBFHELPER public VoxelShape c() { @@ -6503,10 +5969,16 @@ index b651eb87bb..5cba3b0e61 100644 return this.j.d(); } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 63c1190729..2bee2dab9f 100644 +index a21ce4855..abc6b6548 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -55,7 +55,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -51,12 +51,13 @@ import org.bukkit.event.server.MapInitializeEvent; + import org.bukkit.event.weather.LightningStrikeEvent; + import org.bukkit.event.world.TimeSkipEvent; + // CraftBukkit end ++import it.unimi.dsi.fastutil.ints.IntArrayList; // Tuinity + + public class WorldServer extends World implements GeneratorAccessSeed { public static final BlockPosition a = new BlockPosition(100, 50, 0); private static final Logger LOGGER = LogManager.getLogger(); @@ -6515,7 +5987,7 @@ index 63c1190729..2bee2dab9f 100644 private final Map entitiesByUUID = Maps.newHashMap(); private final Queue entitiesToAdd = Queues.newArrayDeque(); public final List players = Lists.newArrayList(); // Paper - private -> public -@@ -79,7 +79,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -80,7 +81,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { private final PortalTravelAgent portalTravelAgent; private final TickListServer nextTickListBlock; private final TickListServer nextTickListFluid; @@ -6524,7 +5996,7 @@ index 63c1190729..2bee2dab9f 100644 protected final PersistentRaid persistentRaid; private final ObjectLinkedOpenHashSet L; private boolean ticking; -@@ -200,6 +200,100 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -201,6 +202,100 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Paper end - rewrite ticklistserver @@ -6567,7 +6039,7 @@ index 63c1190729..2bee2dab9f 100644 + return; + } + List ret = new java.util.ArrayList<>(); -+ it.unimi.dsi.fastutil.ints.IntArrayList ticketLevels = new it.unimi.dsi.fastutil.ints.IntArrayList(); ++ IntArrayList ticketLevels = new IntArrayList(); + + int minBlockX = MathHelper.floor(axisalignedbb.minX - 1.0E-7D) - 3; + int maxBlockX = MathHelper.floor(axisalignedbb.maxX + 1.0E-7D) + 3; @@ -6623,9 +6095,9 @@ index 63c1190729..2bee2dab9f 100644 + // Tuinity end - execute chunk tasks mid tick + // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor -@@ -260,6 +354,349 @@ public class WorldServer extends World implements GeneratorAccessSeed { + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor +@@ -261,6 +356,328 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper } @@ -6754,34 +6226,27 @@ index 63c1190729..2bee2dab9f 100644 + if (axisalignedbb.isEmpty()) { + return false; + } -+ AxisAlignedBB axisalignedbb1 = axisalignedbb.grow(1.0E-7D, 1.0E-7D, 1.0E-7D); -+ List entities = (entity != null && entity.hardCollides()) ? this.getEntities(entity, axisalignedbb, predicate == null ? IEntitySelector.notSpectator() : predicate.and(IEntitySelector.notSpectator())) : this.getHardCollidingEntities(entity, axisalignedbb1, predicate); -+ -+ for (int i = 0, len = entities.size(); i < len; ++i) { -+ Entity otherEntity = entities.get(i); -+ -+ if (predicate != null && !predicate.test(otherEntity)) { -+ continue; ++ axisalignedbb = axisalignedbb.grow(1.0E-7D, 1.0E-7D, 1.0E-7D); ++ List entities = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList(); ++ try { ++ if (entity != null && entity.hardCollides()) { ++ this.getEntities(entity, axisalignedbb, predicate, entities); ++ } else { ++ this.getHardCollidingEntities(entity, axisalignedbb, predicate, entities); + } + -+ if (entity != null) { -+ if (entity.isSameVehicle(otherEntity)) { -+ continue; -+ } -+ AxisAlignedBB hardCollisionBox = entity.getHardCollisionBoxWith(otherEntity); -+ if (hardCollisionBox != null && axisalignedbb1.intersects(hardCollisionBox)) { ++ for (int i = 0, len = entities.size(); i < len; ++i) { ++ Entity otherEntity = entities.get(i); ++ ++ if ((entity == null || otherEntity.collisionBoxIsHard()) || entity.hardCollidesWith(otherEntity)) { + return true; + } + } + -+ AxisAlignedBB hardCollisionBox = otherEntity.getHardCollisionBox(); -+ -+ if (hardCollisionBox != null && axisalignedbb1.intersects(hardCollisionBox)) { -+ return true; -+ } ++ return false; ++ } finally { ++ com.tuinity.tuinity.util.CachedLists.returnTempGetEntitiesList(entities); + } -+ -+ return false; + } + + public final boolean hasAnyCollisions(@Nullable Entity entity, AxisAlignedBB axisalignedbb) { @@ -6914,36 +6379,20 @@ index 63c1190729..2bee2dab9f 100644 + if (axisalignedbb.isEmpty()) { + return; + } -+ AxisAlignedBB axisalignedbb1 = axisalignedbb.grow(1.0E-7D, 1.0E-7D, 1.0E-7D); ++ axisalignedbb = axisalignedbb.grow(1.0E-7D, 1.0E-7D, 1.0E-7D); + List entities = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList(); + try { + if (entity != null && entity.hardCollides()) { -+ this.getEntities(entity, axisalignedbb, predicate == null ? IEntitySelector.notSpectator() : predicate.and(IEntitySelector.notSpectator()), entities); ++ this.getEntities(entity, axisalignedbb, predicate, entities); + } else { -+ this.getHardCollidingEntities(entity, axisalignedbb1, predicate, entities); ++ this.getHardCollidingEntities(entity, axisalignedbb, predicate, entities); + } + + for (int i = 0, len = entities.size(); i < len; ++i) { + Entity otherEntity = entities.get(i); + -+ if (predicate != null && !predicate.test(otherEntity)) { -+ continue; -+ } -+ -+ if (entity != null) { -+ if (entity.isSameVehicle(otherEntity)) { -+ continue; -+ } -+ AxisAlignedBB hardCollisionBox = entity.getHardCollisionBoxWith(otherEntity); -+ if (hardCollisionBox != null && axisalignedbb1.intersects(hardCollisionBox)) { -+ list.add(hardCollisionBox); -+ } -+ } -+ -+ AxisAlignedBB hardCollisionBox = otherEntity.getHardCollisionBox(); -+ -+ if (hardCollisionBox != null && axisalignedbb1.intersects(hardCollisionBox)) { -+ list.add(hardCollisionBox); ++ if ((entity == null || otherEntity.collisionBoxIsHard()) || entity.hardCollidesWith(otherEntity)) { ++ list.add(otherEntity.getBoundingBox()); + } + } + } finally { @@ -6963,11 +6412,13 @@ index 63c1190729..2bee2dab9f 100644 + + @Override + public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisalignedbb) { ++ if (entity instanceof EntityArmorStand && !entity.world.paperConfig.armorStandEntityLookups) return false; + return !this.hasAnyCollisions(entity, axisalignedbb); + } + + @Override + public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { ++ if (entity instanceof EntityArmorStand && !entity.world.paperConfig.armorStandEntityLookups) return false; + return !this.collidesWithAnyBlockOrWorldBorder(entity, axisalignedbb, true) && !this.hardCollidesWithAnyEntities(entity, axisalignedbb, predicate); + } + // Tuinity end - optimise collision @@ -6975,7 +6426,7 @@ index 63c1190729..2bee2dab9f 100644 // CraftBukkit start @Override protected TileEntity getTileEntity(BlockPosition pos, boolean validate) { -@@ -462,7 +899,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -463,7 +880,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } timings.scheduledBlocks.stopTiming(); // Paper @@ -6984,16 +6435,16 @@ index 63c1190729..2bee2dab9f 100644 gameprofilerfiller.exitEnter("raid"); this.timings.raids.startTiming(); // Paper - timings this.persistentRaid.a(); -@@ -471,7 +908,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -472,7 +889,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { timings.doSounds.startTiming(); // Spigot - this.ah(); + this.aj(); timings.doSounds.stopTiming(); // Spigot - this.getMinecraftServer().midTickLoadChunks(); // Paper + // Tuinity - replace logic this.ticking = false; gameprofilerfiller.exitEnter("entities"); boolean flag3 = true || !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players -@@ -487,13 +924,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -488,13 +905,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { } this.tickingEntities = true; @@ -7009,7 +6460,7 @@ index 63c1190729..2bee2dab9f 100644 Entity entity1 = entity.getVehicle(); /* CraftBukkit start - We prevent spawning in general, so this butchering is not needed -@@ -509,6 +945,13 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -510,6 +926,13 @@ public class WorldServer extends World implements GeneratorAccessSeed { gameprofilerfiller.enter("checkDespawn"); if (!entity.dead) { entity.checkDespawn(); @@ -7023,7 +6474,7 @@ index 63c1190729..2bee2dab9f 100644 } gameprofilerfiller.exit(); -@@ -529,14 +972,20 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -530,14 +953,20 @@ public class WorldServer extends World implements GeneratorAccessSeed { gameprofilerfiller.enter("remove"); if (entity.dead) { this.removeEntityFromChunk(entity); @@ -7045,7 +6496,7 @@ index 63c1190729..2bee2dab9f 100644 this.tickingEntities = false; // Paper start for (java.lang.Runnable run : this.afterEntityTickingTasks) { -@@ -548,7 +997,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -549,7 +978,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } this.afterEntityTickingTasks.clear(); // Paper end @@ -7054,7 +6505,7 @@ index 63c1190729..2bee2dab9f 100644 Entity entity2; -@@ -558,7 +1007,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -559,7 +988,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } timings.tickEntities.stopTiming(); // Spigot @@ -7063,7 +6514,7 @@ index 63c1190729..2bee2dab9f 100644 this.tickBlockEntities(); } -@@ -804,7 +1253,26 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -805,7 +1234,26 @@ public class WorldServer extends World implements GeneratorAccessSeed { } @@ -7090,7 +6541,7 @@ index 63c1190729..2bee2dab9f 100644 if (!(entity instanceof EntityHuman) && !this.getChunkProvider().a(entity)) { this.chunkCheck(entity); } else { -@@ -850,6 +1318,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -851,6 +1299,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Paper - timings } @@ -7102,7 +6553,7 @@ index 63c1190729..2bee2dab9f 100644 } public void a(Entity entity, Entity entity1) { -@@ -893,6 +1366,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -894,6 +1347,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { int i = MathHelper.floor(entity.locX() / 16.0D); int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior int k = MathHelper.floor(entity.locZ() / 16.0D); @@ -7115,7 +6566,7 @@ index 63c1190729..2bee2dab9f 100644 if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) { // Paper start - remove entity if its in a chunk more correctly. -@@ -902,6 +1381,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -903,6 +1362,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Paper end @@ -7128,7 +6579,7 @@ index 63c1190729..2bee2dab9f 100644 if (entity.inChunk && this.isChunkLoaded(entity.chunkX, entity.chunkZ)) { this.getChunkAt(entity.chunkX, entity.chunkZ).a(entity, entity.chunkY); } -@@ -915,6 +1400,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -916,6 +1381,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { } else { this.getChunkAt(i, k).a(entity); } @@ -7140,16 +6591,16 @@ index 63c1190729..2bee2dab9f 100644 } this.getMethodProfiler().exit(); -@@ -1226,7 +1716,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1263,7 +1733,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { Entity entity = (Entity) iterator.next(); if (!(entity instanceof EntityPlayer)) { - if (this.tickingEntities) { + if (false && this.tickingEntities) { // Tuinity - throw (IllegalStateException) SystemUtils.c(new IllegalStateException("Removing entity while ticking!")); + throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException("Removing entity while ticking!"))); } -@@ -1254,6 +1744,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1291,6 +1761,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { public void unregisterEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot @@ -7157,7 +6608,7 @@ index 63c1190729..2bee2dab9f 100644 // Paper start - fix entity registration issues if (entity instanceof EntityComplexPart) { // Usually this is a no-op for complex parts, and ID's should be removed, but go ahead and remove it anyways -@@ -1320,17 +1811,108 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1357,17 +1828,108 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.getScoreboard().a(entity); // CraftBukkit start - SPIGOT-5278 if (entity instanceof EntityDrowned) { @@ -7269,7 +6720,7 @@ index 63c1190729..2bee2dab9f 100644 private void registerEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot // Paper start - don't double enqueue entity registration -@@ -1341,7 +1923,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1378,7 +1940,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { return; } // Paper end @@ -7278,15 +6729,15 @@ index 63c1190729..2bee2dab9f 100644 if (!entity.isQueuedForRegister) { // Paper this.entitiesToAdd.add(entity); entity.isQueuedForRegister = true; // Paper -@@ -1349,6 +1931,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1386,6 +1948,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } else { entity.isQueuedForRegister = false; // Paper this.entitiesById.put(entity.getId(), entity); + this.entitiesForIteration.add(entity); // Tuinity if (entity instanceof EntityEnderDragon) { - EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity).eK(); + EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity).eJ(); int i = aentitycomplexpart.length; -@@ -1357,6 +1940,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1394,6 +1957,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { EntityComplexPart entitycomplexpart = aentitycomplexpart[j]; this.entitiesById.put(entitycomplexpart.getId(), entitycomplexpart); @@ -7294,7 +6745,7 @@ index 63c1190729..2bee2dab9f 100644 } } -@@ -1381,12 +1965,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1418,12 +1982,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { // this.getChunkProvider().addEntity(entity); // Paper - moved down below valid=true // CraftBukkit start - SPIGOT-5278 if (entity instanceof EntityDrowned) { @@ -7314,16 +6765,16 @@ index 63c1190729..2bee2dab9f 100644 } entity.valid = true; // CraftBukkit this.getChunkProvider().addEntity(entity); // Paper - from above to be below valid=true -@@ -1402,7 +1990,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1439,7 +2007,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } public void removeEntity(Entity entity) { - if (this.tickingEntities) { -+ if (false && this.tickingEntities) { // Tuinity - throw (IllegalStateException) SystemUtils.c(new IllegalStateException("Removing entity while ticking!")); ++ if (false && this.tickingEntities) { // Tuinity + throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException("Removing entity while ticking!"))); } else { this.removeEntityFromChunk(entity); -@@ -1503,8 +2091,26 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1540,8 +2108,26 @@ public class WorldServer extends World implements GeneratorAccessSeed { VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition); if (VoxelShapes.c(voxelshape, voxelshape1, OperatorBoolean.NOT_SAME)) { @@ -7351,7 +6802,7 @@ index 63c1190729..2bee2dab9f 100644 while (iterator.hasNext()) { NavigationAbstract navigationabstract = (NavigationAbstract) iterator.next(); -@@ -1512,7 +2118,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1549,7 +2135,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (!navigationabstract.i()) { navigationabstract.b(blockposition); } @@ -7375,7 +6826,7 @@ index 63c1190729..2bee2dab9f 100644 this.tickingEntities = wasTicking; // Paper } diff --git a/src/main/java/net/minecraft/server/WorldUpgrader.java b/src/main/java/net/minecraft/server/WorldUpgrader.java -index 5ccdc0b87b..888dae2d5e 100644 +index 5ccdc0b87..888dae2d5 100644 --- a/src/main/java/net/minecraft/server/WorldUpgrader.java +++ b/src/main/java/net/minecraft/server/WorldUpgrader.java @@ -218,7 +218,7 @@ public class WorldUpgrader { @@ -7388,10 +6839,10 @@ index 5ccdc0b87b..888dae2d5e 100644 try { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -index 4ec53a54e3..31c81b4b52 100644 +index ff8ba5457..ecedc167d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -@@ -77,7 +77,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { +@@ -79,7 +79,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { public Material getBlockType(int x, int y, int z) { CraftChunk.validateChunkCoordinates(x, y, z); @@ -7401,10 +6852,10 @@ index 4ec53a54e3..31c81b4b52 100644 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6282a05ae8..d434bd93bc 100644 +index 93c0afbfb..61e5a91a7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -231,7 +231,7 @@ import javax.annotation.Nullable; // Paper +@@ -230,7 +230,7 @@ import javax.annotation.Nullable; // Paper import javax.annotation.Nonnull; // Paper public final class CraftServer implements Server { @@ -7413,7 +6864,7 @@ index 6282a05ae8..d434bd93bc 100644 private final String serverVersion; private final String bukkitVersion = Versioning.getBukkitVersion(); private final Logger logger = Logger.getLogger("Minecraft"); -@@ -848,6 +848,7 @@ public final class CraftServer implements Server { +@@ -847,6 +847,7 @@ public final class CraftServer implements Server { org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper @@ -7421,7 +6872,7 @@ index 6282a05ae8..d434bd93bc 100644 for (WorldServer world : console.getWorlds()) { world.worldDataServer.setDifficulty(config.difficulty); world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals); -@@ -882,6 +883,7 @@ public final class CraftServer implements Server { +@@ -881,6 +882,7 @@ public final class CraftServer implements Server { } world.spigotConfig.init(); // Spigot world.paperConfig.init(); // Paper @@ -7429,7 +6880,7 @@ index 6282a05ae8..d434bd93bc 100644 } Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper -@@ -1828,7 +1830,10 @@ public final class CraftServer implements Server { +@@ -1824,7 +1826,10 @@ public final class CraftServer implements Server { @Override public boolean isPrimaryThread() { @@ -7441,7 +6892,7 @@ index 6282a05ae8..d434bd93bc 100644 } @Override -@@ -2238,6 +2243,14 @@ public final class CraftServer implements Server { +@@ -2234,6 +2239,14 @@ public final class CraftServer implements Server { return com.destroystokyo.paper.PaperConfig.config; } @@ -7457,7 +6908,7 @@ index 6282a05ae8..d434bd93bc 100644 public void restart() { org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ca0ca5e407..87e634482d 100644 +index fe7e8d97a..2ac199f91 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -336,6 +336,14 @@ public class CraftWorld implements World { @@ -7499,7 +6950,7 @@ index ca0ca5e407..87e634482d 100644 } return true; -@@ -2541,7 +2543,7 @@ public class CraftWorld implements World { +@@ -2524,7 +2526,7 @@ public class CraftWorld implements World { } return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> { net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null); @@ -7509,7 +6960,7 @@ index ca0ca5e407..87e634482d 100644 }, MinecraftServer.getServer()); } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 9dd994f8b1..2cebdb36f1 100644 +index 082a35004..0db533858 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -138,6 +138,13 @@ public class Main { @@ -7536,10 +6987,10 @@ index 9dd994f8b1..2cebdb36f1 100644 //Thread.sleep(TimeUnit.SECONDS.toMillis(20)); // Paper End diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 9b0e868f00..ee53060b11 100644 +index 733f2430d..6d1500cf1 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -207,7 +207,7 @@ public class CraftBlock implements Block { +@@ -210,7 +210,7 @@ public class CraftBlock implements Block { @Override public Material getType() { @@ -7547,45 +6998,12 @@ index 9b0e868f00..ee53060b11 100644 + return world.getType(position).getBukkitMaterial(); // Tuinity - optimise getType calls } - @Override -@@ -505,15 +505,30 @@ public class CraftBlock implements Block { - return null; - } - -- return Biome.valueOf(IRegistry.BIOME.getKey(base).getKey().toUpperCase(java.util.Locale.ENGLISH)); -+ return base.getBukkitBiome(); // Tuinity - optimise biome conversion - } - -+ private static final java.util.EnumMap BUKKIT_BIOME_TO_NMS_CACHE = new java.util.EnumMap<>(Biome.class); // Tuinity - optimise biome conversion -+ - public static BiomeBase biomeToBiomeBase(Biome bio) { - if (bio == null) { - return null; - } - -- return IRegistry.BIOME.get(new MinecraftKey(bio.name().toLowerCase(java.util.Locale.ENGLISH))); -+ // Tuinity start - optimise biome conversion -+ BiomeBase cached = BUKKIT_BIOME_TO_NMS_CACHE.get(bio); -+ -+ if (cached != null) { -+ return cached; -+ } -+ -+ BiomeBase ret = IRegistry.BIOME.get(new MinecraftKey(bio.name().toLowerCase(java.util.Locale.ENGLISH))); -+ synchronized (BUKKIT_BIOME_TO_NMS_CACHE) { -+ BUKKIT_BIOME_TO_NMS_CACHE.put(bio, ret); -+ } -+ -+ return ret; -+ // Tuinity end - optimise biome conversion - } - @Override diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java -index 11aa2dc18c..c51c43573f 100644 +index 0f89e7768..f24d42345 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java -@@ -136,7 +136,7 @@ public class CraftBlockState implements BlockState { +@@ -135,7 +135,7 @@ public class CraftBlockState implements BlockState { @Override public Material getType() { @@ -7595,7 +7013,7 @@ index 11aa2dc18c..c51c43573f 100644 public void setFlag(int flag) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index bbded5671e..9808901532 100644 +index bbded5671..980890153 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -44,7 +44,7 @@ public class CraftBlockData implements BlockData { @@ -7608,10 +7026,10 @@ index bbded5671e..9808901532 100644 public IBlockData getState() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index d1df4e5799..6f18a78980 100644 +index b1fdc5737..f1710a53f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -495,27 +495,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -501,27 +501,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { entity.setHeadRotation(yaw); } @@ -7640,7 +7058,7 @@ index d1df4e5799..6f18a78980 100644 @Override public boolean teleport(Location location) { -@@ -549,6 +529,37 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -555,6 +535,37 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return true; } @@ -7679,7 +7097,7 @@ index d1df4e5799..6f18a78980 100644 public boolean teleport(org.bukkit.entity.Entity destination) { return teleport(destination.getLocation()); diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java -index 948a59217c..ab43c97e8f 100644 +index 948a59217..ab43c97e8 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -73,7 +73,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { @@ -7692,7 +7110,7 @@ index 948a59217c..ab43c97e8f 100644 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java -index fd32d1450a..c38e514b00 100644 +index fd32d1450..c38e514b0 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java @@ -25,6 +25,10 @@ class CraftAsyncTask extends CraftTask { @@ -7715,7 +7133,7 @@ index fd32d1450a..c38e514b00 100644 LinkedList getWorkers() { diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java -index ca2be30609..2c57013765 100644 +index ca2be3060..2c5701376 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java @@ -100,9 +100,18 @@ public final class CraftScoreboardManager implements ScoreboardManager { @@ -7738,7 +7156,7 @@ index ca2be30609..2c57013765 100644 } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java -index f72c13beda..50f855b931 100644 +index f72c13bed..50f855b93 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java +++ b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java @@ -119,6 +119,32 @@ public class UnsafeList extends AbstractList implements List, RandomAcc @@ -7775,7 +7193,7 @@ index f72c13beda..50f855b931 100644 public void clear() { // Create new array to reset memory usage to initial capacity diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java -index 674096cab1..001b1e5197 100644 +index 674096cab..001b1e519 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java @@ -11,7 +11,7 @@ public final class Versioning { @@ -7788,7 +7206,7 @@ index 674096cab1..001b1e5197 100644 if (stream != null) { diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java -index 9f7d2ef932..c3ac1a46c3 100644 +index 9f7d2ef93..c3ac1a46c 100644 --- a/src/main/java/org/spigotmc/AsyncCatcher.java +++ b/src/main/java/org/spigotmc/AsyncCatcher.java @@ -10,7 +10,7 @@ public class AsyncCatcher @@ -7801,7 +7219,7 @@ index 9f7d2ef932..c3ac1a46c3 100644 throw new IllegalStateException( "Asynchronous " + reason + "!" ); } diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 513c1041c3..4d31090848 100644 +index 513c1041c..4d3109084 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -61,6 +61,84 @@ public class WatchdogThread extends Thread diff --git a/patches/server/0002-Rebrand.patch b/patches/server/0002-Rebrand.patch index e0079b6b8..c4a5c5e61 100644 --- a/patches/server/0002-Rebrand.patch +++ b/patches/server/0002-Rebrand.patch @@ -5,26 +5,25 @@ Subject: [PATCH] Rebrand diff --git a/pom.xml b/pom.xml -index 6fd5968178..5b540e606e 100644 +index ee19a2874..09119ce8e 100644 --- a/pom.xml +++ b/pom.xml -@@ -1,12 +1,11 @@ +@@ -1,11 +1,11 @@ 4.0.0 - tuinity + purpur jar - 1.16.1-R0.1-SNAPSHOT + 1.16.2-R0.1-SNAPSHOT - Tuinity-Server - https://github.com/Spottedleaf/Tuinity -- -+ Purpur ++ Purpur-Server + https://github.com/pl3xgaming/Purpur + - UTF-8 -@@ -18,16 +17,16 @@ +@@ -18,16 +18,16 @@ @@ -45,7 +44,7 @@ index 6fd5968178..5b540e606e 100644 ${project.version} compile -@@ -43,6 +42,20 @@ +@@ -43,6 +43,20 @@ ${minecraft.version}-SNAPSHOT compile @@ -66,7 +65,7 @@ index 6fd5968178..5b540e606e 100644 net.minecrell terminalconsoleappender -@@ -164,15 +177,15 @@ +@@ -164,15 +178,15 @@ @@ -81,12 +80,12 @@ index 6fd5968178..5b540e606e 100644 1.3 - git-Tuinity- -+ git-Purpur- ++ git-Purpur- .. diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java -index 74ed02fa92..c1280478ee 100644 +index 74ed02fa9..c1280478e 100644 --- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java +++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java @@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole { @@ -99,10 +98,10 @@ index 74ed02fa92..c1280478ee 100644 .completer(new ConsoleCommandCompleter(this.server)) ); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bb54a4aa71..0a7dd67516 100644 +index 615a71a78..ba731edd3 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1506,7 +1506,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { Map> map = new HashMap<>(); diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 578f7809c..21dc3b9a6 100644 +index 5907caa74..a60634fc4 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -168,6 +168,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -49,7 +49,7 @@ index 578f7809c..21dc3b9a6 100644 // Paper end com.tuinity.tuinity.config.TuinityConfig.init((java.io.File) options.valueOf("tuinity-settings")); // Tuinity - Server Config diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4a956f368..ad58307f1 100644 +index 4834f7569..e9e55c6f1 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -95,6 +95,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -60,11 +60,14 @@ index 4a956f368..ad58307f1 100644 public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPosition lastPhysicsProblem; // Spigot -@@ -124,6 +125,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -126,8 +127,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper - this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray +- this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray this.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Tuinity - Server Config + this.purpurConfig = new net.pl3x.purpur.PurpurWorldConfig((((WorldDataServer)worlddatamutable).getName())); // Purpur ++ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit @@ -341,10 +344,10 @@ index 000000000..4904be939 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7079c79f7..6e15c2690 100644 +index 020bb17b6..3e2fa5a37 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -849,6 +849,7 @@ public final class CraftServer implements Server { +@@ -848,6 +848,7 @@ public final class CraftServer implements Server { org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper com.tuinity.tuinity.config.TuinityConfig.init((File) console.options.valueOf("tuinity-settings")); // Tuinity - Server Config @@ -352,7 +355,7 @@ index 7079c79f7..6e15c2690 100644 for (WorldServer world : console.getWorlds()) { world.worldDataServer.setDifficulty(config.difficulty); world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals); -@@ -884,6 +885,7 @@ public final class CraftServer implements Server { +@@ -883,6 +884,7 @@ public final class CraftServer implements Server { world.spigotConfig.init(); // Spigot world.paperConfig.init(); // Paper world.tuinityConfig.init(); // Tuinity - Server Config @@ -360,7 +363,7 @@ index 7079c79f7..6e15c2690 100644 } Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper -@@ -902,6 +904,7 @@ public final class CraftServer implements Server { +@@ -901,6 +903,7 @@ public final class CraftServer implements Server { reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper @@ -368,7 +371,7 @@ index 7079c79f7..6e15c2690 100644 overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); ignoreVanillaPermissions = commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2251,6 +2254,18 @@ public final class CraftServer implements Server { +@@ -2247,6 +2250,18 @@ public final class CraftServer implements Server { } // Tuinity end - add config to timings report @@ -388,7 +391,7 @@ index 7079c79f7..6e15c2690 100644 public void restart() { org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 2cebdb36f..27fae70a2 100644 +index 0db533858..bdb87ffac 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -146,6 +146,14 @@ public class Main { diff --git a/patches/server/0006-Advancement-API.patch b/patches/server/0006-Advancement-API.patch index 4bd3f1d16..1172feb7e 100644 --- a/patches/server/0006-Advancement-API.patch +++ b/patches/server/0006-Advancement-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Advancement API diff --git a/src/main/java/net/minecraft/server/Advancement.java b/src/main/java/net/minecraft/server/Advancement.java -index 315a03cf5..07d4c4cfd 100644 +index c405047c..384d4090 100644 --- a/src/main/java/net/minecraft/server/Advancement.java +++ b/src/main/java/net/minecraft/server/Advancement.java @@ -64,7 +64,7 @@ public class Advancement { @@ -18,7 +18,7 @@ index 315a03cf5..07d4c4cfd 100644 } diff --git a/src/main/java/net/minecraft/server/AdvancementDisplay.java b/src/main/java/net/minecraft/server/AdvancementDisplay.java -index 12c63a53b..0d3900456 100644 +index b0d4b7a6..ac4fac89 100644 --- a/src/main/java/net/minecraft/server/AdvancementDisplay.java +++ b/src/main/java/net/minecraft/server/AdvancementDisplay.java @@ -15,10 +15,11 @@ public class AdvancementDisplay { @@ -66,10 +66,10 @@ index 12c63a53b..0d3900456 100644 return this.h; } diff --git a/src/main/java/net/minecraft/server/AdvancementFrameType.java b/src/main/java/net/minecraft/server/AdvancementFrameType.java -index a9c49a434..551a84547 100644 +index 90b78e49..9a3a53cf 100644 --- a/src/main/java/net/minecraft/server/AdvancementFrameType.java +++ b/src/main/java/net/minecraft/server/AdvancementFrameType.java -@@ -1,14 +1,25 @@ +@@ -1,15 +1,26 @@ package net.minecraft.server; +import org.bukkit.advancement.FrameType; // Purpur @@ -86,6 +86,7 @@ index a9c49a434..551a84547 100644 private final String d; private final int e; private final EnumChatFormat f; + private final IChatBaseComponent g; - private AdvancementFrameType(String s, int i, EnumChatFormat enumchatformat) { + // Purpur start @@ -98,7 +99,7 @@ index a9c49a434..551a84547 100644 this.e = i; this.f = enumchatformat; diff --git a/src/main/java/net/minecraft/server/CriterionTrigger.java b/src/main/java/net/minecraft/server/CriterionTrigger.java -index cfb420a9c..6fd3671c3 100644 +index cfb420a9..6fd3671c 100644 --- a/src/main/java/net/minecraft/server/CriterionTrigger.java +++ b/src/main/java/net/minecraft/server/CriterionTrigger.java @@ -26,6 +26,7 @@ public interface CriterionTrigger { @@ -110,7 +111,7 @@ index cfb420a9c..6fd3671c3 100644 return this.a; } diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java -index a5aadf285..b0a7092d6 100644 +index a5aadf28..b0a7092d 100644 --- a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java +++ b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java @@ -27,4 +27,11 @@ public class CraftAdvancement implements org.bukkit.advancement.Advancement { @@ -127,7 +128,7 @@ index a5aadf285..b0a7092d6 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java new file mode 100644 -index 000000000..1cbb1e67b +index 00000000..1cbb1e67 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java @@ -0,0 +1,47 @@ diff --git a/patches/server/0007-Llama-API.patch b/patches/server/0007-Llama-API.patch index 5440c30d4..b248a3ff2 100644 --- a/patches/server/0007-Llama-API.patch +++ b/patches/server/0007-Llama-API.patch @@ -5,77 +5,75 @@ Subject: [PATCH] Llama API diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java -index 4fe769c76..cf3192085 100644 +index d4175f2d..e90ff597 100644 --- a/src/main/java/net/minecraft/server/EntityLlama.java +++ b/src/main/java/net/minecraft/server/EntityLlama.java @@ -13,7 +13,8 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn @Nullable - private EntityLlama bI; + private EntityLlama bB; @Nullable -- private EntityLlama bJ; -+ private EntityLlama bJ; public EntityLlama getCaravanTail() { return bJ; } // Purpur - OBFHELPER +- private EntityLlama bC; ++ private EntityLlama bC; public EntityLlama getCaravanTail() { return bC; } // Purpur - OBFHELPER + public boolean shouldJoinCaravan = true; // Purpur public EntityLlama(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -41,7 +42,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn - if (!this.inventoryChest.getItem(1).isEmpty()) { +@@ -42,6 +43,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn nbttagcompound.set("DecorItem", this.inventoryChest.getItem(1).save(new NBTTagCompound())); } -- + + nbttagcompound.setBoolean("Purpur.ShouldJoinCaravan", shouldJoinCaravan); // Purpur } @Override -@@ -52,7 +53,11 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn - if (nbttagcompound.hasKeyOfType("DecorItem", 10)) { +@@ -53,6 +55,11 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn this.inventoryChest.setItem(1, ItemStack.a(nbttagcompound.getCompound("DecorItem"))); } -- + + // Purpur start + if (nbttagcompound.hasKey("Purpur.ShouldJoinCaravan")) { + nbttagcompound.setBoolean("Purpur.ShouldJoinCaravan", shouldJoinCaravan); + } + // Purpur end - this.ff(); + this.fe(); } -@@ -387,19 +392,24 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn +@@ -387,19 +394,24 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn } } -+ public void leaveCaravan() { fB(); } // Purpur - OBFHELPER - public void fB() { - if (this.bI != null) { ++ public void leaveCaravan() { fA(); } // Purpur - OBFHELPER + public void fA() { + if (this.bB != null) { + new net.pl3x.purpur.event.entity.LlamaLeaveCaravanEvent((org.bukkit.entity.Llama) getBukkitEntity()).callEvent(); // Purpur - this.bI.bJ = null; + this.bB.bC = null; } - this.bI = null; + this.bB = null; } + public void joinCaravan(EntityLlama entitiyllama) { a(entitiyllama); } // Purpur - OBFHELPER public void a(EntityLlama entityllama) { + if (!shouldJoinCaravan || !new net.pl3x.purpur.event.entity.LlamaJoinCaravanEvent((org.bukkit.entity.Llama) getBukkitEntity(), (org.bukkit.entity.Llama) entityllama.getBukkitEntity()).callEvent()) return; // Purpur - this.bI = entityllama; - this.bI.bJ = this; + this.bB = entityllama; + this.bB.bC = this; } -+ public boolean hasCaravanTail() { return fC(); } // Purpur - OBFHELPER - public boolean fC() { - return this.bJ != null; ++ public boolean hasCaravanTail() { return fB(); } // Purpur - OBFHELPER + public boolean fB() { + return this.bC != null; } -@@ -410,7 +420,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn +@@ -410,7 +422,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn } @Nullable -- public EntityLlama fE() { -+ public EntityLlama fE() { return getCaravanHead(); } public EntityLlama getCaravanHead() { // Purpur - OBFHELPER - return this.bI; +- public EntityLlama fD() { ++ public EntityLlama fD() { return getCaravanHead(); } public EntityLlama getCaravanHead() { // Purpur - OBFHELPER + return this.bB; } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalLlamaFollow.java b/src/main/java/net/minecraft/server/PathfinderGoalLlamaFollow.java -index 938c271fa..e21901a72 100644 +index 1b29ca2c..47ffa669 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalLlamaFollow.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalLlamaFollow.java @@ -6,7 +6,7 @@ import java.util.List; @@ -92,7 +90,7 @@ index 938c271fa..e21901a72 100644 @Override public boolean a() { + if (!getLlama().shouldJoinCaravan) return false; // Purpur - if (!this.a.isLeashed() && !this.a.fD()) { + if (!this.a.isLeashed() && !this.a.fC()) { List list = this.a.world.getEntities(this.a, this.a.getBoundingBox().grow(9.0D, 4.0D, 9.0D), (entity) -> { EntityTypes entitytypes = entity.getEntityType(); @@ -77,6 +78,7 @@ public class PathfinderGoalLlamaFollow extends PathfinderGoal { @@ -100,11 +98,11 @@ index 938c271fa..e21901a72 100644 @Override public boolean b() { + if (!getLlama().shouldJoinCaravan) return false; // Purpur - if (this.a.fD() && this.a.fE().isAlive() && this.a(this.a, 0)) { - double d0 = this.a.h((Entity) this.a.fE()); + if (this.a.fC() && this.a.fD().isAlive() && this.a(this.a, 0)) { + double d0 = this.a.h((Entity) this.a.fD()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java -index 3f94c5a92..a02763480 100644 +index 3f94c5a9..a0276348 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java @@ -65,4 +65,48 @@ public class CraftLlama extends CraftChestedHorse implements Llama, CraftRangedE diff --git a/patches/server/0008-Evoker-API.patch b/patches/server/0008-Evoker-API.patch index 1e98a3408..ae8d64d36 100644 --- a/patches/server/0008-Evoker-API.patch +++ b/patches/server/0008-Evoker-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Evoker API diff --git a/src/main/java/net/minecraft/server/EntityEvoker.java b/src/main/java/net/minecraft/server/EntityEvoker.java -index dd55e5e5b..c37c2930e 100644 +index 307d723c9..4bea4ca7e 100644 --- a/src/main/java/net/minecraft/server/EntityEvoker.java +++ b/src/main/java/net/minecraft/server/EntityEvoker.java @@ -24,7 +24,7 @@ public class EntityEvoker extends EntityIllagerWizard { @@ -23,13 +23,13 @@ index dd55e5e5b..c37c2930e 100644 + public void setWololoTarget(@Nullable EntitySheep sheep) { a(sheep); } // Purpur - OBFHELPER private void a(@Nullable EntitySheep entitysheep) { - this.bv = entitysheep; + this.bo = entitysheep; } @Nullable -- private EntitySheep fh() { -+ private EntitySheep fh() { return getWololoTarget(); } public EntitySheep getWololoTarget() { // Purpur - OBFHELPER - return this.bv; +- private EntitySheep fg() { ++ private EntitySheep fg() { return getWololoTarget(); } public EntitySheep getWololoTarget() { // Purpur - OBFHELPER + return this.bo; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java diff --git a/patches/server/0009-AFK-API.patch b/patches/server/0009-AFK-API.patch index af597193b..2a9675e1e 100644 --- a/patches/server/0009-AFK-API.patch +++ b/patches/server/0009-AFK-API.patch @@ -4,20 +4,8 @@ Date: Thu, 8 Aug 2019 15:29:15 -0500 Subject: [PATCH] AFK API -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index db62601ea7..08f43f7992 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1563,6 +1563,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - return MathHelper.c(f * f + f1 * f1 + f2 * f2); - } - -+ public double getDistanceSquared(double x, double y, double z) { return g(x, y, z); } // Purpur - OBFHELPER - public double g(double d0, double d1, double d2) { - double d3 = this.locX() - d0; - double d4 = this.locY() - d1; diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index e411f6280d..7ac4ce116e 100644 +index ce4ebc96c..eb62555cb 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -84,6 +84,15 @@ public abstract class EntityHuman extends EntityLiving { @@ -33,17 +21,17 @@ index e411f6280d..7ac4ce116e 100644 + } + // Purpur end + - public EntityHuman(World world, BlockPosition blockposition, GameProfile gameprofile) { + public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) { super(EntityTypes.PLAYER, world); - this.bS = ItemStack.b; + this.bL = ItemStack.b; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index e5a81f8318..ecd0cd7752 100644 +index ba97787f2..b67611b11 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1752,8 +1752,54 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1718,8 +1718,54 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void resetIdleTimer() { - this.ch = SystemUtils.getMonotonicMillis(); + this.ca = SystemUtils.getMonotonicMillis(); + setAfk(false); // Purpur } @@ -96,10 +84,10 @@ index e5a81f8318..ecd0cd7752 100644 return this.serverStatisticManager; } diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 0edcb775e9..dfa8f3439b 100644 +index 882b82d89..90c37e4a8 100644 --- a/src/main/java/net/minecraft/server/IEntityAccess.java +++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -144,28 +144,18 @@ public interface IEntityAccess { +@@ -149,28 +149,18 @@ public interface IEntityAccess { } // Paper end @@ -121,7 +109,7 @@ index 0edcb775e9..dfa8f3439b 100644 - } while (!IEntitySelector.g.test(entityhuman)); - } while (!IEntitySelector.b.test(entityhuman)); - -- d4 = entityhuman.g(d0, d1, d2); +- d4 = entityhuman.h(d0, d1, d2); - } while (d3 >= 0.0D && d4 >= d3 * d3); - - return true; @@ -141,7 +129,7 @@ index 0edcb775e9..dfa8f3439b 100644 @Nullable diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index a52dd0c021..9b4795f3bd 100644 +index 06ce390b6..939535cb2 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -7,6 +7,7 @@ import javax.annotation.Nullable; @@ -161,7 +149,7 @@ index a52dd0c021..9b4795f3bd 100644 // Paper start public static final Predicate affectsSpawning = (entity) -> { diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index ddb56ffd2b..b28bdaabbe 100644 +index d32f423c5..6c1438f7d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -232,6 +232,12 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -186,7 +174,7 @@ index ddb56ffd2b..b28bdaabbe 100644 // Skip the first time we do this if (true) { // Spigot - don't skip any move events Location oldTo = to.clone(); -@@ -1129,7 +1137,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1123,7 +1131,7 @@ public class PlayerConnection implements PacketListenerPlayIn { if (!this.player.H() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative() && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR) { // Spigot flag1 = true; @@ -195,7 +183,7 @@ index ddb56ffd2b..b28bdaabbe 100644 } this.player.setLocation(d4, d5, d6, f, f1); -@@ -1168,6 +1176,8 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1162,6 +1170,8 @@ public class PlayerConnection implements PacketListenerPlayIn { this.lastYaw = to.getYaw(); this.lastPitch = to.getPitch(); @@ -205,10 +193,10 @@ index ddb56ffd2b..b28bdaabbe 100644 if (from.getX() != Double.MAX_VALUE) { Location oldTo = to.clone(); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 2bee2dab9f..748ace6aa6 100644 +index 92646b86b..eaf13fb15 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -862,7 +862,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -843,7 +843,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit end if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> { @@ -217,7 +205,7 @@ index 2bee2dab9f..748ace6aa6 100644 })) { // CraftBukkit start long l = this.worldData.getDayTime() + 24000L; -@@ -1195,7 +1195,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1176,7 +1176,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); @@ -227,7 +215,7 @@ index 2bee2dab9f..748ace6aa6 100644 } else if (entityplayer.isSleeping()) { ++j; diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index 803a7ff92a..d699a91685 100644 +index 803a7ff92..d699a9168 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java @@ -1,6 +1,7 @@ @@ -255,7 +243,7 @@ index 803a7ff92a..d699a91685 100644 private static void timingsSettings() { timingsUrl = getString("settings.timings.url", timingsUrl); diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 361f7857e4..2578a4677d 100644 +index 361f7857e..2578a4677 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -56,4 +56,15 @@ public class PurpurWorldConfig { @@ -275,10 +263,10 @@ index 361f7857e4..2578a4677d 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index adf918fd75..b202fb8e14 100644 +index 0088701e2..087cb11b5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2155,4 +2155,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2152,4 +2152,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return spigot; } // Spigot end @@ -301,7 +289,7 @@ index adf918fd75..b202fb8e14 100644 + // Purpur end } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 37e930e0cb..89dc611cd7 100644 +index 37e930e0c..89dc611cd 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -207,6 +207,7 @@ public class ActivationRange diff --git a/patches/server/0010-Bring-back-server-name.patch b/patches/server/0010-Bring-back-server-name.patch index 53e3865e8..be3770f2f 100644 --- a/patches/server/0010-Bring-back-server-name.patch +++ b/patches/server/0010-Bring-back-server-name.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Bring back server name diff --git a/src/main/java/net/minecraft/server/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/DedicatedServerProperties.java -index 6786fd094..8a9be3fdb 100644 +index 23f8e144f..6797fa2e8 100644 --- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java @@ -10,6 +10,7 @@ public class DedicatedServerProperties extends PropertyManager { +@@ -143,10 +143,21 @@ public class EntityTypes { return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_builder.a(s)); } @@ -30,8 +30,8 @@ index 18a806ebb..7f2dcc1de 100644 public static Optional> a(String s) { return IRegistry.ENTITY_TYPE.getOptional(MinecraftKey.a(s)); } -@@ -270,6 +281,16 @@ public class EntityTypes { - return this.bf; +@@ -275,6 +286,16 @@ public class EntityTypes { + return this.bg; } + // Purpur start @@ -45,18 +45,18 @@ index 18a806ebb..7f2dcc1de 100644 + // Purpur end + public String f() { - if (this.bn == null) { - this.bn = SystemUtils.a("entity", IRegistry.ENTITY_TYPE.getKey(this)); -@@ -278,6 +299,7 @@ public class EntityTypes { - return this.bn; + if (this.bo == null) { + this.bo = SystemUtils.a("entity", IRegistry.ENTITY_TYPE.getKey(this)); +@@ -283,6 +304,7 @@ public class EntityTypes { + return this.bo; } + public IChatBaseComponent getNameComponent() { return g(); } // Purpur - OBFHELPER public IChatBaseComponent g() { - if (this.bo == null) { - this.bo = new ChatMessage(this.f()); + if (this.bp == null) { + this.bp = new ChatMessage(this.f()); diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java -index 793e42072..cf4c12ff8 100644 +index f543bd84f..b5995f6fe 100644 --- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java +++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java @@ -7,6 +7,13 @@ import java.util.Objects; @@ -79,7 +79,7 @@ index 793e42072..cf4c12ff8 100644 + // Purpur start + org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -+ PlayerSetSpawnerTypeWithEggEvent event = new PlayerSetSpawnerTypeWithEggEvent((Player) itemactioncontext.b.getBukkitEntity(), bukkitBlock, (CreatureSpawner) bukkitBlock.getState(), EntityType.fromName(entitytypes.getName())); ++ PlayerSetSpawnerTypeWithEggEvent event = new PlayerSetSpawnerTypeWithEggEvent((Player) itemactioncontext.getEntity().getBukkitEntity(), bukkitBlock, (CreatureSpawner) bukkitBlock.getState(), EntityType.fromName(entitytypes.getName())); + if (!event.callEvent()) { + return EnumInteractionResult.FAIL; + } diff --git a/patches/server/0017-EMC-MonsterEggSpawnEvent.patch b/patches/server/0017-EMC-MonsterEggSpawnEvent.patch index 8cac1f14e..e5bb2275b 100644 --- a/patches/server/0017-EMC-MonsterEggSpawnEvent.patch +++ b/patches/server/0017-EMC-MonsterEggSpawnEvent.patch @@ -5,45 +5,45 @@ Subject: [PATCH] EMC - MonsterEggSpawnEvent diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 7f2dcc1de..5aea85595 100644 +index dcb43775b..8300e7d1e 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -176,19 +176,45 @@ public class EntityTypes { +@@ -177,19 +177,45 @@ public class EntityTypes { @Nullable - public Entity spawnCreature(World world, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) { -- return this.spawnCreature(world, itemstack == null ? null : itemstack.getTag(), itemstack != null && itemstack.hasName() ? itemstack.getName() : null, entityhuman, blockposition, enummobspawn, flag, flag1); -+ return this.spawnCreature(world, itemstack, itemstack == null ? null : itemstack.getTag(), itemstack != null && itemstack.hasName() ? itemstack.getName() : null, entityhuman, blockposition, enummobspawn, flag, flag1); // Purpur + public Entity spawnCreature(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) { +- return this.spawnCreature(worldserver, itemstack == null ? null : itemstack.getTag(), itemstack != null && itemstack.hasName() ? itemstack.getName() : null, entityhuman, blockposition, enummobspawn, flag, flag1); ++ return this.spawnCreature(worldserver, itemstack, itemstack == null ? null : itemstack.getTag(), itemstack != null && itemstack.hasName() ? itemstack.getName() : null, entityhuman, blockposition, enummobspawn, flag, flag1); // Purpur } @Nullable - public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) { + public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) { + // Purpur start -+ return spawnCreature(world, null, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); ++ return spawnCreature(worldserver, null, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); + } + + @Nullable -+ public T spawnCreature(World world, @Nullable ItemStack itemstack, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) { ++ public T spawnCreature(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) { + // Purpur end // CraftBukkit start - return this.spawnCreature(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); + return this.spawnCreature(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); } @Nullable - public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { + public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { + // Purpur start -+ return spawnCreature(world, null, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, spawnReason); ++ return spawnCreature(worldserver, null, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, spawnReason); + } + @Nullable -+ public T spawnCreature(World world, @Nullable ItemStack itemstack, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { ++ public T spawnCreature(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { + // Purpur end - T t0 = this.createCreature(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); + T t0 = this.createCreature(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); + // Purpur start + if (spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG && itemstack != null && t0 != null) { + final net.pl3x.purpur.event.entity.MonsterEggSpawnEvent event = new net.pl3x.purpur.event.entity.MonsterEggSpawnEvent(entityhuman != null ? entityhuman.getBukkitEntity() : null, (org.bukkit.entity.LivingEntity) t0.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); + if (!event.callEvent()) { -+ ((WorldServer) world).removeEntity(t0); ++ worldserver.removeEntity(t0); + return null; + } + if (event.getEntity().getEntityId() != t0.getId()) { @@ -52,6 +52,6 @@ index 7f2dcc1de..5aea85595 100644 + } + // Purpur end + - return world.addEntity(t0, spawnReason) ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled - // CraftBukkit end - } + if (t0 != null) { + return worldserver.addAllEntities(t0, spawnReason) ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled + // CraftBukkit end diff --git a/patches/server/0018-Villager-resetOffers.patch b/patches/server/0018-Villager-resetOffers.patch index c01273984..b6e6c3cd7 100644 --- a/patches/server/0018-Villager-resetOffers.patch +++ b/patches/server/0018-Villager-resetOffers.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Villager#resetOffers diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -index 81823b5d5..beb84a2ab 100644 +index 68fd780bc..ced893452 100644 --- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -@@ -86,6 +86,13 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP +@@ -85,6 +85,13 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP return this.tradingPlayer != null; } @@ -22,7 +22,7 @@ index 81823b5d5..beb84a2ab 100644 @Override public MerchantRecipeList getOffers() { if (this.trades == null) { -@@ -208,6 +215,7 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP +@@ -207,6 +214,7 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP return this.world; } diff --git a/patches/server/0020-LivingEntity-playPickupItemAnimation.patch b/patches/server/0019-LivingEntity-playPickupItemAnimation.patch similarity index 100% rename from patches/server/0020-LivingEntity-playPickupItemAnimation.patch rename to patches/server/0019-LivingEntity-playPickupItemAnimation.patch diff --git a/patches/server/0019-World-getPlacementBlockData.patch b/patches/server/0019-World-getPlacementBlockData.patch deleted file mode 100644 index 9a583855c..000000000 --- a/patches/server/0019-World-getPlacementBlockData.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sat, 8 Feb 2020 23:30:17 -0600 -Subject: [PATCH] World#getPlacementBlockData - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f51f9c8d11..8d70139228 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2622,5 +2622,10 @@ public class CraftWorld implements World { - public net.pl3x.purpur.MoonPhase getMoonPhase() { - return net.pl3x.purpur.MoonPhase.getPhase(getFullTime() / 24000L); - } -+ -+ public BlockData getPlacementBlockData(BlockData blockdata, Location location) { -+ IBlockData validData = net.minecraft.server.Block.getValidBlockForPosition(((CraftBlockData) blockdata).getState(), getHandle(), net.minecraft.server.MCUtil.toBlockPosition(location)); -+ return CraftBlockData.fromData(validData == null ? Blocks.AIR.getBlockData() : validData); -+ } - // Purpur end - } diff --git a/patches/server/0021-SkeletonHorseTrapEvent-getPlayer.patch b/patches/server/0020-SkeletonHorseTrapEvent-getPlayer.patch similarity index 85% rename from patches/server/0021-SkeletonHorseTrapEvent-getPlayer.patch rename to patches/server/0020-SkeletonHorseTrapEvent-getPlayer.patch index 0c34b60ac..3d3709166 100644 --- a/patches/server/0021-SkeletonHorseTrapEvent-getPlayer.patch +++ b/patches/server/0020-SkeletonHorseTrapEvent-getPlayer.patch @@ -5,7 +5,7 @@ Subject: [PATCH] SkeletonHorseTrapEvent#getPlayer diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java -index b37e4aa37..4d8c4ac07 100644 +index 6a9af67d0..c10a37fe1 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java @@ -2,7 +2,8 @@ package net.minecraft.server; @@ -18,7 +18,7 @@ index b37e4aa37..4d8c4ac07 100644 public PathfinderGoalHorseTrap(EntityHorseSkeleton entityhorseskeleton) { this.a = entityhorseskeleton; -@@ -10,12 +11,12 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal { +@@ -10,13 +11,13 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal { @Override public boolean a() { @@ -28,8 +28,9 @@ index b37e4aa37..4d8c4ac07 100644 @Override public void e() { + WorldServer worldserver = (WorldServer) this.a.world; - if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity()).callEvent()) return; // Paper + if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity(), (org.bukkit.entity.Player) player.getBukkitEntity()).callEvent()) return; // Paper // Purpur - DifficultyDamageScaler difficultydamagescaler = this.a.world.getDamageScaler(this.a.getChunkCoordinates()); + DifficultyDamageScaler difficultydamagescaler = worldserver.getDamageScaler(this.a.getChunkCoordinates()); this.a.t(false); diff --git a/patches/server/0022-PaperPR-PlayerItemCooldownEvent.patch b/patches/server/0021-PaperPR-PlayerItemCooldownEvent.patch similarity index 100% rename from patches/server/0022-PaperPR-PlayerItemCooldownEvent.patch rename to patches/server/0021-PaperPR-PlayerItemCooldownEvent.patch diff --git a/patches/server/0023-EntityMoveEvent.patch b/patches/server/0022-EntityMoveEvent.patch similarity index 90% rename from patches/server/0023-EntityMoveEvent.patch rename to patches/server/0022-EntityMoveEvent.patch index 0a1bbdfb0..36c4777d8 100644 --- a/patches/server/0023-EntityMoveEvent.patch +++ b/patches/server/0022-EntityMoveEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] EntityMoveEvent diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index c27b60b18..af1fea428 100644 +index 130516ce6..17128d5aa 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2787,6 +2787,20 @@ public abstract class EntityLiving extends Entity { +@@ -2790,6 +2790,20 @@ public abstract class EntityLiving extends Entity { this.collideNearby(); this.world.getMethodProfiler().exit(); @@ -26,6 +26,6 @@ index c27b60b18..af1fea428 100644 + } + } + // Purpur end - if (!this.world.isClientSide && this.dN() && this.aC()) { + if (!this.world.isClientSide && this.dN() && this.aF()) { this.damageEntity(DamageSource.DROWN, 1.0F); } diff --git a/patches/server/0024-PaperPR-Add-BellRingEvent.patch b/patches/server/0023-PaperPR-Add-BellRingEvent.patch similarity index 100% rename from patches/server/0024-PaperPR-Add-BellRingEvent.patch rename to patches/server/0023-PaperPR-Add-BellRingEvent.patch diff --git a/patches/server/0025-Player-invulnerabilities.patch b/patches/server/0024-Player-invulnerabilities.patch similarity index 85% rename from patches/server/0025-Player-invulnerabilities.patch rename to patches/server/0024-Player-invulnerabilities.patch index 69379debb..3fbf03701 100644 --- a/patches/server/0025-Player-invulnerabilities.patch +++ b/patches/server/0024-Player-invulnerabilities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player invulnerabilities diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index ecd0cd7752..2ff7e6e576 100644 +index b67611b11..2738194fc 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -141,6 +141,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -144,6 +144,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.canPickUpLoot = true; this.maxHealthCache = this.getMaxHealth(); this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper @@ -17,7 +17,7 @@ index ecd0cd7752..2ff7e6e576 100644 } // Paper start public BlockPosition getPointInFront(double inFront) { -@@ -801,6 +803,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -806,6 +808,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } @@ -30,7 +30,7 @@ index ecd0cd7752..2ff7e6e576 100644 @Override public boolean damageEntity(DamageSource damagesource, float f) { if (this.isInvulnerable(damagesource)) { -@@ -808,7 +816,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -813,7 +821,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } else { boolean flag = this.server.j() && this.canPvP() && "fall".equals(damagesource.translationIndex); @@ -39,15 +39,15 @@ index ecd0cd7752..2ff7e6e576 100644 return false; } else { if (damagesource instanceof EntityDamageSource) { -@@ -1054,6 +1062,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); - this.world.getServer().getPluginManager().callEvent(changeEvent); - // CraftBukkit end +@@ -997,6 +1005,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + // CraftBukkit end + } + + this.invulnerableTicks = worldserver.purpurConfig.playerSpawnInvulnerableTicks; // Purpur return this; } } -@@ -2149,9 +2158,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -2121,9 +2130,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @Override public boolean isFrozen() { // Paper - protected > public @@ -67,10 +67,10 @@ index ecd0cd7752..2ff7e6e576 100644 public Scoreboard getScoreboard() { return getBukkitEntity().getScoreboard().getHandle(); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index b28bdaabbe..9cbf3e63ea 100644 +index 6c1438f7d..8fa91b8f5 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1578,6 +1578,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1572,6 +1572,7 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.getWorldServer()); // Paper start PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packetplayinresourcepackstatus.status.ordinal()]; @@ -79,10 +79,10 @@ index b28bdaabbe..9cbf3e63ea 100644 this.server.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getPlayer(), packStatus)); // Paper end diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 9382e8f79e..7309d8be28 100644 +index f9eb17cb6..75b0565df 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -890,6 +890,8 @@ public abstract class PlayerList { +@@ -903,6 +903,8 @@ public abstract class PlayerList { } // Paper end @@ -92,7 +92,7 @@ index 9382e8f79e..7309d8be28 100644 return entityplayer1; } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 2578a4677d..c441fcea9b 100644 +index 2578a4677..c441fcea9 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -67,4 +67,11 @@ public class PurpurWorldConfig { @@ -108,10 +108,10 @@ index 2578a4677d..c441fcea9b 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b202fb8e14..3732b82bf2 100644 +index 087cb11b5..eefb4bd74 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2171,5 +2171,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2168,5 +2168,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void resetIdleTimer() { getHandle().resetIdleTimer(); } diff --git a/patches/server/0026-Anvil-API.patch b/patches/server/0025-Anvil-API.patch similarity index 99% rename from patches/server/0026-Anvil-API.patch rename to patches/server/0025-Anvil-API.patch index 7e3a69cec..90182a822 100644 --- a/patches/server/0026-Anvil-API.patch +++ b/patches/server/0025-Anvil-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Anvil API diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java -index 24631b2bc..126effe5b 100644 +index fc2038df8..4aa6b035a 100644 --- a/src/main/java/net/minecraft/server/ContainerAnvil.java +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java @@ -20,6 +20,8 @@ public class ContainerAnvil extends ContainerAnvilAbstract { diff --git a/patches/server/0027-Configurable-villager-brain-ticks.patch b/patches/server/0026-Configurable-villager-brain-ticks.patch similarity index 96% rename from patches/server/0027-Configurable-villager-brain-ticks.patch rename to patches/server/0026-Configurable-villager-brain-ticks.patch index 7040f6da4..3ddfa0f83 100644 --- a/patches/server/0027-Configurable-villager-brain-ticks.patch +++ b/patches/server/0026-Configurable-villager-brain-ticks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable villager brain ticks diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index bf019043a..7925c8991 100644 +index c10ff09dd..f880a38bf 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -58,6 +58,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -33,8 +33,8 @@ index bf019043a..7925c8991 100644 + if (((WorldServer) world).getMinecraftServer().lagging ? tick : world.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick) + // Purpur end if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper - if (this.bM) { - this.bM = false; + this.world.getMethodProfiler().exit(); + if (this.bF) { diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index c441fcea9..c7fb5a737 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java diff --git a/patches/server/0028-Alternative-Keepalive-Handling.patch b/patches/server/0027-Alternative-Keepalive-Handling.patch similarity index 96% rename from patches/server/0028-Alternative-Keepalive-Handling.patch rename to patches/server/0027-Alternative-Keepalive-Handling.patch index 05b756176..7ad39f3f2 100644 --- a/patches/server/0028-Alternative-Keepalive-Handling.patch +++ b/patches/server/0027-Alternative-Keepalive-Handling.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Alternative Keepalive Handling diff --git a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -index 8e93f1540b..470f92c4fb 100644 +index 8e93f1540..470f92c4f 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java +++ b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java @@ -22,6 +22,7 @@ public class PacketPlayInKeepAlive implements Packet { @@ -17,7 +17,7 @@ index 8e93f1540b..470f92c4fb 100644 return this.a; } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 9cbf3e63ea..4cd07ab08a 100644 +index 8fa91b8f5..a01b80327 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -75,6 +75,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -50,7 +50,7 @@ index 9cbf3e63ea..4cd07ab08a 100644 if (this.isPendingPing()) { if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info -@@ -2719,6 +2735,16 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2714,6 +2730,16 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -68,7 +68,7 @@ index 9cbf3e63ea..4cd07ab08a 100644 if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) { int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive); diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index 6ff5e07834..f1d6c32fde 100644 +index 6ff5e0783..f1d6c32fd 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java @@ -154,6 +154,11 @@ public class PurpurConfig { diff --git a/patches/server/0029-Silk-touch-spawners.patch b/patches/server/0028-Silk-touch-spawners.patch similarity index 91% rename from patches/server/0029-Silk-touch-spawners.patch rename to patches/server/0028-Silk-touch-spawners.patch index 48b4e87b3..d22a803fa 100644 --- a/patches/server/0029-Silk-touch-spawners.patch +++ b/patches/server/0028-Silk-touch-spawners.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Silk touch spawners diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 81725611d..c7232047c 100644 +index 623f8811e..0dc8aa500 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -226,6 +226,7 @@ public class Block extends BlockBase implements IMaterial { - iblockdata.dropNaturally(world, blockposition, itemstack); +@@ -218,6 +218,7 @@ public class Block extends BlockBase implements IMaterial { + } + public static void dropItem(World world, BlockPosition blockposition, ItemStack itemstack) { a(world, blockposition, itemstack); } // Purpur - OBFHELPER @@ -17,7 +17,7 @@ index 81725611d..c7232047c 100644 if (!world.isClientSide && !itemstack.isEmpty() && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { float f = 0.5F; diff --git a/src/main/java/net/minecraft/server/BlockMobSpawner.java b/src/main/java/net/minecraft/server/BlockMobSpawner.java -index 16f9fb8e5..c002a65cf 100644 +index 81e145ff0..5929220b0 100644 --- a/src/main/java/net/minecraft/server/BlockMobSpawner.java +++ b/src/main/java/net/minecraft/server/BlockMobSpawner.java @@ -11,6 +11,40 @@ public class BlockMobSpawner extends BlockTileEntity { @@ -59,14 +59,14 @@ index 16f9fb8e5..c002a65cf 100644 + // Purpur end + @Override - public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) { - super.dropNaturally(iblockdata, world, blockposition, itemstack); + public void dropNaturally(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) { + super.dropNaturally(iblockdata, worldserver, blockposition, itemstack); @@ -23,6 +57,7 @@ public class BlockMobSpawner extends BlockTileEntity { @Override - public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) { -+ if (isSilkTouch(world, itemstack)) return 0; // Purpur - int i = 15 + world.random.nextInt(15) + world.random.nextInt(15); + public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) { ++ if (isSilkTouch(worldserver, itemstack)) return 0; // Purpur + int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15); return i; diff --git a/src/main/java/net/minecraft/server/ItemSpawner.java b/src/main/java/net/minecraft/server/ItemSpawner.java @@ -99,7 +99,7 @@ index 000000000..babe8ad2c + } +} diff --git a/src/main/java/net/minecraft/server/Items.java b/src/main/java/net/minecraft/server/Items.java -index 89a9eec99..619c40b27 100644 +index 1c861bccc..67ebcbe4d 100644 --- a/src/main/java/net/minecraft/server/Items.java +++ b/src/main/java/net/minecraft/server/Items.java @@ -180,7 +180,7 @@ public class Items { diff --git a/patches/server/0030-MC-168772-Fix-Add-turtle-egg-block-options.patch b/patches/server/0029-MC-168772-Fix-Add-turtle-egg-block-options.patch similarity index 100% rename from patches/server/0030-MC-168772-Fix-Add-turtle-egg-block-options.patch rename to patches/server/0029-MC-168772-Fix-Add-turtle-egg-block-options.patch diff --git a/patches/server/0031-MC-4-Fix-Item-position-desync.patch b/patches/server/0030-MC-4-Fix-Item-position-desync.patch similarity index 96% rename from patches/server/0031-MC-4-Fix-Item-position-desync.patch rename to patches/server/0030-MC-4-Fix-Item-position-desync.patch index 09d8fedb3..c1a561e82 100644 --- a/patches/server/0031-MC-4-Fix-Item-position-desync.patch +++ b/patches/server/0030-MC-4-Fix-Item-position-desync.patch @@ -5,7 +5,7 @@ Subject: [PATCH] MC-4 Fix - Item position desync diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index bfb931268d..e9bc546f80 100644 +index 7ab013058..ef30731c2 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -134,6 +134,12 @@ public class EntityTrackerEntry { @@ -22,7 +22,7 @@ index bfb931268d..e9bc546f80 100644 boolean flag2 = flag1 || this.tickCounter % 60 == 0; boolean flag3 = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1; diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -index e5da2b19c1..6d9d52e4fc 100644 +index e5da2b19c..6d9d52e4f 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java @@ -14,10 +14,12 @@ public class PacketPlayOutEntity implements Packet { @@ -39,7 +39,7 @@ index e5da2b19c1..6d9d52e4fc 100644 return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D); } diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index f1d6c32fde..04ed0b1dba 100644 +index f1d6c32fd..04ed0b1db 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java @@ -177,4 +177,9 @@ public class PurpurConfig { diff --git a/patches/server/0032-Fix-vanilla-command-permission-handler.patch b/patches/server/0031-Fix-vanilla-command-permission-handler.patch similarity index 98% rename from patches/server/0032-Fix-vanilla-command-permission-handler.patch rename to patches/server/0031-Fix-vanilla-command-permission-handler.patch index 2d400eec5..adf81fc09 100644 --- a/patches/server/0032-Fix-vanilla-command-permission-handler.patch +++ b/patches/server/0031-Fix-vanilla-command-permission-handler.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix vanilla command permission handler diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java -index 5e3fc338b..b3835c3c7 100644 +index ca0d66448..0fab36224 100644 --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java +++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java @@ -35,6 +35,7 @@ public abstract class CommandNode implements Comparable> { diff --git a/patches/server/0033-Logger-settings-suppressing-pointless-logs.patch b/patches/server/0032-Logger-settings-suppressing-pointless-logs.patch similarity index 98% rename from patches/server/0033-Logger-settings-suppressing-pointless-logs.patch rename to patches/server/0032-Logger-settings-suppressing-pointless-logs.patch index 998c29e7d..a49e28747 100644 --- a/patches/server/0033-Logger-settings-suppressing-pointless-logs.patch +++ b/patches/server/0032-Logger-settings-suppressing-pointless-logs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Logger settings (suppressing pointless logs) diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -index 1588d101e..fc4c1c1cd 100644 +index 17789407b..c31f4040c 100644 --- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java @@ -169,6 +169,7 @@ public class AdvancementDataPlayer { diff --git a/patches/server/0034-Disable-outdated-build-check.patch b/patches/server/0033-Disable-outdated-build-check.patch similarity index 97% rename from patches/server/0034-Disable-outdated-build-check.patch rename to patches/server/0033-Disable-outdated-build-check.patch index f81bd8fea..6a3b793c4 100644 --- a/patches/server/0034-Disable-outdated-build-check.patch +++ b/patches/server/0033-Disable-outdated-build-check.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable outdated build check diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 3261d2255..2825f5a3a 100644 +index bdb87ffac..bc47e4306 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -259,7 +259,7 @@ public class Main { diff --git a/patches/server/0035-Giants-AI-settings.patch b/patches/server/0034-Giants-AI-settings.patch similarity index 91% rename from patches/server/0035-Giants-AI-settings.patch rename to patches/server/0034-Giants-AI-settings.patch index 3406d5533..0dd1c098c 100644 --- a/patches/server/0035-Giants-AI-settings.patch +++ b/patches/server/0034-Giants-AI-settings.patch @@ -17,7 +17,7 @@ index c57e23e16..92aa104dc 100644 public AttributeModifiable a(AttributeBase attributebase) { return (AttributeModifiable) this.b.computeIfAbsent(attributebase, (attributebase1) -> { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ebbd81a2d..b39cc82bf 100644 +index 42dd8a0e3..2ea06a85f 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -136,7 +136,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -30,7 +30,7 @@ index ebbd81a2d..b39cc82bf 100644 public float I; protected final Random random; diff --git a/src/main/java/net/minecraft/server/EntityGiantZombie.java b/src/main/java/net/minecraft/server/EntityGiantZombie.java -index 37618126f..143041003 100644 +index 9f4f56c47..8dce2aad7 100644 --- a/src/main/java/net/minecraft/server/EntityGiantZombie.java +++ b/src/main/java/net/minecraft/server/EntityGiantZombie.java @@ -4,9 +4,68 @@ public class EntityGiantZombie extends EntityMonster { @@ -74,11 +74,11 @@ index 37618126f..143041003 100644 + } + + @Override -+ public GroupDataEntity prepare(GeneratorAccess world, DifficultyDamageScaler difficulty, EnumMobSpawn enummobspawn, GroupDataEntity groupDataEntity, NBTTagCompound nbt) { -+ GroupDataEntity groupData = super.prepare(world, difficulty, enummobspawn, groupDataEntity, nbt); ++ public GroupDataEntity prepare(WorldAccess worldaccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @javax.annotation.Nullable GroupDataEntity groupdataentity, @javax.annotation.Nullable NBTTagCompound nbttagcompound) { ++ GroupDataEntity groupData = super.prepare(worldaccess, difficultydamagescaler, enummobspawn, groupdataentity, nbttagcompound); + if (groupData == null) { -+ setEquipmentBasedOnDifficulty(difficulty); -+ setEnchantmentBasedOnDifficulty(difficulty); ++ setEquipmentBasedOnDifficulty(difficultydamagescaler); ++ setEnchantmentBasedOnDifficulty(difficultydamagescaler); + } + return groupData; + } @@ -112,7 +112,7 @@ index 37618126f..143041003 100644 } } diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 605bbf017..93714e5d9 100644 +index 36df27024..b7fcade36 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -939,6 +939,7 @@ public abstract class EntityInsentient extends EntityLiving { @@ -131,7 +131,7 @@ index 605bbf017..93714e5d9 100644 protected void b(DifficultyDamageScaler difficultydamagescaler) { float f = difficultydamagescaler.d(); -@@ -1078,10 +1080,12 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1087,10 +1089,12 @@ public abstract class EntityInsentient extends EntityLiving { } else { this.setLeftHanded(false); } @@ -142,14 +142,14 @@ index 605bbf017..93714e5d9 100644 + protected void initAttributes(World world) {} // Purpur + - public boolean es() { + public boolean er() { return false; } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index af1fea428..337e58148 100644 +index 17128d5aa..82cf853ab 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2147,7 +2147,7 @@ public abstract class EntityLiving extends Entity { +@@ -2148,7 +2148,7 @@ public abstract class EntityLiving extends Entity { this.enderTeleportTo(vec3d.x, vec3d.y, vec3d.z); } diff --git a/patches/server/0036-Illusioners-AI-settings.patch b/patches/server/0035-Illusioners-AI-settings.patch similarity index 98% rename from patches/server/0036-Illusioners-AI-settings.patch rename to patches/server/0035-Illusioners-AI-settings.patch index 970c03a9c..687cb9413 100644 --- a/patches/server/0036-Illusioners-AI-settings.patch +++ b/patches/server/0035-Illusioners-AI-settings.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Illusioners AI settings diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -index 76fd0513f..0e23aa91d 100644 +index 1c8231620..7b2c459ad 100644 --- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java +++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java @@ -19,6 +19,17 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan diff --git a/patches/server/0037-Zombie-horse-naturally-spawn.patch b/patches/server/0036-Zombie-horse-naturally-spawn.patch similarity index 95% rename from patches/server/0037-Zombie-horse-naturally-spawn.patch rename to patches/server/0036-Zombie-horse-naturally-spawn.patch index cd94bfde6..f2cec09a4 100644 --- a/patches/server/0037-Zombie-horse-naturally-spawn.patch +++ b/patches/server/0036-Zombie-horse-naturally-spawn.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Zombie horse naturally spawn diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 748ace6aa6..346cbc3efd 100644 +index eaf13fb15..18e8e36d7 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1072,12 +1072,18 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1053,12 +1053,18 @@ public class WorldServer extends World implements GeneratorAccessSeed { boolean flag1 = this.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance; // Paper if (flag1) { @@ -34,7 +34,7 @@ index 748ace6aa6..346cbc3efd 100644 EntityLightning entitylightning = (EntityLightning) EntityTypes.LIGHTNING_BOLT.a((World) this); diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 70f8feffb1..d0fd8f9cdf 100644 +index 70f8feffb..d0fd8f9cd 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -138,4 +138,9 @@ public class PurpurWorldConfig { diff --git a/patches/server/0038-Charged-creeper-naturally-spawn.patch b/patches/server/0037-Charged-creeper-naturally-spawn.patch similarity index 76% rename from patches/server/0038-Charged-creeper-naturally-spawn.patch rename to patches/server/0037-Charged-creeper-naturally-spawn.patch index a0a7e4ce4..25f348b60 100644 --- a/patches/server/0038-Charged-creeper-naturally-spawn.patch +++ b/patches/server/0037-Charged-creeper-naturally-spawn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Charged creeper naturally spawn diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java -index 5e7f3af37..e8008e3c2 100644 +index ad422dfaf..8338afa7c 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -23,6 +23,17 @@ public class EntityCreeper extends EntityMonster { @@ -14,12 +14,12 @@ index 5e7f3af37..e8008e3c2 100644 + // Purpur start + @Override -+ public GroupDataEntity prepare(GeneratorAccess generatoraccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, GroupDataEntity groupdataentity, NBTTagCompound nbttagcompound) { -+ double chance = generatoraccess.getMinecraftWorld().purpurConfig.creeperChargedChance; ++ public GroupDataEntity prepare(WorldAccess worldaccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @javax.annotation.Nullable GroupDataEntity groupdataentity, @javax.annotation.Nullable NBTTagCompound nbttagcompound) { ++ double chance = worldaccess.getMinecraftWorld().purpurConfig.creeperChargedChance; + if (chance > 0D && random.nextDouble() <= chance) { + setPowered(true); + } -+ return super.prepare(generatoraccess, difficultydamagescaler, enummobspawn, groupdataentity, nbttagcompound); ++ return super.prepare(worldaccess, difficultydamagescaler, enummobspawn, groupdataentity, nbttagcompound); + } + // Purpur end + diff --git a/patches/server/0039-Rabbit-naturally-spawn-toast-and-killer.patch b/patches/server/0038-Rabbit-naturally-spawn-toast-and-killer.patch similarity index 95% rename from patches/server/0039-Rabbit-naturally-spawn-toast-and-killer.patch rename to patches/server/0038-Rabbit-naturally-spawn-toast-and-killer.patch index 5d585fed4..276ad71e8 100644 --- a/patches/server/0039-Rabbit-naturally-spawn-toast-and-killer.patch +++ b/patches/server/0038-Rabbit-naturally-spawn-toast-and-killer.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Rabbit naturally spawn toast and killer diff --git a/src/main/java/net/minecraft/server/EntityRabbit.java b/src/main/java/net/minecraft/server/EntityRabbit.java -index baf440538..42145a89c 100644 +index a7456890e..98baf24bd 100644 --- a/src/main/java/net/minecraft/server/EntityRabbit.java +++ b/src/main/java/net/minecraft/server/EntityRabbit.java @@ -297,6 +297,10 @@ public class EntityRabbit extends EntityAnimal { if (!this.hasCustomName()) { - this.setCustomName(new ChatMessage(SystemUtils.a("entity", EntityRabbit.bw))); + this.setCustomName(new ChatMessage(SystemUtils.a("entity", EntityRabbit.bp))); } + // Purpur start + } else if (i == 98) { @@ -18,7 +18,7 @@ index baf440538..42145a89c 100644 + // Purpur end } - this.datawatcher.set(EntityRabbit.bv, i); + this.datawatcher.set(EntityRabbit.bo, i); @@ -318,6 +322,16 @@ public class EntityRabbit extends EntityAnimal { } diff --git a/patches/server/0040-Fix-outdated-server-showing-in-ping-before-server-fu.patch b/patches/server/0039-Fix-outdated-server-showing-in-ping-before-server-fu.patch similarity index 100% rename from patches/server/0040-Fix-outdated-server-showing-in-ping-before-server-fu.patch rename to patches/server/0039-Fix-outdated-server-showing-in-ping-before-server-fu.patch diff --git a/patches/server/0041-Make-Iron-Golems-Swim.patch b/patches/server/0040-Make-Iron-Golems-Swim.patch similarity index 98% rename from patches/server/0041-Make-Iron-Golems-Swim.patch rename to patches/server/0040-Make-Iron-Golems-Swim.patch index 7495f975b..022343904 100644 --- a/patches/server/0041-Make-Iron-Golems-Swim.patch +++ b/patches/server/0040-Make-Iron-Golems-Swim.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make Iron Golems Swim diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java -index e38a675be..ab0731c2a 100644 +index 0a5c27e73..bdff23688 100644 --- a/src/main/java/net/minecraft/server/EntityIronGolem.java +++ b/src/main/java/net/minecraft/server/EntityIronGolem.java @@ -24,6 +24,7 @@ public class EntityIronGolem extends EntityGolem implements IEntityAngerable { diff --git a/patches/server/0042-Dont-send-useless-entity-packets.patch b/patches/server/0041-Dont-send-useless-entity-packets.patch similarity index 97% rename from patches/server/0042-Dont-send-useless-entity-packets.patch rename to patches/server/0041-Dont-send-useless-entity-packets.patch index e40b7e04b..22a2b2bce 100644 --- a/patches/server/0042-Dont-send-useless-entity-packets.patch +++ b/patches/server/0041-Dont-send-useless-entity-packets.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Dont send useless entity packets diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index e9bc546f80..c28e67f9bf 100644 +index ef30731c2..c64bbde28 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -178,6 +178,7 @@ public class EntityTrackerEntry { @@ -40,7 +40,7 @@ index e9bc546f80..c28e67f9bf 100644 this.tracker.c(entityplayer); entityplayer.c(this.tracker); diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -index 6d9d52e4fc..0010448e3a 100644 +index 6d9d52e4f..0010448e3 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java @@ -5,11 +5,11 @@ import java.io.IOException; @@ -61,7 +61,7 @@ index 6d9d52e4fc..0010448e3a 100644 protected boolean h; protected boolean i; diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index 83d146a18c..30935339e8 100644 +index 83d146a18..30935339e 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java @@ -178,6 +178,11 @@ public class PurpurConfig { diff --git a/patches/server/0043-Tulips-change-fox-type.patch b/patches/server/0042-Tulips-change-fox-type.patch similarity index 82% rename from patches/server/0043-Tulips-change-fox-type.patch rename to patches/server/0042-Tulips-change-fox-type.patch index 911f2de1d..311df01ff 100644 --- a/patches/server/0043-Tulips-change-fox-type.patch +++ b/patches/server/0042-Tulips-change-fox-type.patch @@ -5,22 +5,22 @@ Subject: [PATCH] Tulips change fox type diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java -index e6275a9fe..90b01adbe 100644 +index eba33eeb6..f47a78e56 100644 --- a/src/main/java/net/minecraft/server/EntityFox.java +++ b/src/main/java/net/minecraft/server/EntityFox.java @@ -37,9 +37,9 @@ public class EntityFox extends EntityAnimal { - private static final Predicate bC = (entity) -> { - return !entity.bt() && IEntitySelector.e.test(entity); + private static final Predicate bv = (entity) -> { + return !entity.bw() && IEntitySelector.e.test(entity); }; -- private PathfinderGoal bD; -- private PathfinderGoal bE; -- private PathfinderGoal bF; -+ private PathfinderGoal bD; private PathfinderGoal attackAnimalGoal() { return bD; } // Purpur - OBFHELPER -+ private PathfinderGoal bE; private PathfinderGoal attackTurtleGoal() { return bE; } // Purpur - OBFHELPER -+ private PathfinderGoal bF; private PathfinderGoal attackFishGoal() { return bF; } // Purpur - OBFHELPER - private float bG; - private float bH; - private float bI; +- private PathfinderGoal bw; +- private PathfinderGoal bx; +- private PathfinderGoal by; ++ private PathfinderGoal bw; private PathfinderGoal attackAnimalGoal() { return bw; } // Purpur - OBFHELPER ++ private PathfinderGoal bx; private PathfinderGoal attackTurtleGoal() { return bx; } // Purpur - OBFHELPER ++ private PathfinderGoal by; private PathfinderGoal attackFishGoal() { return by; } // Purpur - OBFHELPER + private float bz; + private float bA; + private float bB; @@ -227,6 +227,11 @@ public class EntityFox extends EntityAnimal { } @@ -31,18 +31,18 @@ index e6275a9fe..90b01adbe 100644 + this.targetSelector.a(attackFishGoal()); + // Purpur end if (this.getFoxType() == EntityFox.Type.RED) { - this.targetSelector.a(4, this.bD); - this.targetSelector.a(4, this.bE); + this.targetSelector.a(4, this.bw); + this.targetSelector.a(4, this.bx); @@ -259,6 +264,7 @@ public class EntityFox extends EntityAnimal { public void setFoxType(EntityFox.Type entityfox_type) { - this.datawatcher.set(EntityFox.bv, entityfox_type.c()); + this.datawatcher.set(EntityFox.bo, entityfox_type.b()); + initializePathFinderGoals(); // Purpur - fix API bug not updating pathfinders on type change } - private List fb() { + private List fa() { @@ -575,6 +581,27 @@ public class EntityFox extends EntityAnimal { - return this.fb().contains(uuid); + return this.fa().contains(uuid); } + @Override @@ -70,7 +70,7 @@ index e6275a9fe..90b01adbe 100644 protected org.bukkit.event.entity.EntityDeathEvent d(DamageSource damagesource) { // Paper ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND).cloneItemStack(); // Paper diff --git a/src/main/java/net/minecraft/server/Items.java b/src/main/java/net/minecraft/server/Items.java -index 619c40b27..b5305eaa9 100644 +index 67ebcbe4d..4c379916d 100644 --- a/src/main/java/net/minecraft/server/Items.java +++ b/src/main/java/net/minecraft/server/Items.java @@ -119,8 +119,8 @@ public class Items { diff --git a/patches/server/0044-Breedable-Polar-Bears.patch b/patches/server/0043-Breedable-Polar-Bears.patch similarity index 85% rename from patches/server/0044-Breedable-Polar-Bears.patch rename to patches/server/0043-Breedable-Polar-Bears.patch index e3920522a..82d96fdeb 100644 --- a/patches/server/0044-Breedable-Polar-Bears.patch +++ b/patches/server/0043-Breedable-Polar-Bears.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Breedable Polar Bears diff --git a/src/main/java/net/minecraft/server/EntityPolarBear.java b/src/main/java/net/minecraft/server/EntityPolarBear.java -index 69e5c1aed..c26fd0e18 100644 +index b59cbd70a..cd6d2e07e 100644 --- a/src/main/java/net/minecraft/server/EntityPolarBear.java +++ b/src/main/java/net/minecraft/server/EntityPolarBear.java -@@ -21,6 +21,30 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { +@@ -23,6 +23,30 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { super(entitytypes, world); } @@ -37,9 +37,9 @@ index 69e5c1aed..c26fd0e18 100644 + // Purpur end + @Override - public EntityAgeable createChild(EntityAgeable entityageable) { - return (EntityAgeable) EntityTypes.POLAR_BEAR.a(this.world); -@@ -28,7 +52,7 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { + public EntityAgeable createChild(WorldServer worldserver, EntityAgeable entityageable) { + return (EntityAgeable) EntityTypes.POLAR_BEAR.a((World) worldserver); +@@ -30,7 +54,7 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { @Override public boolean k(ItemStack itemstack) { @@ -48,7 +48,7 @@ index 69e5c1aed..c26fd0e18 100644 } @Override -@@ -37,6 +61,12 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { +@@ -39,6 +63,12 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { this.goalSelector.a(0, new PathfinderGoalFloat(this)); this.goalSelector.a(1, new EntityPolarBear.c()); this.goalSelector.a(1, new EntityPolarBear.d()); @@ -61,18 +61,18 @@ index 69e5c1aed..c26fd0e18 100644 this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.25D)); this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D)); this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); -@@ -178,10 +208,12 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { +@@ -180,10 +210,12 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { return flag; } -+ public boolean isStanding() { return eN(); } // Purpur - OBFHELPER - public boolean eN() { - return (Boolean) this.datawatcher.get(EntityPolarBear.bv); ++ public boolean isStanding() { return eM(); } // Purpur - OBFHELPER + public boolean eM() { + return (Boolean) this.datawatcher.get(EntityPolarBear.bo); } + public void setStanding(boolean standing) { t(standing); } // Purpur - OBFHELPER public void t(boolean flag) { - this.datawatcher.set(EntityPolarBear.bv, flag); + this.datawatcher.set(EntityPolarBear.bo, flag); } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index a98dd59b8..9b6bd8f41 100644 diff --git a/patches/server/0045-Chickens-can-retaliate.patch b/patches/server/0044-Chickens-can-retaliate.patch similarity index 96% rename from patches/server/0045-Chickens-can-retaliate.patch rename to patches/server/0044-Chickens-can-retaliate.patch index 8604a8678..5fd0b7324 100644 --- a/patches/server/0045-Chickens-can-retaliate.patch +++ b/patches/server/0044-Chickens-can-retaliate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Chickens can retaliate diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java -index c6ee92343..137eada65 100644 +index 45e989efd..26dee32bf 100644 --- a/src/main/java/net/minecraft/server/EntityChicken.java +++ b/src/main/java/net/minecraft/server/EntityChicken.java @@ -17,16 +17,35 @@ public class EntityChicken extends EntityAnimal { @@ -29,7 +29,7 @@ index c6ee92343..137eada65 100644 - this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D)); + //this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D)); // Purpur - moved down this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D)); - this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, false, EntityChicken.bC)); + this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, false, EntityChicken.bv)); this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.1D)); this.goalSelector.a(5, new PathfinderGoalRandomStrollLand(this, 1.0D)); this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); @@ -48,7 +48,7 @@ index c6ee92343..137eada65 100644 @@ -35,7 +54,7 @@ public class EntityChicken extends EntityAnimal { } - public static AttributeProvider.Builder eL() { + public static AttributeProvider.Builder eK() { - return EntityInsentient.p().a(GenericAttributes.MAX_HEALTH, 4.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.25D); + return EntityInsentient.p().a(GenericAttributes.MAX_HEALTH, 4.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.25D).a(GenericAttributes.ATTACK_DAMAGE, 0.0D); // Purpur } diff --git a/patches/server/0046-Add-option-to-set-armorstand-step-height.patch b/patches/server/0045-Add-option-to-set-armorstand-step-height.patch similarity index 94% rename from patches/server/0046-Add-option-to-set-armorstand-step-height.patch rename to patches/server/0045-Add-option-to-set-armorstand-step-height.patch index 7857e529a..d6224dda9 100644 --- a/patches/server/0046-Add-option-to-set-armorstand-step-height.patch +++ b/patches/server/0045-Add-option-to-set-armorstand-step-height.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to set armorstand step height diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 250bccee4..7543f2cee 100644 +index 70c2c2e3e..eb32abc5d 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -615,6 +615,7 @@ public class EntityArmorStand extends EntityLiving { +@@ -617,6 +617,7 @@ public class EntityArmorStand extends EntityLiving { @Override public void tick() { diff --git a/patches/server/0047-Cat-spawning-options.patch b/patches/server/0046-Cat-spawning-options.patch similarity index 79% rename from patches/server/0047-Cat-spawning-options.patch rename to patches/server/0046-Cat-spawning-options.patch index 8e011786e..08a2676f4 100644 --- a/patches/server/0047-Cat-spawning-options.patch +++ b/patches/server/0046-Cat-spawning-options.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cat spawning options diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index dfa8f3439b..a3a073f9d2 100644 +index 90c37e4a8..7a42feb16 100644 --- a/src/main/java/net/minecraft/server/IEntityAccess.java +++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -45,6 +45,7 @@ public interface IEntityAccess { +@@ -44,6 +44,7 @@ public interface IEntityAccess { } } @@ -17,7 +17,7 @@ index dfa8f3439b..a3a073f9d2 100644 return this.a(oclass, axisalignedbb, IEntitySelector.g); } diff --git a/src/main/java/net/minecraft/server/MobSpawnerCat.java b/src/main/java/net/minecraft/server/MobSpawnerCat.java -index 67c20747a3..68d37121fd 100644 +index 5e17868a7..6d0ebd8af 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerCat.java +++ b/src/main/java/net/minecraft/server/MobSpawnerCat.java @@ -16,7 +16,7 @@ public class MobSpawnerCat implements MobSpawner { @@ -26,47 +26,43 @@ index 67c20747a3..68d37121fd 100644 } else { - this.a = 1200; + this.a = worldserver.purpurConfig.catSpawnDelay; // Purpur; - EntityPlayer entityplayer = worldserver.h(); + EntityPlayer entityplayer = worldserver.q_(); if (entityplayer == null) { -@@ -50,10 +50,14 @@ public class MobSpawnerCat implements MobSpawner { +@@ -50,10 +50,12 @@ public class MobSpawnerCat implements MobSpawner { } private int a(WorldServer worldserver, BlockPosition blockposition) { - boolean flag = true; - -- if (worldserver.x().a(VillagePlaceType.r.c(), blockposition, 48, VillagePlace.Occupancy.IS_OCCUPIED) > 4L) { +- if (worldserver.y().a(VillagePlaceType.r.c(), blockposition, 48, VillagePlace.Occupancy.IS_OCCUPIED) > 4L) { - List list = worldserver.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(48.0D, 8.0D, 48.0D)); + // Purpur start + int range = worldserver.purpurConfig.catSpawnVillageScanRange; -+ if (range <= 0) { -+ return 0; -+ } ++ if (range <= 0) return 0; + if (worldserver.getVillagePlace().count(VillagePlaceType.home().predicate(), blockposition, range, VillagePlace.Occupancy.IS_OCCUPIED) > 4L) { -+ List list = worldserver.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range)); ++ List list = worldserver.getEntitiesInAABB(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range)); + // Purpur end if (list.size() < 5) { - return this.a(blockposition, (World) worldserver); -@@ -64,9 +68,13 @@ public class MobSpawnerCat implements MobSpawner { + return this.a(blockposition, worldserver); +@@ -64,9 +66,11 @@ public class MobSpawnerCat implements MobSpawner { } - private int a(World world, BlockPosition blockposition) { + private int b(WorldServer worldserver, BlockPosition blockposition) { - boolean flag = true; -- List list = world.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(16.0D, 8.0D, 16.0D)); +- List list = worldserver.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(16.0D, 8.0D, 16.0D)); - + // Purpur start -+ int range = world.purpurConfig.catSpawnSwampHutScanRange; -+ if (range <= 0) { -+ return 0; -+ } -+ List list = world.getEntitiesInAABB(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range)); ++ int range = worldserver.purpurConfig.catSpawnSwampHutScanRange; ++ if (range <= 0) return 0; ++ List list = worldserver.getEntitiesInAABB(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range)); + // Purpur end - return list.size() < 1 ? this.a(blockposition, world) : 0; + return list.size() < 1 ? this.a(blockposition, worldserver) : 0; } diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index c1e149f204..acc30cb0d8 100644 +index adacfce6f..21e401acd 100644 --- a/src/main/java/net/minecraft/server/VillagePlace.java +++ b/src/main/java/net/minecraft/server/VillagePlace.java @@ -45,6 +45,7 @@ public class VillagePlace extends RegionFileSection { @@ -78,7 +74,7 @@ index c1e149f204..acc30cb0d8 100644 return this.c(predicate, blockposition, i, villageplace_occupancy).count(); } diff --git a/src/main/java/net/minecraft/server/VillagePlaceType.java b/src/main/java/net/minecraft/server/VillagePlaceType.java -index 5bd3bcc2b9..5f2bb140ae 100644 +index a5718af9b..b6b4c8c49 100644 --- a/src/main/java/net/minecraft/server/VillagePlaceType.java +++ b/src/main/java/net/minecraft/server/VillagePlaceType.java @@ -44,7 +44,7 @@ public class VillagePlaceType { @@ -99,19 +95,19 @@ index 5bd3bcc2b9..5f2bb140ae 100644 return this.E; } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 346cbc3efd..88e807da1e 100644 +index 18e8e36d7..17105c9a1 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -2502,6 +2502,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -2530,6 +2530,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } -+ public VillagePlace getVillagePlace() { return x(); } // Purpur - OBFHELPER - public VillagePlace x() { ++ public VillagePlace getVillagePlace() { return y(); } // Purpur - OBFHELPER + public VillagePlace y() { return this.getChunkProvider().j(); } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index b41d4959c1..55e609cc1c 100644 +index b41d4959c..55e609cc1 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -111,6 +111,15 @@ public class PurpurWorldConfig { diff --git a/patches/server/0048-MC-147659-Fix-non-black-cats-spawning-in-swamp-huts.patch b/patches/server/0047-MC-147659-Fix-non-black-cats-spawning-in-swamp-huts.patch similarity index 74% rename from patches/server/0048-MC-147659-Fix-non-black-cats-spawning-in-swamp-huts.patch rename to patches/server/0047-MC-147659-Fix-non-black-cats-spawning-in-swamp-huts.patch index 3316977c3..d9a4297d3 100644 --- a/patches/server/0048-MC-147659-Fix-non-black-cats-spawning-in-swamp-huts.patch +++ b/patches/server/0047-MC-147659-Fix-non-black-cats-spawning-in-swamp-huts.patch @@ -5,17 +5,17 @@ Subject: [PATCH] MC-147659 - Fix non black cats spawning in swamp huts diff --git a/src/main/java/net/minecraft/server/MobSpawnerCat.java b/src/main/java/net/minecraft/server/MobSpawnerCat.java -index 68d37121f..318d051b0 100644 +index 6d0ebd8af..c7a787007 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerCat.java +++ b/src/main/java/net/minecraft/server/MobSpawnerCat.java -@@ -84,8 +84,9 @@ public class MobSpawnerCat implements MobSpawner { +@@ -80,8 +80,9 @@ public class MobSpawnerCat implements MobSpawner { if (entitycat == null) { return 0; } else { + entitycat.setPositionRotation(blockposition, 0.0F, 0.0F); // Purpur - entitycat.prepare(world, world.getDamageScaler(blockposition), EnumMobSpawn.NATURAL, (GroupDataEntity) null, (NBTTagCompound) null); + entitycat.prepare(worldserver, worldserver.getDamageScaler(blockposition), EnumMobSpawn.NATURAL, (GroupDataEntity) null, (NBTTagCompound) null); - entitycat.setPositionRotation(blockposition, 0.0F, 0.0F); + //entitycat.setPositionRotation(blockposition, 0.0F, 0.0F); // Purpur - move up - fixes non black cat types spawning inside swamp huts - world.addEntity(entitycat); + worldserver.addAllEntities(entitycat); return 1; } diff --git a/patches/server/0049-Cows-eat-mushrooms.patch b/patches/server/0048-Cows-eat-mushrooms.patch similarity index 91% rename from patches/server/0049-Cows-eat-mushrooms.patch rename to patches/server/0048-Cows-eat-mushrooms.patch index 5c4c49099..e1a9364d7 100644 --- a/patches/server/0049-Cows-eat-mushrooms.patch +++ b/patches/server/0048-Cows-eat-mushrooms.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cows eat mushrooms diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b39cc82bf..884f4a0ab 100644 +index 2ea06a85f..5fc69bc95 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2740,6 +2740,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2723,6 +2723,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.invulnerable = flag; } @@ -17,7 +17,7 @@ index b39cc82bf..884f4a0ab 100644 this.setPositionRotation(entity.locX(), entity.locY(), entity.locZ(), entity.yaw, entity.pitch); } diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java -index 30ee6df6b..d6baddb9d 100644 +index 42e6761c8..cfb009c81 100644 --- a/src/main/java/net/minecraft/server/EntityCow.java +++ b/src/main/java/net/minecraft/server/EntityCow.java @@ -16,6 +16,7 @@ public class EntityCow extends EntityAnimal { @@ -107,21 +107,21 @@ index 30ee6df6b..d6baddb9d 100644 + // Purpur end + @Override - public EntityCow createChild(EntityAgeable entityageable) { - return (EntityCow) EntityTypes.COW.a(this.world); + public EntityCow createChild(WorldServer worldserver, EntityAgeable entityageable) { + return (EntityCow) EntityTypes.COW.a((World) worldserver); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 762217c7e..653071979 100644 +index 82cf853ab..5e9849a46 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -80,7 +80,7 @@ public abstract class EntityLiving extends Entity { public int maxNoDamageTicks; - public final float aF; - public final float aG; -- public float aH; -+ public float aH; public float getRenderYawOffset() { return this.aH; } public void setRenderYawOffset(float f) { this.aH = f; } // Purpur - OBFHELPER - public float aI; - public float aJ; - public float aK; + public final float ay; + public final float az; +- public float aA; ++ public float aA; public float getRenderYawOffset() { return this.aA; } public void setRenderYawOffset(float f) { this.aA = f; } // Purpur - OBFHELPER + public float aB; + public float aC; + public float aD; diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index 55e609cc1..3d78ac90c 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java diff --git a/patches/server/0050-Fix-cow-rotation-when-shearing-mooshroom.patch b/patches/server/0049-Fix-cow-rotation-when-shearing-mooshroom.patch similarity index 94% rename from patches/server/0050-Fix-cow-rotation-when-shearing-mooshroom.patch rename to patches/server/0049-Fix-cow-rotation-when-shearing-mooshroom.patch index 532bb1e3a..e89e37a93 100644 --- a/patches/server/0050-Fix-cow-rotation-when-shearing-mooshroom.patch +++ b/patches/server/0049-Fix-cow-rotation-when-shearing-mooshroom.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Fix cow rotation when shearing mooshroom diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java -index 23ef03306..ecbdc65ec 100644 +index 1aacbae04..38df17bd2 100644 --- a/src/main/java/net/minecraft/server/EntityMushroomCow.java +++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java @@ -135,7 +135,13 @@ public class EntityMushroomCow extends EntityCow implements IShearable { entitycow.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch); entitycow.setHealth(this.getHealth()); -- entitycow.aH = this.aH; +- entitycow.aA = this.aA; + // Purpur start - correctly copy rotation + entitycow.copyPositionRotation(this); + entitycow.setRenderYawOffset(this.getRenderYawOffset()); diff --git a/patches/server/0051-Pigs-give-saddle-back.patch b/patches/server/0050-Pigs-give-saddle-back.patch similarity index 94% rename from patches/server/0051-Pigs-give-saddle-back.patch rename to patches/server/0050-Pigs-give-saddle-back.patch index c55808f64..48006d9f2 100644 --- a/patches/server/0051-Pigs-give-saddle-back.patch +++ b/patches/server/0050-Pigs-give-saddle-back.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Pigs give saddle back diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java -index cd0a94794..cf2df391a 100644 +index 684867010..87caac62b 100644 --- a/src/main/java/net/minecraft/server/EntityPig.java +++ b/src/main/java/net/minecraft/server/EntityPig.java @@ -109,6 +109,18 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { - if (!flag && this.hasSaddle() && !this.isVehicle()) { + if (!flag && this.hasSaddle() && !this.isVehicle() && !entityhuman.ep()) { if (!this.world.isClientSide) { + // Purpur start + if (world.purpurConfig.pigGiveSaddleBack && entityhuman.isSneaking()) { diff --git a/patches/server/0052-Snowman-drop-and-put-back-pumpkin.patch b/patches/server/0051-Snowman-drop-and-put-back-pumpkin.patch similarity index 100% rename from patches/server/0052-Snowman-drop-and-put-back-pumpkin.patch rename to patches/server/0051-Snowman-drop-and-put-back-pumpkin.patch diff --git a/patches/server/0053-Ender-dragon-always-drop-egg.patch b/patches/server/0052-Ender-dragon-always-drop-egg.patch similarity index 95% rename from patches/server/0053-Ender-dragon-always-drop-egg.patch rename to patches/server/0052-Ender-dragon-always-drop-egg.patch index 3fb319f56..6e84fe9c7 100644 --- a/patches/server/0053-Ender-dragon-always-drop-egg.patch +++ b/patches/server/0052-Ender-dragon-always-drop-egg.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Ender dragon always drop egg diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java -index 69faefbdb..ecd6af04d 100644 +index 47182c500..4f3f7cb42 100644 --- a/src/main/java/net/minecraft/server/EnderDragonBattle.java +++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java @@ -358,7 +358,7 @@ public class EnderDragonBattle { this.bossBattle.setVisible(false); - this.a(true); + this.generateExitPortal(true); this.n(); - if (!this.previouslyKilled) { + if (this.world.purpurConfig.enderDragonAlwaysDropsEggBlock || !this.previouslyKilled) { // Purpur - always place dragon egg diff --git a/patches/server/0054-Ender-dragon-always-drop-full-exp.patch b/patches/server/0053-Ender-dragon-always-drop-full-exp.patch similarity index 94% rename from patches/server/0054-Ender-dragon-always-drop-full-exp.patch rename to patches/server/0053-Ender-dragon-always-drop-full-exp.patch index 5b0445999..496fe92d6 100644 --- a/patches/server/0054-Ender-dragon-always-drop-full-exp.patch +++ b/patches/server/0053-Ender-dragon-always-drop-full-exp.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Ender dragon always drop full exp diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 63a759cc1..08fa5a975 100644 +index 6b2c5e8d4..0e74794d3 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -564,7 +564,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { boolean flag = this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT); short short0 = 500; -- if (this.bM != null && !this.bM.isPreviouslyKilled()) { +- if (this.bF != null && !this.bF.isPreviouslyKilled()) { + if (getEnderDragonBattle() != null && (world.purpurConfig.enderDragonAlwaysDropsFullExp || !getEnderDragonBattle().isPreviouslyKilled())) { // Purpur short0 = 12000; } diff --git a/patches/server/0055-Signs-editable-on-right-click.patch b/patches/server/0054-Signs-editable-on-right-click.patch similarity index 97% rename from patches/server/0055-Signs-editable-on-right-click.patch rename to patches/server/0054-Signs-editable-on-right-click.patch index 1b4bae59d..a7b709c5d 100644 --- a/patches/server/0055-Signs-editable-on-right-click.patch +++ b/patches/server/0054-Signs-editable-on-right-click.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Signs editable on right click diff --git a/src/main/java/net/minecraft/server/BlockSign.java b/src/main/java/net/minecraft/server/BlockSign.java -index cfc1da1f5..3a9871dbc 100644 +index 3585fd82c..770ad5edf 100644 --- a/src/main/java/net/minecraft/server/BlockSign.java +++ b/src/main/java/net/minecraft/server/BlockSign.java @@ -56,6 +56,17 @@ public abstract class BlockSign extends BlockTileEntity implements IBlockWaterlo @@ -27,7 +27,7 @@ index cfc1da1f5..3a9871dbc 100644 } else { return EnumInteractionResult.PASS; diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index c4b0d8720..e1ab29975 100644 +index 2b9d5724c..316766970 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java @@ -113,6 +113,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // diff --git a/patches/server/0056-Signs-allow-color-codes.patch b/patches/server/0055-Signs-allow-color-codes.patch similarity index 94% rename from patches/server/0056-Signs-allow-color-codes.patch rename to patches/server/0055-Signs-allow-color-codes.patch index 5f6babdd9..87041de69 100644 --- a/patches/server/0056-Signs-allow-color-codes.patch +++ b/patches/server/0055-Signs-allow-color-codes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Signs allow color codes diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 2ff7e6e576..34e7415a8c 100644 +index 2738194fc..eaca7b445 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1269,6 +1269,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1245,6 +1245,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void openSign(TileEntitySign tileentitysign) { tileentitysign.a((EntityHuman) this); this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition())); @@ -17,10 +17,10 @@ index 2ff7e6e576..34e7415a8c 100644 public int nextContainerCounter() { // CraftBukkit - void -> int diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 4cd07ab08a..5d31b56184 100644 +index a01b80327..c9798d775 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2716,6 +2716,14 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2711,6 +2711,14 @@ public class PlayerConnection implements PacketListenerPlayIn { } } // Paper end @@ -36,7 +36,7 @@ index 4cd07ab08a..5d31b56184 100644 } SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index e1ab299756..1778c5474f 100644 +index 316766970..db81ee600 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java @@ -1,6 +1,14 @@ @@ -77,7 +77,7 @@ index e1ab299756..1778c5474f 100644 @Override public PacketPlayOutTileEntityData getUpdatePacket() { diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 227436226c..21a2c0c434 100644 +index 227436226..21a2c0c43 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -102,9 +102,12 @@ public class PurpurWorldConfig { diff --git a/patches/server/0057-Allow-soil-to-moisten-from-water-directly-under-it.patch b/patches/server/0056-Allow-soil-to-moisten-from-water-directly-under-it.patch similarity index 100% rename from patches/server/0057-Allow-soil-to-moisten-from-water-directly-under-it.patch rename to patches/server/0056-Allow-soil-to-moisten-from-water-directly-under-it.patch diff --git a/patches/server/0058-Controllable-Minecarts.patch b/patches/server/0057-Controllable-Minecarts.patch similarity index 89% rename from patches/server/0058-Controllable-Minecarts.patch rename to patches/server/0057-Controllable-Minecarts.patch index 6c1c0d0f7..b26927f39 100644 --- a/patches/server/0058-Controllable-Minecarts.patch +++ b/patches/server/0057-Controllable-Minecarts.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Controllable Minecarts diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 7bdefff433..a90ade6897 100644 +index 2291135ea..bc61aaff6 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -35,6 +35,12 @@ public class BlockPosition extends BaseBlockPosition { +@@ -36,6 +36,12 @@ public class BlockPosition extends BaseBlockPosition { private static final int m = 38; // Paper end @@ -22,27 +22,27 @@ index 7bdefff433..a90ade6897 100644 super(i, j, k); } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 85899e385a..efb997bcf3 100644 +index 5e9849a46..f7c969764 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -98,9 +98,9 @@ public abstract class EntityLiving extends Entity { - protected int aV; protected int getKillCount() { return this.aV; } // Paper - OBFHELPER + protected int aO;protected int getKillCount() { return this.aO; } // Paper - OBFHELPER public float lastDamage; public boolean jumping; // Paper protected -> public -- public float aY; -- public float aZ; -- public float ba; -+ public float aY; public float getStrafe() { return aY; } public void setStrafe(float strafe) { aY = strafe; } // Purpur - OBFHELPER -+ public float aZ; public float getVertical() { return aZ; } public void setVertical(float vertical) { aZ = vertical; } // Purpur - OBFHELPER -+ public float ba; public float getForward() { return ba; } public void setForward(float forward) { ba = forward; } // Purpur - OBFHELPER - protected int bb; - protected double bc; - protected double bd; +- public float aR; +- public float aS; +- public float aT; ++ public float aR; public float getStrafe() { return aR; } public void setStrafe(float strafe) { aR = strafe; } // Purpur - OBFHELPER ++ public float aS; public float getVertical() { return aS; } public void setVertical(float vertical) { aS = vertical; } // Purpur - OBFHELPER ++ public float aT; public float getForward() { return aT; } public void setForward(float forward) { aT = forward; } // Purpur - OBFHELPER + protected int aU; + protected double aV; + protected double aW; diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index 6e038905ea..cdbe1a32e0 100644 +index 13fcb666e..d5e129678 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -432,12 +432,50 @@ public abstract class EntityMinecartAbstract extends Entity { +@@ -445,12 +445,50 @@ public abstract class EntityMinecartAbstract extends Entity { public void a(int i, int j, int k, boolean flag) {} @@ -94,7 +94,7 @@ index 6e038905ea..cdbe1a32e0 100644 this.setMot(new Vec3D(this.getMot().x * this.derailedX, this.getMot().y * this.derailedY, this.getMot().z * this.derailedZ)); // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java -index dc7decb060..0da16c2006 100644 +index ceef7aaf9..002651aaf 100644 --- a/src/main/java/net/minecraft/server/ItemMinecart.java +++ b/src/main/java/net/minecraft/server/ItemMinecart.java @@ -103,8 +103,10 @@ public class ItemMinecart extends Item { @@ -119,7 +119,7 @@ index dc7decb060..0da16c2006 100644 } } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 70e504ff30..276131adc7 100644 +index 70e504ff3..276131adc 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -1,5 +1,7 @@ diff --git a/patches/server/0059-Disable-loot-drops-on-death-by-cramming.patch b/patches/server/0058-Disable-loot-drops-on-death-by-cramming.patch similarity index 95% rename from patches/server/0059-Disable-loot-drops-on-death-by-cramming.patch rename to patches/server/0058-Disable-loot-drops-on-death-by-cramming.patch index 6e8ea4701..07ab926a0 100644 --- a/patches/server/0059-Disable-loot-drops-on-death-by-cramming.patch +++ b/patches/server/0058-Disable-loot-drops-on-death-by-cramming.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable loot drops on death by cramming diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 419108acb..08ca21201 100644 +index f7c969764..618faae95 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1483,8 +1483,10 @@ public abstract class EntityLiving extends Entity { +@@ -1484,8 +1484,10 @@ public abstract class EntityLiving extends Entity { this.dropInventory(); // CraftBukkit - from below if (this.cV() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { diff --git a/patches/server/0060-Players-should-not-cram-to-death.patch b/patches/server/0059-Players-should-not-cram-to-death.patch similarity index 90% rename from patches/server/0060-Players-should-not-cram-to-death.patch rename to patches/server/0059-Players-should-not-cram-to-death.patch index c4c44410a..d00e1cee7 100644 --- a/patches/server/0060-Players-should-not-cram-to-death.patch +++ b/patches/server/0059-Players-should-not-cram-to-death.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Players should not cram to death diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 3ccfc969f..4f8042a48 100644 +index eaca7b445..869ba9679 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1243,7 +1243,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1219,7 +1219,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @Override public boolean isInvulnerable(DamageSource damagesource) { diff --git a/patches/server/0061-Option-to-toggle-milk-curing-bad-omen.patch b/patches/server/0060-Option-to-toggle-milk-curing-bad-omen.patch similarity index 100% rename from patches/server/0061-Option-to-toggle-milk-curing-bad-omen.patch rename to patches/server/0060-Option-to-toggle-milk-curing-bad-omen.patch diff --git a/patches/server/0062-End-gateway-should-check-if-entity-can-use-portal.patch b/patches/server/0061-End-gateway-should-check-if-entity-can-use-portal.patch similarity index 86% rename from patches/server/0062-End-gateway-should-check-if-entity-can-use-portal.patch rename to patches/server/0061-End-gateway-should-check-if-entity-can-use-portal.patch index d5aa4ba47..92cc3d3ed 100644 --- a/patches/server/0062-End-gateway-should-check-if-entity-can-use-portal.patch +++ b/patches/server/0061-End-gateway-should-check-if-entity-can-use-portal.patch @@ -5,12 +5,12 @@ Subject: [PATCH] End gateway should check if entity can use portal diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -index 89537dec8..ea3930d89 100644 +index 5d158e723..3752fd610 100644 --- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java +++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -@@ -122,6 +122,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick +@@ -127,6 +127,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick - public void a(Entity entity) { + public void b(Entity entity) { if (this.world instanceof WorldServer && !this.f()) { + if (!entity.canPortal()) return; // Purpur this.c = 100; diff --git a/patches/server/0063-Debug-stick-should-not-update-neighbors.patch b/patches/server/0062-Debug-stick-should-not-update-neighbors.patch similarity index 96% rename from patches/server/0063-Debug-stick-should-not-update-neighbors.patch rename to patches/server/0062-Debug-stick-should-not-update-neighbors.patch index 3f5af5a41..d6cc18d16 100644 --- a/patches/server/0063-Debug-stick-should-not-update-neighbors.patch +++ b/patches/server/0062-Debug-stick-should-not-update-neighbors.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Debug stick should not update neighbors diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 3c56053e3..092b4d3c2 100644 +index ace50805b..76cc28517 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -229,6 +229,11 @@ public final class ItemStack { diff --git a/patches/server/0064-Fix-reloading-paper.yml.patch b/patches/server/0063-Fix-reloading-paper.yml.patch similarity index 97% rename from patches/server/0064-Fix-reloading-paper.yml.patch rename to patches/server/0063-Fix-reloading-paper.yml.patch index c6d044bda..707f2a158 100644 --- a/patches/server/0064-Fix-reloading-paper.yml.patch +++ b/patches/server/0063-Fix-reloading-paper.yml.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix reloading paper.yml diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index e471e7649..09fda504d 100644 +index d5a1ade21..fedea8106 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -20,7 +20,7 @@ public class PaperWorldConfig { diff --git a/patches/server/0065-Fix-the-dead-lagging-the-server.patch b/patches/server/0064-Fix-the-dead-lagging-the-server.patch similarity index 77% rename from patches/server/0065-Fix-the-dead-lagging-the-server.patch rename to patches/server/0064-Fix-the-dead-lagging-the-server.patch index 3ca1510d7..fdd2f5fe0 100644 --- a/patches/server/0065-Fix-the-dead-lagging-the-server.patch +++ b/patches/server/0064-Fix-the-dead-lagging-the-server.patch @@ -5,23 +5,22 @@ Subject: [PATCH] Fix the dead lagging the server diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 884f4a0ab..f55b30255 100644 +index 5fc69bc95..179e470fe 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1523,7 +1523,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1500,6 +1500,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.pitch = MathHelper.a(f1, -90.0F, 90.0F) % 360.0F; this.lastYaw = this.yaw; this.lastPitch = this.pitch; -- if (valid) world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit // Paper + if (valid && !dead) world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit // Paper // Purpur } - public void c(Vec3D vec3d) { + public void f(double d0, double d1, double d2) { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 08ca21201..cb8aaceb1 100644 +index 618faae95..51b2aa3e2 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2465,7 +2465,7 @@ public abstract class EntityLiving extends Entity { +@@ -2466,7 +2466,7 @@ public abstract class EntityLiving extends Entity { } } diff --git a/patches/server/0066-Skip-events-if-there-s-no-listeners.patch b/patches/server/0065-Skip-events-if-there-s-no-listeners.patch similarity index 90% rename from patches/server/0066-Skip-events-if-there-s-no-listeners.patch rename to patches/server/0065-Skip-events-if-there-s-no-listeners.patch index 6f8cb3a19..db8fda7b9 100644 --- a/patches/server/0066-Skip-events-if-there-s-no-listeners.patch +++ b/patches/server/0065-Skip-events-if-there-s-no-listeners.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Skip events if there's no listeners diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index e59151d01..4ace0e79c 100644 +index 22d748008..cabce1a8b 100644 --- a/src/main/java/net/minecraft/server/CommandDispatcher.java +++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -275,6 +275,7 @@ public class CommandDispatcher { +@@ -277,6 +277,7 @@ public class CommandDispatcher { } private void runSync(EntityPlayer entityplayer, Collection bukkit, RootCommandNode rootcommandnode) { @@ -16,7 +16,7 @@ index e59151d01..4ace0e79c 100644 // Paper end - Async command map building new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent(entityplayer.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper PlayerCommandSendEvent event = new PlayerCommandSendEvent(entityplayer.getBukkitEntity(), new LinkedHashSet<>(bukkit)); -@@ -287,6 +288,7 @@ public class CommandDispatcher { +@@ -289,6 +290,7 @@ public class CommandDispatcher { } } // CraftBukkit end diff --git a/patches/server/0067-Add-permission-for-F3-N-debug.patch b/patches/server/0066-Add-permission-for-F3-N-debug.patch similarity index 89% rename from patches/server/0067-Add-permission-for-F3-N-debug.patch rename to patches/server/0066-Add-permission-for-F3-N-debug.patch index e523a2a48..3863a0c31 100644 --- a/patches/server/0067-Add-permission-for-F3-N-debug.patch +++ b/patches/server/0066-Add-permission-for-F3-N-debug.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add permission for F3+N debug diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 42e7511e0..05d3edd09 100644 +index 75b0565df..8c66471ad 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1044,6 +1044,7 @@ public abstract class PlayerList { +@@ -1057,6 +1057,7 @@ public abstract class PlayerList { } else { b0 = (byte) (24 + i); } diff --git a/patches/server/0068-Add-wither-skeleton-takes-wither-damage-option.patch b/patches/server/0067-Add-wither-skeleton-takes-wither-damage-option.patch similarity index 98% rename from patches/server/0068-Add-wither-skeleton-takes-wither-damage-option.patch rename to patches/server/0067-Add-wither-skeleton-takes-wither-damage-option.patch index 4cbe09ff6..4ac2b3ab3 100644 --- a/patches/server/0068-Add-wither-skeleton-takes-wither-damage-option.patch +++ b/patches/server/0067-Add-wither-skeleton-takes-wither-damage-option.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add wither skeleton takes wither damage option diff --git a/src/main/java/net/minecraft/server/EntitySkeletonWither.java b/src/main/java/net/minecraft/server/EntitySkeletonWither.java -index 1819432e1..f415775ea 100644 +index 1ae9910fe..c872be77a 100644 --- a/src/main/java/net/minecraft/server/EntitySkeletonWither.java +++ b/src/main/java/net/minecraft/server/EntitySkeletonWither.java @@ -97,6 +97,6 @@ public class EntitySkeletonWither extends EntitySkeletonAbstract { diff --git a/patches/server/0069-Configurable-TPS-Catchup.patch b/patches/server/0068-Configurable-TPS-Catchup.patch similarity index 93% rename from patches/server/0069-Configurable-TPS-Catchup.patch rename to patches/server/0068-Configurable-TPS-Catchup.patch index c965ef8ba..254e48663 100644 --- a/patches/server/0069-Configurable-TPS-Catchup.patch +++ b/patches/server/0068-Configurable-TPS-Catchup.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable TPS Catchup diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 14ca25adae..1bc1909754 100644 +index eee7356d5..89f422524 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1003,7 +1003,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0 && !this.z()) { diff --git a/patches/server/0071-Add-enderman-and-creeper-griefing-controls.patch b/patches/server/0070-Add-enderman-and-creeper-griefing-controls.patch similarity index 84% rename from patches/server/0071-Add-enderman-and-creeper-griefing-controls.patch rename to patches/server/0070-Add-enderman-and-creeper-griefing-controls.patch index 84963991b..a1b7b3359 100644 --- a/patches/server/0071-Add-enderman-and-creeper-griefing-controls.patch +++ b/patches/server/0070-Add-enderman-and-creeper-griefing-controls.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add enderman and creeper griefing controls diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java -index e8008e3c2..2d5aab9e2 100644 +index 8338afa7c..013639cc9 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -215,7 +215,7 @@ public class EntityCreeper extends EntityMonster { @@ -18,10 +18,10 @@ index e8008e3c2..2d5aab9e2 100644 // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index b61de3351..245fc38de 100644 +index 03176e83a..b45a75a45 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -370,6 +370,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -369,6 +369,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { @Override public boolean a() { @@ -29,7 +29,16 @@ index b61de3351..245fc38de 100644 return this.enderman.getCarried() != null ? false : (!this.enderman.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? false : this.enderman.getRandom().nextInt(20) == 0); } -@@ -413,6 +414,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -402,7 +403,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { + + static class PathfinderGoalEndermanPlaceBlock extends PathfinderGoal { + +- private final EntityEnderman a; ++ private final EntityEnderman a; public EntityEnderman getEnderman() { return a; } // Purpur - OBFHELPER + + public PathfinderGoalEndermanPlaceBlock(EntityEnderman entityenderman) { + this.a = entityenderman; +@@ -410,6 +411,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { @Override public boolean a() { diff --git a/patches/server/0072-Entities-pick-up-loot-bypass-mob-griefing-gamerule.patch b/patches/server/0071-Entities-pick-up-loot-bypass-mob-griefing-gamerule.patch similarity index 98% rename from patches/server/0072-Entities-pick-up-loot-bypass-mob-griefing-gamerule.patch rename to patches/server/0071-Entities-pick-up-loot-bypass-mob-griefing-gamerule.patch index 342e39748..98f888f04 100644 --- a/patches/server/0072-Entities-pick-up-loot-bypass-mob-griefing-gamerule.patch +++ b/patches/server/0071-Entities-pick-up-loot-bypass-mob-griefing-gamerule.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entities pick up loot bypass mob-griefing gamerule diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 93714e5d9..b23674625 100644 +index b7fcade36..fc2ac5fb8 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -542,7 +542,7 @@ public abstract class EntityInsentient extends EntityLiving { diff --git a/patches/server/0073-Villagers-farming-can-bypass-mob-griefing-gamerule.patch b/patches/server/0072-Villagers-farming-can-bypass-mob-griefing-gamerule.patch similarity index 100% rename from patches/server/0073-Villagers-farming-can-bypass-mob-griefing-gamerule.patch rename to patches/server/0072-Villagers-farming-can-bypass-mob-griefing-gamerule.patch diff --git a/patches/server/0074-Villagers-follow-emerald-blocks.patch b/patches/server/0073-Villagers-follow-emerald-blocks.patch similarity index 97% rename from patches/server/0074-Villagers-follow-emerald-blocks.patch rename to patches/server/0073-Villagers-follow-emerald-blocks.patch index a17902cbb..8cb719b09 100644 --- a/patches/server/0074-Villagers-follow-emerald-blocks.patch +++ b/patches/server/0073-Villagers-follow-emerald-blocks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Villagers follow emerald blocks diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 7925c8991..3e10ee440 100644 +index f880a38bf..1fbba526c 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -74,6 +74,13 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -23,7 +23,7 @@ index 7925c8991..3e10ee440 100644 public BehaviorController getBehaviorController() { return (BehaviorController) super.getBehaviorController(); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -index beb84a2ab..a3b4a59fd 100644 +index ced893452..a96533e0c 100644 --- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java @@ -14,6 +14,8 @@ import org.bukkit.event.entity.VillagerAcquireTradeEvent; @@ -36,7 +36,7 @@ index beb84a2ab..a3b4a59fd 100644 private CraftMerchant craftMerchant; diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java -index a0841cfaf..ab5e97e39 100644 +index f1a509063..74c2d89af 100644 --- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java +++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java @@ -40,6 +40,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { diff --git a/patches/server/0075-Allow-leashing-villagers.patch b/patches/server/0074-Allow-leashing-villagers.patch similarity index 94% rename from patches/server/0075-Allow-leashing-villagers.patch rename to patches/server/0074-Allow-leashing-villagers.patch index 04b96c085..e966474ef 100644 --- a/patches/server/0075-Allow-leashing-villagers.patch +++ b/patches/server/0074-Allow-leashing-villagers.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow leashing villagers diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index b23674625..744552fda 100644 +index fc2ac5fb8..c87c95160 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -1129,6 +1129,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1138,6 +1138,7 @@ public abstract class EntityInsentient extends EntityLiving { if (!this.isAlive()) { return EnumInteractionResult.PASS; } else if (this.getLeashHolder() == entityhuman) { @@ -17,7 +17,7 @@ index b23674625..744552fda 100644 if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) { ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(this, this.getLeashHolder())); diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 3e10ee440..97eb26482 100644 +index 1fbba526c..ff23ca2a1 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -79,6 +79,11 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -33,7 +33,7 @@ index 3e10ee440..97eb26482 100644 @Override diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java -index ab5e97e39..9985afb12 100644 +index 74c2d89af..96dda6a14 100644 --- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java +++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java @@ -47,6 +47,13 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { @@ -49,7 +49,7 @@ index ab5e97e39..9985afb12 100644 + @Nullable @Override - public EntityAgeable createChild(EntityAgeable entityageable) { + public EntityAgeable createChild(WorldServer worldserver, EntityAgeable entityageable) { diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index 26a760bc3..665eac22f 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java diff --git a/patches/server/0076-Implement-configurable-search-radius-for-villagers-t.patch b/patches/server/0075-Implement-configurable-search-radius-for-villagers-t.patch similarity index 93% rename from patches/server/0076-Implement-configurable-search-radius-for-villagers-t.patch rename to patches/server/0075-Implement-configurable-search-radius-for-villagers-t.patch index 183ed417f..1967bcbbc 100644 --- a/patches/server/0076-Implement-configurable-search-radius-for-villagers-t.patch +++ b/patches/server/0075-Implement-configurable-search-radius-for-villagers-t.patch @@ -6,13 +6,13 @@ Subject: [PATCH] Implement configurable search radius for villagers to spawn diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 97eb26482..86de40d15 100644 +index ff23ca2a1..71644c3d9 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -904,6 +904,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -892,6 +892,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @Nullable - private EntityIronGolem fw() { + private EntityIronGolem d(WorldServer worldserver) { + if (world.purpurConfig.villagerSpawnIronGolemRadius > 0 && world.a(EntityIronGolem.class, getBoundingBox().grow(world.purpurConfig.villagerSpawnIronGolemRadius)).size() > world.purpurConfig.villagerSpawnIronGolemLimit) return null; // Purpur BlockPosition blockposition = this.getChunkCoordinates(); diff --git a/patches/server/0077-Implement-infinite-lava.patch b/patches/server/0076-Implement-infinite-lava.patch similarity index 100% rename from patches/server/0077-Implement-infinite-lava.patch rename to patches/server/0076-Implement-infinite-lava.patch diff --git a/patches/server/0078-Make-lava-flow-speed-configurable.patch b/patches/server/0077-Make-lava-flow-speed-configurable.patch similarity index 100% rename from patches/server/0078-Make-lava-flow-speed-configurable.patch rename to patches/server/0077-Make-lava-flow-speed-configurable.patch diff --git a/patches/server/0079-Add-player-death-exp-control-options.patch b/patches/server/0078-Add-player-death-exp-control-options.patch similarity index 96% rename from patches/server/0079-Add-player-death-exp-control-options.patch rename to patches/server/0078-Add-player-death-exp-control-options.patch index 7b53a1c82..2b31e6745 100644 --- a/patches/server/0079-Add-player-death-exp-control-options.patch +++ b/patches/server/0078-Add-player-death-exp-control-options.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add player death exp control options diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index a69a69859..ea4144371 100644 +index eb62555cb..48f9feaea 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -85,6 +85,8 @@ public abstract class EntityHuman extends EntityLiving { @@ -17,7 +17,7 @@ index a69a69859..ea4144371 100644 public void setAfk(boolean setAfk){ } -@@ -1713,9 +1715,18 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1716,9 +1718,18 @@ public abstract class EntityHuman extends EntityLiving { @Override protected int getExpValue(EntityHuman entityhuman) { if (!this.world.getGameRules().getBoolean(GameRules.KEEP_INVENTORY) && !this.isSpectator()) { diff --git a/patches/server/0080-Add-option-to-disable-saving-projectiles-to-disk.patch b/patches/server/0079-Add-option-to-disable-saving-projectiles-to-disk.patch similarity index 95% rename from patches/server/0080-Add-option-to-disable-saving-projectiles-to-disk.patch rename to patches/server/0079-Add-option-to-disable-saving-projectiles-to-disk.patch index 601e0306f..6b00daa37 100644 --- a/patches/server/0080-Add-option-to-disable-saving-projectiles-to-disk.patch +++ b/patches/server/0079-Add-option-to-disable-saving-projectiles-to-disk.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option to disable saving projectiles to disk diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 742c59cb0..2b2471072 100644 +index e74d21048..21bd84a73 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -475,6 +475,7 @@ public class ChunkRegionLoader { @@ -17,10 +17,10 @@ index 742c59cb0..2b2471072 100644 // Paper start if (asyncsavedata == null && !entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f55b30255..115421ea7 100644 +index 179e470fe..f3e9c8460 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -311,6 +311,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -308,6 +308,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.headHeight = this.getHeadHeight(EntityPose.STANDING, this.size); } @@ -34,7 +34,7 @@ index f55b30255..115421ea7 100644 return false; } diff --git a/src/main/java/net/minecraft/server/EntityEnderSignal.java b/src/main/java/net/minecraft/server/EntityEnderSignal.java -index 84bf27299..82a5aaf5b 100644 +index 6e5b46077..49d328aaa 100644 --- a/src/main/java/net/minecraft/server/EntityEnderSignal.java +++ b/src/main/java/net/minecraft/server/EntityEnderSignal.java @@ -19,9 +19,16 @@ public class EntityEnderSignal extends Entity { @@ -56,7 +56,7 @@ index 84bf27299..82a5aaf5b 100644 })); } diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java -index 6e175e30a..f538189ae 100644 +index 9f5ce64a6..0bac6b050 100644 --- a/src/main/java/net/minecraft/server/IProjectile.java +++ b/src/main/java/net/minecraft/server/IProjectile.java @@ -18,6 +18,13 @@ public abstract class IProjectile extends Entity { diff --git a/patches/server/0081-Configurable-void-damage-height.patch b/patches/server/0080-Configurable-void-damage-height.patch similarity index 94% rename from patches/server/0081-Configurable-void-damage-height.patch rename to patches/server/0080-Configurable-void-damage-height.patch index 469190885..e6ef14b1b 100644 --- a/patches/server/0081-Configurable-void-damage-height.patch +++ b/patches/server/0080-Configurable-void-damage-height.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable void damage height diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 115421ea7..145e0a716 100644 +index f3e9c8460..40fad381e 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -534,7 +534,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -611,7 +611,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke // Paper start protected void performVoidDamage() { @@ -16,7 +16,7 @@ index 115421ea7..145e0a716 100644 + if (this.locY() < world.purpurConfig.voidDamageHeight || (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER // Purpur && world.paperConfig.doNetherTopVoidDamage() && this.locY() >= world.paperConfig.netherVoidTopDamageHeight)) { - + this.doVoidDamage(); diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index 6ac786206..a071129db 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java diff --git a/patches/server/0082-Add-option-for-zombies-targetting-turtle-eggs.patch b/patches/server/0081-Add-option-for-zombies-targetting-turtle-eggs.patch similarity index 98% rename from patches/server/0082-Add-option-for-zombies-targetting-turtle-eggs.patch rename to patches/server/0081-Add-option-for-zombies-targetting-turtle-eggs.patch index c558c2ee4..f3277bc07 100644 --- a/patches/server/0082-Add-option-for-zombies-targetting-turtle-eggs.patch +++ b/patches/server/0081-Add-option-for-zombies-targetting-turtle-eggs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option for zombies targetting turtle eggs diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index b66059836..00b89746f 100644 +index 039c5f438..cb7d61937 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -46,7 +46,7 @@ public class EntityZombie extends EntityMonster { diff --git a/patches/server/0083-Dispenser-curse-of-binding-protection.patch b/patches/server/0082-Dispenser-curse-of-binding-protection.patch similarity index 97% rename from patches/server/0083-Dispenser-curse-of-binding-protection.patch rename to patches/server/0082-Dispenser-curse-of-binding-protection.patch index 88101c90d..b5f10339a 100644 --- a/patches/server/0083-Dispenser-curse-of-binding-protection.patch +++ b/patches/server/0082-Dispenser-curse-of-binding-protection.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Dispenser curse of binding protection diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 744552fda..8def5fbfb 100644 +index c87c95160..10735e8bd 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -985,6 +985,13 @@ public abstract class EntityInsentient extends EntityLiving { @@ -23,7 +23,7 @@ index 744552fda..8def5fbfb 100644 Item item = itemstack.getItem(); diff --git a/src/main/java/net/minecraft/server/ItemArmor.java b/src/main/java/net/minecraft/server/ItemArmor.java -index 885458d54..c7d67d729 100644 +index 669a50411..7cd2e871b 100644 --- a/src/main/java/net/minecraft/server/ItemArmor.java +++ b/src/main/java/net/minecraft/server/ItemArmor.java @@ -35,7 +35,7 @@ public class ItemArmor extends Item implements ItemWearable { diff --git a/patches/server/0084-Add-option-for-boats-to-eject-players-on-land.patch b/patches/server/0083-Add-option-for-boats-to-eject-players-on-land.patch similarity index 94% rename from patches/server/0084-Add-option-for-boats-to-eject-players-on-land.patch rename to patches/server/0083-Add-option-for-boats-to-eject-players-on-land.patch index 83ef8eaf3..b8c4824c6 100644 --- a/patches/server/0084-Add-option-for-boats-to-eject-players-on-land.patch +++ b/patches/server/0083-Add-option-for-boats-to-eject-players-on-land.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Add option for boats to eject players on land diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index 409e0ac0a..a20d6feb8 100644 +index 7df2837d6..0f25d7cd6 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -433,6 +433,7 @@ public class EntityBoat extends Entity { +@@ -440,6 +440,7 @@ public class EntityBoat extends Entity { if (f > 0.0F) { - this.aD = f; + this.aw = f; + if (world.purpurConfig.boatEjectPlayersOnLand) ejectPassengers(); // Purpur return EntityBoat.EnumStatus.ON_LAND; } else { diff --git a/patches/server/0085-Add-obfhelpers-for-plugin-use.patch b/patches/server/0084-Add-obfhelpers-for-plugin-use.patch similarity index 95% rename from patches/server/0085-Add-obfhelpers-for-plugin-use.patch rename to patches/server/0084-Add-obfhelpers-for-plugin-use.patch index 978f33e4e..47cf63bfc 100644 --- a/patches/server/0085-Add-obfhelpers-for-plugin-use.patch +++ b/patches/server/0084-Add-obfhelpers-for-plugin-use.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add obfhelpers for plugin use diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 092b4d3c2..c246942ce 100644 +index 76cc28517..0d548dae6 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -644,6 +644,7 @@ public final class ItemStack { diff --git a/patches/server/0086-Mending-mends-most-damages-equipment-first.patch b/patches/server/0085-Mending-mends-most-damages-equipment-first.patch similarity index 95% rename from patches/server/0086-Mending-mends-most-damages-equipment-first.patch rename to patches/server/0085-Mending-mends-most-damages-equipment-first.patch index 264d4a97b..52d4dd6bf 100644 --- a/patches/server/0086-Mending-mends-most-damages-equipment-first.patch +++ b/patches/server/0085-Mending-mends-most-damages-equipment-first.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Mending mends most damages equipment first diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java -index 7a4768c32c..b3e03e5c09 100644 +index b6b0460de..2bf518f41 100644 --- a/src/main/java/net/minecraft/server/EnchantmentManager.java +++ b/src/main/java/net/minecraft/server/EnchantmentManager.java @@ -251,7 +251,30 @@ public class EnchantmentManager { @@ -41,12 +41,12 @@ index 7a4768c32c..b3e03e5c09 100644 return a(enchantment, entityliving, (itemstack) -> { return true; diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index f01a8743ab..1b53fd43bb 100644 +index e33a42dcd..e053f9c37 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java @@ -220,7 +220,7 @@ public class EntityExperienceOrb extends Entity { - if (this.d == 0 && entityhuman.bB == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - entityhuman.bB = 2; + if (this.d == 0 && entityhuman.bu == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper + entityhuman.bu = 2; entityhuman.receive(this, 1); - Entry entry = EnchantmentManager.a(Enchantments.MENDING, (EntityLiving) entityhuman, ItemStack::f); + Entry entry = world.purpurConfig.useBetterMending ? EnchantmentManager.getMostDamagedEquipment(Enchantments.MENDING, entityhuman) : EnchantmentManager.a(Enchantments.MENDING, entityhuman, ItemStack::isDamaged); // Purpur @@ -54,7 +54,7 @@ index f01a8743ab..1b53fd43bb 100644 if (entry != null) { ItemStack itemstack = (ItemStack) entry.getValue(); diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index c246942ce8..d40c7ce09c 100644 +index 0d548dae6..f5b970525 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -418,10 +418,19 @@ public final class ItemStack { @@ -78,7 +78,7 @@ index c246942ce8..d40c7ce09c 100644 return this.tag == null ? 0 : this.tag.getInt("Damage"); } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 15e2d9dd0f..993ad17eca 100644 +index 15e2d9dd0..993ad17ec 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -110,6 +110,7 @@ public class PurpurWorldConfig { diff --git a/patches/server/0087-Implement-bamboo-growth-settings.patch b/patches/server/0086-Implement-bamboo-growth-settings.patch similarity index 91% rename from patches/server/0087-Implement-bamboo-growth-settings.patch rename to patches/server/0086-Implement-bamboo-growth-settings.patch index cadafa2d1..0bb525396 100644 --- a/patches/server/0087-Implement-bamboo-growth-settings.patch +++ b/patches/server/0086-Implement-bamboo-growth-settings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement bamboo growth settings diff --git a/src/main/java/net/minecraft/server/BlockBamboo.java b/src/main/java/net/minecraft/server/BlockBamboo.java -index 14790c167..bac1b8b30 100644 +index f208ab509..ce56edb7c 100644 --- a/src/main/java/net/minecraft/server/BlockBamboo.java +++ b/src/main/java/net/minecraft/server/BlockBamboo.java -@@ -97,7 +97,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -99,7 +99,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { if (random.nextInt(Math.max(1, (int) (100.0F / worldserver.spigotConfig.bambooModifier) * 3)) == 0 && worldserver.isEmpty(blockposition.up()) && worldserver.getLightLevel(blockposition.up(), 0) >= 9) { // Spigot int i = this.b(worldserver, blockposition) + 1; @@ -17,7 +17,7 @@ index 14790c167..bac1b8b30 100644 this.a(iblockdata, (World) worldserver, blockposition, random, i); } } -@@ -128,7 +128,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -130,7 +130,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { int i = this.a(iblockaccess, blockposition); int j = this.b(iblockaccess, blockposition); @@ -26,7 +26,7 @@ index 14790c167..bac1b8b30 100644 } @Override -@@ -147,7 +147,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -149,7 +149,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { BlockPosition blockposition1 = blockposition.up(i); IBlockData iblockdata1 = worldserver.getType(blockposition1); @@ -35,7 +35,7 @@ index 14790c167..bac1b8b30 100644 return; } -@@ -188,7 +188,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -190,7 +190,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { } int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && !iblockdata2.a(Blocks.BAMBOO) ? 0 : 1; @@ -44,7 +44,7 @@ index 14790c167..bac1b8b30 100644 // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.d, j)).set(BlockBamboo.e, blockpropertybamboosize)).set(BlockBamboo.f, k), 3)) { -@@ -203,7 +203,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -205,7 +205,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { protected int a(IBlockAccess iblockaccess, BlockPosition blockposition) { int i; @@ -53,7 +53,7 @@ index 14790c167..bac1b8b30 100644 ; } -@@ -213,7 +213,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -215,7 +215,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { protected int b(IBlockAccess iblockaccess, BlockPosition blockposition) { int i; diff --git a/patches/server/0088-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0087-Climbing-should-not-bypass-cramming-gamerule.patch similarity index 88% rename from patches/server/0088-Climbing-should-not-bypass-cramming-gamerule.patch rename to patches/server/0087-Climbing-should-not-bypass-cramming-gamerule.patch index 0184de8fd..11524b1b8 100644 --- a/patches/server/0088-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0087-Climbing-should-not-bypass-cramming-gamerule.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 145e0a716..9b69073f9 100644 +index 40fad381e..db7ac28da 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1703,6 +1703,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1691,6 +1691,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } public boolean isCollidable() { @@ -22,10 +22,10 @@ index 145e0a716..9b69073f9 100644 } diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 7543f2cee..c3cde1568 100644 +index eb32abc5d..6a505b3b0 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -318,7 +318,7 @@ public class EntityArmorStand extends EntityLiving { +@@ -320,7 +320,7 @@ public class EntityArmorStand extends EntityLiving { } @Override @@ -35,7 +35,7 @@ index 7543f2cee..c3cde1568 100644 } diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java -index 3dd3b8913..99bae2dcb 100644 +index a726dd676..b84aa1db8 100644 --- a/src/main/java/net/minecraft/server/EntityBat.java +++ b/src/main/java/net/minecraft/server/EntityBat.java @@ -50,7 +50,7 @@ public class EntityBat extends EntityAmbient { @@ -48,10 +48,10 @@ index 3dd3b8913..99bae2dcb 100644 } diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index a20d6feb8..92c1d1794 100644 +index 0f25d7cd6..5887b7a26 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -104,7 +104,7 @@ public class EntityBoat extends Entity { +@@ -106,7 +106,7 @@ public class EntityBoat extends Entity { } @Override @@ -61,7 +61,7 @@ index a20d6feb8..92c1d1794 100644 } diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -index ee7a2fedd..c9ab80ccd 100644 +index da79c7e63..8cfbf8abf 100644 --- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java +++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java @@ -165,7 +165,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven @@ -74,10 +74,10 @@ index ee7a2fedd..c9ab80ccd 100644 } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index cb8aaceb1..e360844cc 100644 +index 51b2aa3e2..9398fa680 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2851,7 +2851,7 @@ public abstract class EntityLiving extends Entity { +@@ -2854,7 +2854,7 @@ public abstract class EntityLiving extends Entity { // Paper - end don't run getEntities if we're not going to use its result // Tuinity start - reduce memory allocation from collideNearby List list = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList(); @@ -86,22 +86,22 @@ index cb8aaceb1..e360844cc 100644 try { // Tuinity end - reduce memory allocation from collideNearby -@@ -2995,8 +2995,8 @@ public abstract class EntityLiving extends Entity { +@@ -2998,8 +2998,8 @@ public abstract class EntityLiving extends Entity { } @Override - public boolean isCollidable() { -- return this.isAlive() && !this.isClimbing() && this.collides; // CraftBukkit +- return this.isAlive() && !this.isSpectator() && !this.isClimbing() && this.collides; // CraftBukkit + public boolean isCollidable(boolean ignoreClimbing) { // Purpur -+ return this.isAlive() && (ignoreClimbing || !isClimbing()) && this.collides; // CraftBukkit // Purpur ++ return this.isAlive() && !this.isSpectator() && (ignoreClimbing || !this.isClimbing()) && this.collides; // CraftBukkit // Purpur } // CraftBukkit start - collidable API diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index cdbe1a32e..c33b5c950 100644 +index d5e129678..5e64ca8a0 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -108,7 +108,7 @@ public abstract class EntityMinecartAbstract extends Entity { +@@ -107,7 +107,7 @@ public abstract class EntityMinecartAbstract extends Entity { } @Override @@ -111,7 +111,7 @@ index cdbe1a32e..c33b5c950 100644 } diff --git a/src/main/java/net/minecraft/server/EntityParrot.java b/src/main/java/net/minecraft/server/EntityParrot.java -index 2172fcefb..7afdb3060 100644 +index 34e08dda2..6bb73f869 100644 --- a/src/main/java/net/minecraft/server/EntityParrot.java +++ b/src/main/java/net/minecraft/server/EntityParrot.java @@ -314,8 +314,8 @@ public class EntityParrot extends EntityPerchable implements EntityBird { @@ -126,10 +126,10 @@ index 2172fcefb..7afdb3060 100644 @Override diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index f483076e1..ef6ac7929 100644 +index 869ba9679..10c9905c5 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1805,8 +1805,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1771,8 +1771,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } @Override @@ -141,7 +141,7 @@ index f483076e1..ef6ac7929 100644 // Purpur end diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 9b4795f3b..192d9798c 100644 +index 939535cb2..70eb26304 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -45,11 +45,17 @@ public final class IEntitySelector { diff --git a/patches/server/0089-Add-5-second-tps-average-in-tps.patch b/patches/server/0088-Add-5-second-tps-average-in-tps.patch similarity index 93% rename from patches/server/0089-Add-5-second-tps-average-in-tps.patch rename to patches/server/0088-Add-5-second-tps-average-in-tps.patch index a55e336be..bb033afdd 100644 --- a/patches/server/0089-Add-5-second-tps-average-in-tps.patch +++ b/patches/server/0088-Add-5-second-tps-average-in-tps.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add 5 second tps average in /tps diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1bc1909754..14c645b68b 100644 +index 89f422524..781621126 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -165,7 +165,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { + // Purpur start + int damage = world.purpurConfig.elytraDamagePerSecond; @@ -46,7 +46,7 @@ index 885c03f62..3a33ad181 100644 itemstack.subtract(1); } else ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index d40c7ce09..9b6b85809 100644 +index f5b970525..58c2ab659 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -450,7 +450,7 @@ public final class ItemStack { @@ -72,7 +72,7 @@ index d40c7ce09..9b6b85809 100644 if (this.count == 1 && t0 instanceof EntityHuman) { org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((EntityHuman) t0, this); diff --git a/src/main/java/net/minecraft/server/ItemTrident.java b/src/main/java/net/minecraft/server/ItemTrident.java -index 32982bb47..a0e4d46ab 100644 +index 3663b7017..18f767dc5 100644 --- a/src/main/java/net/minecraft/server/ItemTrident.java +++ b/src/main/java/net/minecraft/server/ItemTrident.java @@ -102,6 +102,16 @@ public class ItemTrident extends Item implements ItemVanishable { @@ -82,14 +82,14 @@ index 32982bb47..a0e4d46ab 100644 + + // Purpur start + ItemStack chestItem = entityhuman.getEquipment(EnumItemSlot.CHEST); -+ if (chestItem.getItem() == Items.ELYTRA) { -+ if (world.purpurConfig.elytraDamagePerTridentBoost > 0) { -+ chestItem.damage(world.purpurConfig.elytraDamagePerTridentBoost, entityhuman, (entity) -> entity.broadcastItemBreak(EnumItemSlot.CHEST)); -+ } ++ if (chestItem.getItem() == Items.ELYTRA && world.purpurConfig.elytraDamagePerTridentBoost > 0) { ++ chestItem.damage(world.purpurConfig.elytraDamagePerTridentBoost, entityhuman, (entity) -> { ++ entity.broadcastItemBreak(EnumItemSlot.CHEST); ++ }); + } + // Purpur end + - entityhuman.h((double) f2, (double) f3, (double) f4); + entityhuman.i((double) f2, (double) f3, (double) f4); entityhuman.r(20); if (entityhuman.isOnGround()) { diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java diff --git a/patches/server/0091-Add-item-entity-options.patch b/patches/server/0090-Add-item-entity-options.patch similarity index 92% rename from patches/server/0091-Add-item-entity-options.patch rename to patches/server/0090-Add-item-entity-options.patch index 1ed6ee2e3..d80e3bdcd 100644 --- a/patches/server/0091-Add-item-entity-options.patch +++ b/patches/server/0090-Add-item-entity-options.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add item entity options diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9b69073f9..ee35d5950 100644 +index db7ac28da..7be48b0b7 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1462,6 +1462,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1449,6 +1449,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } @@ -17,10 +17,10 @@ index 9b69073f9..ee35d5950 100644 return this.O == tag; } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index a7860cb4d..77e970c30 100644 +index e1372620f..d22021cfb 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -258,7 +258,7 @@ public class EntityItem extends Entity { +@@ -263,7 +263,7 @@ public class EntityItem extends Entity { @Override public boolean isFireProof() { @@ -29,7 +29,7 @@ index a7860cb4d..77e970c30 100644 } @Override -@@ -269,6 +269,8 @@ public class EntityItem extends Entity { +@@ -274,6 +274,8 @@ public class EntityItem extends Entity { return false; } else if (!this.getItemStack().getItem().a(damagesource)) { return false; diff --git a/patches/server/0092-Add-ping-command.patch b/patches/server/0091-Add-ping-command.patch similarity index 94% rename from patches/server/0092-Add-ping-command.patch rename to patches/server/0091-Add-ping-command.patch index 24fdea2ae..0433a9079 100644 --- a/patches/server/0092-Add-ping-command.patch +++ b/patches/server/0091-Add-ping-command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add /ping command diff --git a/src/main/java/net/minecraft/server/ArgumentEntity.java b/src/main/java/net/minecraft/server/ArgumentEntity.java -index 1194f91a51..9141976d1d 100644 +index 1194f91a5..9141976d1 100644 --- a/src/main/java/net/minecraft/server/ArgumentEntity.java +++ b/src/main/java/net/minecraft/server/ArgumentEntity.java @@ -69,10 +69,12 @@ public class ArgumentEntity implements ArgumentType { @@ -22,10 +22,10 @@ index 1194f91a51..9141976d1d 100644 List list = ((EntitySelector) commandcontext.getArgument(s, EntitySelector.class)).d((CommandListenerWrapper) commandcontext.getSource()); diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index 4ace0e79c9..5e004f0635 100644 +index cabce1a8b..e4f45d1b7 100644 --- a/src/main/java/net/minecraft/server/CommandDispatcher.java +++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -28,7 +28,7 @@ import org.bukkit.event.server.ServerCommandEvent; +@@ -30,7 +30,7 @@ import org.bukkit.event.server.ServerCommandEvent; public class CommandDispatcher { private static final Logger LOGGER = LogManager.getLogger(); @@ -34,7 +34,7 @@ index 4ace0e79c9..5e004f0635 100644 public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype) { this(); // CraftBukkit -@@ -105,6 +105,7 @@ public class CommandDispatcher { +@@ -107,6 +107,7 @@ public class CommandDispatcher { CommandIdleTimeout.a(this.b); CommandStop.a(this.b); CommandWhitelist.a(this.b); @@ -42,7 +42,7 @@ index 4ace0e79c9..5e004f0635 100644 } if (commanddispatcher_servertype.d) { -@@ -335,10 +336,12 @@ public class CommandDispatcher { +@@ -337,10 +338,12 @@ public class CommandDispatcher { } @@ -56,10 +56,10 @@ index 4ace0e79c9..5e004f0635 100644 return RequiredArgumentBuilder.argument(s, argumenttype); } diff --git a/src/main/java/net/minecraft/server/CommandListenerWrapper.java b/src/main/java/net/minecraft/server/CommandListenerWrapper.java -index a4995ddc82..e0cbe1a571 100644 +index 90b0cf647..6f43dfc10 100644 --- a/src/main/java/net/minecraft/server/CommandListenerWrapper.java +++ b/src/main/java/net/minecraft/server/CommandListenerWrapper.java -@@ -182,6 +182,7 @@ public class CommandListenerWrapper implements ICompletionProvider, com.destroys +@@ -189,6 +189,7 @@ public class CommandListenerWrapper implements ICompletionProvider, com.destroys } } @@ -68,7 +68,7 @@ index a4995ddc82..e0cbe1a571 100644 if (!(this.k instanceof EntityPlayer)) { throw CommandListenerWrapper.a.create(); diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index a49807916d..10fdbf4967 100644 +index a49807916..10fdbf496 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java @@ -133,10 +133,12 @@ public class PurpurConfig { @@ -86,7 +86,7 @@ index a49807916d..10fdbf4967 100644 public static String serverModName = "Purpur"; diff --git a/src/main/java/net/pl3x/purpur/command/PingCommand.java b/src/main/java/net/pl3x/purpur/command/PingCommand.java new file mode 100644 -index 0000000000..f36e655cb8 +index 000000000..f36e655cb --- /dev/null +++ b/src/main/java/net/pl3x/purpur/command/PingCommand.java @@ -0,0 +1,37 @@ diff --git a/patches/server/0093-Configurable-jockey-options.patch b/patches/server/0092-Configurable-jockey-options.patch similarity index 86% rename from patches/server/0093-Configurable-jockey-options.patch rename to patches/server/0092-Configurable-jockey-options.patch index 426b1eed3..f295e0edf 100644 --- a/patches/server/0093-Configurable-jockey-options.patch +++ b/patches/server/0092-Configurable-jockey-options.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable jockey options diff --git a/src/main/java/net/minecraft/server/EntityDrowned.java b/src/main/java/net/minecraft/server/EntityDrowned.java -index e6425bdf1a..6fc8d1213a 100644 +index ea7934060..6853ba319 100644 --- a/src/main/java/net/minecraft/server/EntityDrowned.java +++ b/src/main/java/net/minecraft/server/EntityDrowned.java -@@ -19,6 +19,23 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { +@@ -21,6 +21,23 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { this.navigationLand = new Navigation(this, world); } @@ -33,7 +33,7 @@ index e6425bdf1a..6fc8d1213a 100644 protected void m() { this.goalSelector.a(1, new EntityDrowned.c(this, 1.0D)); diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java -index a69c3897c2..fdd13b2ba6 100644 +index 96a8abb18..194b76059 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -21,6 +21,23 @@ public class EntityPigZombie extends EntityZombie implements IEntityAngerable { @@ -59,9 +59,9 @@ index a69c3897c2..fdd13b2ba6 100644 + @Override public void setAngerTarget(@Nullable UUID uuid) { - this.by = uuid; + this.br = uuid; diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 661111e502..d8fb6afa6a 100644 +index cb7d61937..1ea68f617 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -3,6 +3,7 @@ package net.minecraft.server; @@ -93,7 +93,7 @@ index 661111e502..d8fb6afa6a 100644 @Override protected void initPathfinder() { if (world.purpurConfig.zombieTargetTurtleEggs) this.goalSelector.a(4, new EntityZombie.a(this, 1.0D, 3)); // Purpur -@@ -459,19 +474,20 @@ public class EntityZombie extends EntityMonster { +@@ -439,19 +454,19 @@ public class EntityZombie extends EntityMonster { if (object instanceof EntityZombie.GroupDataZombie) { EntityZombie.GroupDataZombie entityzombie_groupdatazombie = (EntityZombie.GroupDataZombie) object; @@ -103,11 +103,10 @@ index 661111e502..d8fb6afa6a 100644 + if (!jockeyOnlyBaby() || entityzombie_groupdatazombie.isBaby()) { + this.setBaby(entityzombie_groupdatazombie.isBaby()); if (entityzombie_groupdatazombie.b) { -- if ((double) generatoraccess.getRandom().nextFloat() < 0.05D) { -- List list = generatoraccess.a(EntityChicken.class, this.getBoundingBox().grow(5.0D, 3.0D, 5.0D), IEntitySelector.c); -+ if ((double) generatoraccess.getRandom().nextFloat() < jockeyChance()) { -+ List list = jockeyTryExistingChickens() ? generatoraccess.a(EntityChicken.class, this.getBoundingBox().grow(5.0D, 3.0D, 5.0D), IEntitySelector.c) : Collections.emptyList(); -+ // Purpur end +- if ((double) worldaccess.getRandom().nextFloat() < 0.05D) { +- List list = worldaccess.a(EntityChicken.class, this.getBoundingBox().grow(5.0D, 3.0D, 5.0D), IEntitySelector.c); ++ if ((double) worldaccess.getRandom().nextFloat() < jockeyChance()) { ++ List list = jockeyTryExistingChickens() ? worldaccess.a(EntityChicken.class, this.getBoundingBox().grow(5.0D, 3.0D, 5.0D), IEntitySelector.c) : Collections.emptyList(); if (!list.isEmpty()) { EntityChicken entitychicken = (EntityChicken) list.get(0); @@ -115,20 +114,20 @@ index 661111e502..d8fb6afa6a 100644 entitychicken.setChickenJockey(true); this.startRiding(entitychicken); - } -- } else if ((double) generatoraccess.getRandom().nextFloat() < 0.05D) { +- } else if ((double) worldaccess.getRandom().nextFloat() < 0.05D) { + } else { // Purpur EntityChicken entitychicken1 = (EntityChicken) EntityTypes.CHICKEN.a(this.world); entitychicken1.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F); -@@ -479,6 +495,7 @@ public class EntityZombie extends EntityMonster { +@@ -459,6 +474,7 @@ public class EntityZombie extends EntityMonster { entitychicken1.setChickenJockey(true); this.startRiding(entitychicken1); - generatoraccess.addEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit + worldaccess.addEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit + } // Purpur } } } -@@ -581,7 +598,7 @@ public class EntityZombie extends EntityMonster { +@@ -561,7 +577,7 @@ public class EntityZombie extends EntityMonster { public static class GroupDataZombie implements GroupDataEntity { @@ -138,7 +137,7 @@ index 661111e502..d8fb6afa6a 100644 public GroupDataZombie(boolean flag, boolean flag1) { diff --git a/src/main/java/net/minecraft/server/EntityZombieHusk.java b/src/main/java/net/minecraft/server/EntityZombieHusk.java -index 143b9123e0..2daff85620 100644 +index 2d2830adc..ce6d79780 100644 --- a/src/main/java/net/minecraft/server/EntityZombieHusk.java +++ b/src/main/java/net/minecraft/server/EntityZombieHusk.java @@ -8,6 +8,23 @@ public class EntityZombieHusk extends EntityZombie { @@ -162,14 +161,14 @@ index 143b9123e0..2daff85620 100644 + } + // Purpur end + - public static boolean b(EntityTypes entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) { - return c(entitytypes, generatoraccess, enummobspawn, blockposition, random) && (enummobspawn == EnumMobSpawn.SPAWNER || generatoraccess.f(blockposition)); + public static boolean a(EntityTypes entitytypes, WorldAccess worldaccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) { + return b(entitytypes, worldaccess, enummobspawn, blockposition, random) && (enummobspawn == EnumMobSpawn.SPAWNER || worldaccess.e(blockposition)); } diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java -index 9b920332bd..cd796f5b86 100644 +index b52b8d0d8..69e98dceb 100644 --- a/src/main/java/net/minecraft/server/EntityZombieVillager.java +++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java -@@ -27,6 +27,23 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo +@@ -28,6 +28,23 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo this.setVillagerData(this.getVillagerData().withProfession((VillagerProfession) IRegistry.VILLAGER_PROFESSION.a(this.random))); } @@ -194,7 +193,7 @@ index 9b920332bd..cd796f5b86 100644 protected void initDatawatcher() { super.initDatawatcher(); diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 9de7246862..3e067c832f 100644 +index 9de724686..3e067c832 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -258,6 +258,15 @@ public class PurpurWorldConfig { diff --git a/patches/server/0094-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch b/patches/server/0093-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch similarity index 97% rename from patches/server/0094-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch rename to patches/server/0093-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch index 86e8200c5..c69aeddbb 100644 --- a/patches/server/0094-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch +++ b/patches/server/0093-Phantoms-attracted-to-crystals-and-crystals-shoot-ph.patch @@ -17,18 +17,18 @@ index 6fe5678cf..bd0267ee4 100644 return (new EntityDamageSourceIndirect("indirectMagic", entity, entity1)).setIgnoreArmor().setMagic(); } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ee35d5950..2d4981631 100644 +index 7be48b0b7..bf17d9daf 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1579,6 +1579,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1567,6 +1567,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return d3 * d3 + d4 * d4 + d5 * d5; } + public double getDistanceSq(Entity entity) { return this.h(entity); } // Purpur - OBFHELPER public double h(Entity entity) { - return this.d(entity.getPositionVector()); + return this.e(entity.getPositionVector()); } -@@ -2106,8 +2107,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2094,8 +2095,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return this.a(new ItemStack(imaterial), (float) i); } @@ -40,7 +40,7 @@ index ee35d5950..2d4981631 100644 } diff --git a/src/main/java/net/minecraft/server/EntityEnderCrystal.java b/src/main/java/net/minecraft/server/EntityEnderCrystal.java -index 21dfe7f42..71a440d69 100644 +index faa82f652..f726a3585 100644 --- a/src/main/java/net/minecraft/server/EntityEnderCrystal.java +++ b/src/main/java/net/minecraft/server/EntityEnderCrystal.java @@ -13,6 +13,12 @@ public class EntityEnderCrystal extends Entity { @@ -108,7 +108,7 @@ index 21dfe7f42..71a440d69 100644 @Override protected void saveData(NBTTagCompound nbttagcompound) { diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java -index 3cb78924d..ec09ec241 100644 +index 550f80bfd..b3616185d 100644 --- a/src/main/java/net/minecraft/server/EntityPhantom.java +++ b/src/main/java/net/minecraft/server/EntityPhantom.java @@ -9,9 +9,10 @@ import javax.annotation.Nullable; @@ -117,10 +117,10 @@ index 3cb78924d..ec09ec241 100644 private static final DataWatcherObject b = DataWatcher.a(EntityPhantom.class, DataWatcherRegistry.b); - private Vec3D c; - private BlockPosition d; -- private EntityPhantom.AttackPhase bv; +- private EntityPhantom.AttackPhase bo; + private Vec3D c; public void setHomeOffset(Vec3D offset) { this.c = offset; } public Vec3D getHomeOffset() { return this.c; } // Purpur - OBFHELPER + private BlockPosition d; public void setHome(BlockPosition home) { this.d = home; } public BlockPosition getHome() { return this.d; } // Purpur - OBFHELPER -+ private EntityPhantom.AttackPhase bv; public AttackPhase getAttackPhase() { return this.bv; } // Purpur - OBFHELPER ++ private EntityPhantom.AttackPhase bo; public AttackPhase getAttackPhase() { return this.bo; } // Purpur - OBFHELPER + private Vec3D crystalPosition; // Purpur public EntityPhantom(EntityTypes entitytypes, World world) { diff --git a/patches/server/0095-Customizable-EnderDragon-Health.patch b/patches/server/0094-Customizable-EnderDragon-Health.patch similarity index 95% rename from patches/server/0095-Customizable-EnderDragon-Health.patch rename to patches/server/0094-Customizable-EnderDragon-Health.patch index b9e31d08a..5585f359e 100644 --- a/patches/server/0095-Customizable-EnderDragon-Health.patch +++ b/patches/server/0094-Customizable-EnderDragon-Health.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Customizable EnderDragon Health diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 08fa5a975..47d71a166 100644 +index 0e74794d3..d617b5345 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -62,6 +62,16 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - this.bN = new DragonControllerManager(this); + this.bG = new DragonControllerManager(this); } + // Purpur start diff --git a/patches/server/0097-Add-phantom-spawning-options.patch b/patches/server/0095-Add-phantom-spawning-options.patch similarity index 95% rename from patches/server/0097-Add-phantom-spawning-options.patch rename to patches/server/0095-Add-phantom-spawning-options.patch index c2c240231..df51d2859 100644 --- a/patches/server/0097-Add-phantom-spawning-options.patch +++ b/patches/server/0095-Add-phantom-spawning-options.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add phantom spawning options diff --git a/src/main/java/net/minecraft/server/DifficultyDamageScaler.java b/src/main/java/net/minecraft/server/DifficultyDamageScaler.java -index 75745af343..84c0ec1b50 100644 +index 75745af34..84c0ec1b5 100644 --- a/src/main/java/net/minecraft/server/DifficultyDamageScaler.java +++ b/src/main/java/net/minecraft/server/DifficultyDamageScaler.java @@ -13,6 +13,7 @@ public class DifficultyDamageScaler { @@ -25,7 +25,7 @@ index 75745af343..84c0ec1b50 100644 return this.b > f; } diff --git a/src/main/java/net/minecraft/server/EnumDifficulty.java b/src/main/java/net/minecraft/server/EnumDifficulty.java -index e0e72779c0..386eae71a1 100644 +index e0e72779c..386eae71a 100644 --- a/src/main/java/net/minecraft/server/EnumDifficulty.java +++ b/src/main/java/net/minecraft/server/EnumDifficulty.java @@ -19,6 +19,7 @@ public enum EnumDifficulty { @@ -37,19 +37,19 @@ index e0e72779c0..386eae71a1 100644 return this.f; } diff --git a/src/main/java/net/minecraft/server/IBlockLightAccess.java b/src/main/java/net/minecraft/server/IBlockLightAccess.java -index 3f187f3494..c678e6fe96 100644 +index 5d5fe1412..6d9181cd6 100644 --- a/src/main/java/net/minecraft/server/IBlockLightAccess.java +++ b/src/main/java/net/minecraft/server/IBlockLightAccess.java @@ -12,6 +12,7 @@ public interface IBlockLightAccess extends IBlockAccess { return this.e().b(blockposition, i); } -+ default boolean isSkyVisible(BlockPosition blockposition) { return f(blockposition); } // Purpur - OBFHELPER - default boolean f(BlockPosition blockposition) { - return this.getBrightness(EnumSkyBlock.SKY, blockposition) >= this.H(); ++ default boolean isSkyVisible(BlockPosition blockposition) { return e(blockposition); } // Purpur - OBFHELPER + default boolean e(BlockPosition blockposition) { + return this.getBrightness(EnumSkyBlock.SKY, blockposition) >= this.J(); } diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -index bf4fa17101..ac1ea2f0c1 100644 +index 4e3f01bc7..ac1ea2f0c 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java @@ -1,85 +1,99 @@ @@ -104,7 +104,7 @@ index bf4fa17101..ac1ea2f0c1 100644 - if (!entityhuman.isSpectator() && (!worldserver.paperConfig.phantomIgnoreCreative || !entityhuman.isCreative())) { // Paper - BlockPosition blockposition = entityhuman.getChunkCoordinates(); - -- if (!worldserver.getDimensionManager().hasSkyLight() || blockposition.getY() >= worldserver.getSeaLevel() && worldserver.f(blockposition)) { +- if (!worldserver.getDimensionManager().hasSkyLight() || blockposition.getY() >= worldserver.getSeaLevel() && worldserver.e(blockposition)) { - DifficultyDamageScaler difficultydamagescaler = worldserver.getDamageScaler(blockposition); - - if (difficultydamagescaler.a(random.nextFloat() * 3.0F)) { @@ -135,7 +135,7 @@ index bf4fa17101..ac1ea2f0c1 100644 - entityphantom.spawningEntity = entityhuman.uniqueID; // Paper - entityphantom.setPositionRotation(blockposition1, 0.0F, 0.0F); - groupdataentity = entityphantom.prepare(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); -- worldserver.addEntity(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit +- worldserver.addAllEntities(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit - } - - i += k; @@ -221,22 +221,22 @@ index bf4fa17101..ac1ea2f0c1 100644 } } diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 0a25523f3c..e8637244ce 100644 +index beaea041d..ce8834980 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -385,6 +385,7 @@ public final class SpawnerCreature { +@@ -386,6 +386,7 @@ public final class SpawnerCreature { return new BlockPosition(i, l, j); } + public static boolean canSpawn(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata, Fluid fluid, EntityTypes entitytypes) { return a(iblockaccess, blockposition, iblockdata, fluid, entitytypes); } // Purpur - OBFHELPER - public static boolean a(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata, Fluid fluid, EntityTypes entitytypes) { + public static boolean a(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata, Fluid fluid, EntityTypes entitytypes) { return iblockdata.r(iblockaccess, blockposition) ? false : (iblockdata.isPowerSource() ? false : (!fluid.isEmpty() ? false : (iblockdata.a((Tag) TagsBlock.PREVENT_MOB_SPAWNING_INSIDE) ? false : !entitytypes.a(iblockdata)))); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 54a6a37c81..a22b78a655 100644 +index e91e5c766..489ae5459 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1500,6 +1500,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1430,6 +1430,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return new DifficultyDamageScaler(this.getDifficulty(), this.getDayTime(), i, f); } @@ -245,7 +245,7 @@ index 54a6a37c81..a22b78a655 100644 public int c() { return this.d; diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index e6b41ab924..80d772e021 100644 +index e6b41ab92..80d772e02 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -329,10 +329,34 @@ public class PurpurWorldConfig { diff --git a/patches/server/0098-Implement-bed-explosion-options.patch b/patches/server/0096-Implement-bed-explosion-options.patch similarity index 98% rename from patches/server/0098-Implement-bed-explosion-options.patch rename to patches/server/0096-Implement-bed-explosion-options.patch index e34264c7e..fc5106449 100644 --- a/patches/server/0098-Implement-bed-explosion-options.patch +++ b/patches/server/0096-Implement-bed-explosion-options.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement bed explosion options diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java -index e7bd9061c..aeffefa4e 100644 +index d28c1a67e..c37225202 100644 --- a/src/main/java/net/minecraft/server/BlockBed.java +++ b/src/main/java/net/minecraft/server/BlockBed.java @@ -88,7 +88,7 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { diff --git a/patches/server/0096-Make-natural-spawns-per-biome-configurable.patch b/patches/server/0096-Make-natural-spawns-per-biome-configurable.patch deleted file mode 100644 index e75cb1fbd..000000000 --- a/patches/server/0096-Make-natural-spawns-per-biome-configurable.patch +++ /dev/null @@ -1,1163 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Thu, 2 Jul 2020 21:48:06 -0500 -Subject: [PATCH] Make natural spawns per biome configurable - - -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index 52ebdfcc0..9259ba1af 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -25,6 +25,23 @@ import org.apache.logging.log4j.Logger; - - public class BiomeBase { - -+ // Purpur start -+ protected static org.bukkit.configuration.file.YamlConfiguration biomeData; -+ -+ static { -+ String filename = "biomes.yml"; -+ java.io.File file = new java.io.File(filename); -+ if (!file.exists()) { -+ try { -+ java.nio.file.Files.copy(BiomeBase.class.getResourceAsStream("/" + filename), file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); -+ } catch (Exception e) { -+ MinecraftServer.LOGGER.error("Unable to save biomes.yml!", e); -+ } -+ } -+ biomeData = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(file); -+ } -+ // Purpur end -+ - public static final Logger LOGGER = LogManager.getLogger(); - // Paper decompile error - Spigots stupid decompiler - public static final Codec b = RecordCodecBuilder.create(i -> { -@@ -69,7 +86,7 @@ public class BiomeBase { - protected final Map>> r; - protected final List> s = Lists.newArrayList(); - private final Map, StructureFeature> u; -- private final Map> v; -+ private final Map> v; protected Map> getSpawnData() { return v; } // Purpur - OBFHELPER - private final Map, BiomeBase.e> w = Maps.newHashMap(); - private final List x; - private final ThreadLocal y = ThreadLocal.withInitial(() -> { -@@ -187,7 +204,7 @@ public class BiomeBase { - } - - protected void a(EnumCreatureType enumcreaturetype, BiomeBase.BiomeMeta biomebase_biomemeta) { -- ((List) this.v.get(enumcreaturetype)).add(biomebase_biomemeta); -+ //((List) this.v.get(type)).add(meta); // Purpur - don't auto register mobs - } - - protected void a(EntityTypes entitytypes, double d0, double d1) { -diff --git a/src/main/java/net/minecraft/server/Biomes.java b/src/main/java/net/minecraft/server/Biomes.java -index eaa527f4f..d39b19f79 100644 ---- a/src/main/java/net/minecraft/server/Biomes.java -+++ b/src/main/java/net/minecraft/server/Biomes.java -@@ -91,6 +91,35 @@ public abstract class Biomes { - BiomeBase.reg.a(biomebase, IRegistry.BIOME.a(IRegistry.BIOME.get(new MinecraftKey(biomebase.l)))); - } - -+ // Purpur start -+ org.bukkit.configuration.ConfigurationSection section = BiomeBase.biomeData.getConfigurationSection(s + ".spawn-data"); -+ if (section != null) { -+ for (String entity : section.getKeys(false)) { -+ EntityTypes type = EntityTypes.getType(entity).orElse(null); -+ if (type == null) { -+ MinecraftServer.LOGGER.error("Unknown entity type in biomes.yml for " + s + "." + entity); -+ continue; -+ } -+ String raw = section.getString(entity); -+ if (raw == null || raw.isEmpty()) { -+ continue; -+ } -+ int weight, min, max; -+ try { -+ String[] split = raw.trim().replace(" ", "").split(","); -+ weight = Integer.parseInt(split[0]); -+ min = Integer.parseInt(split[1]); -+ max = Integer.parseInt(split[2]); -+ } catch (Exception e) { -+ MinecraftServer.LOGGER.error("Error parsing data in biomes.yml for " + s + "." + entity, e); -+ continue; -+ } -+ biomebase.getSpawnData().get(type.getEnumCreatureType()) -+ .add(new BiomeBase.BiomeMeta(type, weight, min, max)); -+ } -+ } -+ // Purpur end -+ - return biomebase; - } - -diff --git a/src/main/resources/biomes.yml b/src/main/resources/biomes.yml -new file mode 100644 -index 000000000..ff48801c3 ---- /dev/null -+++ b/src/main/resources/biomes.yml -@@ -0,0 +1,1065 @@ -+ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 5,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 1,1,4 -+ cod: 10,3,6 -+ dolphin: 1,1,2 -+plains: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ horse: 5,2,6 -+ donkey: 1,1,3 -+ bat: 10,8,8 -+desert: -+ spawn-data: -+ spider: 100,4,4 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ zombie: 19,4,4 -+ zombie_villager: 1,1,1 -+ husk: 80,4,4 -+ rabbit: 4,2,3 -+ bat: 10,8,8 -+mountains: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ llama: 5,4,6 -+ bat: 10,8,8 -+forest: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 5,4,4 -+ bat: 10,8,8 -+taiga: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+swamp: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 1,1,1 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+river: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 100,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 2,1,4 -+ salmon: 5,1,5 -+nether_wastes: -+ spawn-data: -+ ghast: 50,4,4 -+ zombified_piglin: 100,4,4 -+ magma_cube: 2,4,4 -+ enderman: 1,4,4 -+ piglin: 15,4,4 -+ strider: 60,1,2 -+the_end: -+ spawn-data: -+ enderman: 10,4,4 -+frozen_ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 5,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ polar_bear: 1,1,2 -+ bat: 10,8,8 -+ squid: 1,1,4 -+ salmon: 15,1,5 -+frozen_river: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 1,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 2,1,4 -+ salmon: 5,1,5 -+snowy_tundra: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ skeleton: 20,4,4 -+ stray: 80,4,4 -+ rabbit: 10,2,3 -+ polar_bear: 1,1,2 -+ bat: 10,8,8 -+snowy_mountains: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ skeleton: 20,4,4 -+ stray: 80,4,4 -+ rabbit: 10,2,3 -+ polar_bear: 1,1,2 -+ bat: 10,8,8 -+mushroom_fields: -+ spawn-data: -+ mooshroom: 8,4,8 -+ bat: 10,8,8 -+mushroom_field_shore: -+ spawn-data: -+ mooshroom: 8,4,8 -+ bat: 10,8,8 -+beach: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ turtle: 5,2,5 -+ bat: 10,8,8 -+desert_hills: -+ spawn-data: -+ spider: 100,4,4 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ zombie: 19,4,4 -+ zombie_villager: 1,1,1 -+ husk: 80,4,4 -+ rabbit: 4,2,3 -+ bat: 10,8,8 -+wooded_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 5,4,4 -+ bat: 10,8,8 -+taiga_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+mountain_edge: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ llama: 5,4,6 -+ bat: 10,8,8 -+jungle: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ ocelot: 2,1,3 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ parrot: 40,1,2 -+ panda: 1,1,2 -+ bat: 10,8,8 -+jungle_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ ocelot: 2,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ parrot: 10,1,1 -+ panda: 1,1,2 -+ bat: 10,8,8 -+jungle_edge: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+deep_ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 5,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 1,1,4 -+ cod: 10,3,6 -+ dolphin: 1,1,2 -+stone_shore: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+snowy_beach: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+birch_forest: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+birch_forest_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+dark_forest: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+snowy_taiga: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+snowy_taiga_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+giant_tree_taiga: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 100,4,4 -+ skeleton: 100,4,4 -+ zombie_villager: 25,1,1 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+giant_tree_taiga_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 100,4,4 -+ skeleton: 100,4,4 -+ zombie_villager: 25,1,1 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+wooded_mountains: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ llama: 5,4,6 -+ bat: 10,8,8 -+savanna: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ horse: 1,2,6 -+ donkey: 1,1,1 -+ bat: 10,8,8 -+savanna_plateau: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ horse: 1,2,6 -+ donkey: 1,1,1 -+ llama: 8,4,4 -+ bat: 10,8,8 -+badlands: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+wooded_badlands_plateau: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+badlands_plateau: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+small_end_islands: -+ spawn-data: -+ enderman: 10,4,4 -+end_midlands: -+ spawn-data: -+ enderman: 10,4,4 -+end_highlands: -+ spawn-data: -+ enderman: 10,4,4 -+end_barrens: -+ spawn-data: -+ enderman: 10,4,4 -+warm_ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 10,4,4 -+ pufferfish: 15,1,3 -+ tropical_fish: 25,8,8 -+ dolphin: 2,1,2 -+lukewarm_ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 5,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 10,1,2 -+ cod: 15,3,6 -+ pufferfish: 5,1,3 -+ tropical_fish: 25,8,8 -+ dolphin: 2,1,2 -+cold_ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 5,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 3,1,4 -+ cod: 15,3,6 -+ salmon: 15,1,5 -+deep_warm_ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 5,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 5,1,4 -+ tropical_fish: 25,8,8 -+ dolphin: 2,1,2 -+deep_lukewarm_ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 5,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 8,1,4 -+ cod: 8,3,6 -+ pufferfish: 5,1,3 -+ tropical_fish: 25,8,8 -+ dolphin: 2,1,2 -+deep_cold_ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 5,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+ squid: 3,1,4 -+ cod: 15,3,6 -+ salmon: 15,1,5 -+deep_frozen_ocean: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ drowned: 5,1,1 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ polar_bear: 1,1,2 -+ bat: 10,8,8 -+ squid: 1,1,4 -+ salmon: 15,1,5 -+sunflower_plains: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ horse: 5,2,6 -+ donkey: 1,1,3 -+ bat: 10,8,8 -+desert_lakes: -+ spawn-data: -+ spider: 100,4,4 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ zombie: 19,4,4 -+ zombie_villager: 1,1,1 -+ husk: 80,4,4 -+ rabbit: 4,2,3 -+ bat: 10,8,8 -+gravelly_mountains: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ llama: 5,4,6 -+ bat: 10,8,8 -+flower_forest: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ rabbit: 4,2,3 -+ bat: 10,8,8 -+taiga_mountains: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+swamp_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 1,1,1 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+ice_spikes: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ skeleton: 20,4,4 -+ stray: 80,4,4 -+ rabbit: 10,2,3 -+ polar_bear: 1,1,2 -+ bat: 10,8,8 -+modified_jungle: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ ocelot: 2,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ parrot: 10,1,1 -+ bat: 10,8,8 -+modified_jungle_edge: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+tall_birch_forest: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+tall_birch_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+dark_forest_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ bat: 10,8,8 -+snowy_taiga_mountains: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+giant_spruce_taiga: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+giant_spruce_taiga_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ wolf: 8,4,4 -+ rabbit: 4,2,3 -+ fox: 8,2,4 -+ bat: 10,8,8 -+modified_gravelly_mountains: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ llama: 5,4,6 -+ bat: 10,8,8 -+shattered_savanna: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ horse: 1,2,6 -+ donkey: 1,1,1 -+ bat: 10,8,8 -+shattered_savanna_plateau: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ horse: 1,2,6 -+ donkey: 1,1,1 -+ bat: 10,8,8 -+eroded_badlands: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+modified_wooded_badlands_plateau: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+modified_badlands_plateau: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ bat: 10,8,8 -+bamboo_jungle: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ ocelot: 2,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ parrot: 40,1,2 -+ panda: 80,1,2 -+ bat: 10,8,8 -+bamboo_jungle_hills: -+ spawn-data: -+ spider: 100,4,4 -+ zombie: 95,4,4 -+ zombie_villager: 5,1,1 -+ skeleton: 100,4,4 -+ creeper: 100,4,4 -+ slime: 100,4,4 -+ enderman: 10,1,4 -+ witch: 5,1,1 -+ ocelot: 2,1,1 -+ sheep: 12,4,4 -+ pig: 10,4,4 -+ chicken: 10,4,4 -+ cow: 8,4,4 -+ parrot: 10,1,1 -+ panda: 80,1,2 -+ bat: 10,8,8 -+soul_sand_valley: -+ spawn-data: -+ skeleton: 20,5,5 -+ ghast: 50,4,4 -+ enderman: 1,4,4 -+ strider: 60,1,2 -+crimson_forest: -+ spawn-data: -+ zombified_piglin: 1,2,4 -+ hoglin: 9,3,4 -+ piglin: 5,3,4 -+ strider: 60,1,2 -+warped_forest: -+ spawn-data: -+ enderman: 1,4,4 -+ strider: 60,1,2 -+basalt_deltas: -+ spawn-data: -+ ghast: 40,1,1 -+ magma_cube: 100,2,5 -+ strider: 60,1,2 diff --git a/patches/server/0099-Implement-respawn-anchor-explosion-options.patch b/patches/server/0097-Implement-respawn-anchor-explosion-options.patch similarity index 95% rename from patches/server/0099-Implement-respawn-anchor-explosion-options.patch rename to patches/server/0097-Implement-respawn-anchor-explosion-options.patch index 78c129a83..5e95142cf 100644 --- a/patches/server/0099-Implement-respawn-anchor-explosion-options.patch +++ b/patches/server/0097-Implement-respawn-anchor-explosion-options.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement respawn anchor explosion options diff --git a/src/main/java/net/minecraft/server/BlockRespawnAnchor.java b/src/main/java/net/minecraft/server/BlockRespawnAnchor.java -index 56ad9a51d..33f4b8a29 100644 +index 21c5ad83a..521d161a3 100644 --- a/src/main/java/net/minecraft/server/BlockRespawnAnchor.java +++ b/src/main/java/net/minecraft/server/BlockRespawnAnchor.java -@@ -79,10 +79,7 @@ public class BlockRespawnAnchor extends Block { +@@ -83,10 +83,7 @@ public class BlockRespawnAnchor extends Block { private void d(IBlockData iblockdata, World world, final BlockPosition blockposition) { world.a(blockposition, false); @@ -20,7 +20,7 @@ index 56ad9a51d..33f4b8a29 100644 return a(blockposition1, world); }); final boolean flag1 = flag || world.getFluid(blockposition.up()).a((Tag) TagsFluid.WATER); -@@ -98,7 +95,7 @@ public class BlockRespawnAnchor extends Block { +@@ -97,7 +94,7 @@ public class BlockRespawnAnchor extends Block { } }; diff --git a/patches/server/0101-Add-allow-water-in-end-world-option.patch b/patches/server/0098-Add-allow-water-in-end-world-option.patch similarity index 96% rename from patches/server/0101-Add-allow-water-in-end-world-option.patch rename to patches/server/0098-Add-allow-water-in-end-world-option.patch index 74780cdab..01256f6b3 100644 --- a/patches/server/0101-Add-allow-water-in-end-world-option.patch +++ b/patches/server/0098-Add-allow-water-in-end-world-option.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add allow water in end world option diff --git a/src/main/java/net/minecraft/server/BlockIce.java b/src/main/java/net/minecraft/server/BlockIce.java -index aba5c6b871..b75f6ded5d 100644 +index aba5c6b87..b75f6ded5 100644 --- a/src/main/java/net/minecraft/server/BlockIce.java +++ b/src/main/java/net/minecraft/server/BlockIce.java @@ -13,7 +13,7 @@ public class BlockIce extends BlockHalfTransparent { @@ -27,7 +27,7 @@ index aba5c6b871..b75f6ded5d 100644 } else { world.setTypeUpdate(blockposition, Blocks.WATER.getBlockData()); diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java -index 120bf8436f..848a185c04 100644 +index 120bf8436..848a185c0 100644 --- a/src/main/java/net/minecraft/server/ItemBucket.java +++ b/src/main/java/net/minecraft/server/ItemBucket.java @@ -122,7 +122,7 @@ public class ItemBucket extends Item { @@ -49,10 +49,10 @@ index 120bf8436f..848a185c04 100644 return true; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a5079ad349..657d005d29 100644 +index 489ae5459..90b4beba7 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1572,4 +1572,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1505,4 +1505,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public final boolean isDebugWorld() { return this.debugWorld; } @@ -68,7 +68,7 @@ index a5079ad349..657d005d29 100644 + // Purpur end } diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index 10fdbf4967..9d5246de95 100644 +index 10fdbf496..9d5246de9 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java @@ -1,7 +1,6 @@ diff --git a/patches/server/0102-MC-171420-Fix-deop-kicking-non-whitelisted-player-wh.patch b/patches/server/0099-MC-171420-Fix-deop-kicking-non-whitelisted-player-wh.patch similarity index 88% rename from patches/server/0102-MC-171420-Fix-deop-kicking-non-whitelisted-player-wh.patch rename to patches/server/0099-MC-171420-Fix-deop-kicking-non-whitelisted-player-wh.patch index 960ba279a..1e94ecdb1 100644 --- a/patches/server/0102-MC-171420-Fix-deop-kicking-non-whitelisted-player-wh.patch +++ b/patches/server/0099-MC-171420-Fix-deop-kicking-non-whitelisted-player-wh.patch @@ -6,11 +6,11 @@ Subject: [PATCH] MC-171420 - Fix deop kicking non-whitelisted player when diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6c0854623..0f800e085 100644 +index 781621126..8a76ed6ae 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1954,6 +1954,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant -Date: Sat, 4 Jul 2020 19:19:13 -0500 -Subject: [PATCH] Fix armorstand entity lookups paper.yml setting not being - used - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d4abe2d9c..ac54b1df1 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -974,13 +974,6 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - } - MinecraftServer.getServer().executeMidTickTasks(); // Tuinity - execute chunk tasks mid tick - } -- // Paper start - Prevent armor stands from doing entity lookups -- @Override -- public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisAlignedBB) { -- if (entity instanceof EntityArmorStand && !entity.world.paperConfig.armorStandEntityLookups) return false; -- return GeneratorAccess.super.getCubes(entity, axisAlignedBB); -- } -- // Paper end - - public Explosion explode(@Nullable Entity entity, double d0, double d1, double d2, float f, Explosion.Effect explosion_effect) { - return this.createExplosion(entity, (DamageSource) null, (ExplosionDamageCalculator) null, d0, d1, d2, f, false, explosion_effect); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index e6ad5a6ab..7c9a3714e 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -688,6 +688,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - - @Override - public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisalignedbb) { -+ if (entity instanceof EntityArmorStand && !entity.world.paperConfig.armorStandEntityLookups) return false; // Paper // Purpur - moved from World - return !this.hasAnyCollisions(entity, axisalignedbb); - } - diff --git a/patches/server/0104-Entity-lifespan.patch b/patches/server/0101-Entity-lifespan.patch similarity index 91% rename from patches/server/0104-Entity-lifespan.patch rename to patches/server/0101-Entity-lifespan.patch index bc480e29a..0e008f576 100644 --- a/patches/server/0104-Entity-lifespan.patch +++ b/patches/server/0101-Entity-lifespan.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Entity lifespan diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 2a60f08530..e276a59203 100644 +index 10735e8bd..7f5095f7e 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -53,7 +53,7 @@ public abstract class EntityInsentient extends EntityLiving { - private NBTTagCompound bF; - private BlockPosition bG; - private float bH; + private NBTTagCompound by; + private BlockPosition bz; + private float bA; - + public int ticksSinceLastInteraction; // Purpur public boolean aware = true; // CraftBukkit @@ -26,7 +26,7 @@ index 2a60f08530..e276a59203 100644 return true; // CraftBukkit end @@ -246,10 +247,35 @@ public abstract class EntityInsentient extends EntityLiving { - this.eJ(); + this.m(); this.F(); } - @@ -37,10 +37,10 @@ index 2a60f08530..e276a59203 100644 + // Purpur start + private void incrementTicksSinceLastInteraction() { + ++ticksSinceLastInteraction; -+ if (hasRider()) { -+ ticksSinceLastInteraction = 0; -+ return; -+ } ++ //if (hasRider()) { ++ // ticksSinceLastInteraction = 0; ++ // return; ++ //} + if (world.purpurConfig.entityLifeSpan <= 0) { + return; // feature disabled + } @@ -61,7 +61,7 @@ index 2a60f08530..e276a59203 100644 + @Override protected void c(DamageSource damagesource) { - this.eJ(); + this.m(); @@ -423,6 +449,7 @@ public abstract class EntityInsentient extends EntityLiving { } @@ -82,7 +82,7 @@ index 2a60f08530..e276a59203 100644 } @Override -@@ -1511,7 +1543,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1535,7 +1567,7 @@ public abstract class EntityInsentient extends EntityLiving { this.a((EntityLiving) this, entity); this.z(entity); } @@ -92,10 +92,10 @@ index 2a60f08530..e276a59203 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0f1b0065d6..194bb355ca 100644 +index 3476e6f5f..c3691ab0c 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2133,6 +2133,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2128,6 +2128,7 @@ public class PlayerConnection implements PacketListenerPlayIn { boolean triggerLeashUpdate = itemInHand != null && itemInHand.getItem() == Items.LEAD && entity instanceof EntityInsentient; Item origItem = this.player.inventory.getItemInHand() == null ? null : this.player.inventory.getItemInHand().getItem(); PlayerInteractEntityEvent event; @@ -104,7 +104,7 @@ index 0f1b0065d6..194bb355ca 100644 event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity(), (packetplayinuseentity.c() == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); } else { diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 2f5bc77e03..4e8a6992ab 100644 +index 2f5bc77e0..4e8a6992a 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -101,6 +101,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0106-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch b/patches/server/0102-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch similarity index 96% rename from patches/server/0106-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch rename to patches/server/0102-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch index 0738b31c4..c48cc90ad 100644 --- a/patches/server/0106-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch +++ b/patches/server/0102-Add-option-to-teleport-to-spawn-if-outside-world-bor.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option to teleport to spawn if outside world border diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index ab64c04919..61df55b8c8 100644 +index a187a16ce..e697f7e4a 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -277,6 +277,13 @@ public abstract class EntityLiving extends Entity { @@ -23,7 +23,7 @@ index ab64c04919..61df55b8c8 100644 } } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 87b8630315..63d4cf5c44 100644 +index 4e8a6992a..19a4593e2 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -180,6 +180,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0107-Squid-EAR-immunity.patch b/patches/server/0103-Squid-EAR-immunity.patch similarity index 76% rename from patches/server/0107-Squid-EAR-immunity.patch rename to patches/server/0103-Squid-EAR-immunity.patch index 98b6efbc9..d824b3211 100644 --- a/patches/server/0107-Squid-EAR-immunity.patch +++ b/patches/server/0103-Squid-EAR-immunity.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Squid EAR immunity diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 63d4cf5c4..f7be1373c 100644 +index 19a4593e2..dff09553b 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -629,6 +629,11 @@ public class PurpurWorldConfig { - spiderRidableInWater = getBoolean("mobs.spider.ridable-in-water", spiderRidableInWater); +@@ -430,6 +430,11 @@ public class PurpurWorldConfig { + snowGolemPutPumpkinBack = getBoolean("mobs.snow_golem.pumpkin-can-be-added-back", snowGolemPutPumpkinBack); } + public boolean squidImmuneToEAR = true; @@ -17,11 +17,11 @@ index 63d4cf5c4..f7be1373c 100644 + squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR); + } + - public boolean strayRidable = false; - public boolean strayRidableInWater = false; - private void straySettings() { + public int villagerBrainTicks = 1; + public boolean villagerUseBrainTicksOnlyWhenLagging = true; + public boolean villagerCanBeLeashed = false; diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index da4c49daf..ab10206d0 100644 +index 89dc611cd..11fbdfad5 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -378,6 +378,7 @@ public class ActivationRange diff --git a/patches/server/0108-Configurable-end-spike-seed.patch b/patches/server/0104-Configurable-end-spike-seed.patch similarity index 72% rename from patches/server/0108-Configurable-end-spike-seed.patch rename to patches/server/0104-Configurable-end-spike-seed.patch index 72378e334..ded623eaf 100644 --- a/patches/server/0108-Configurable-end-spike-seed.patch +++ b/patches/server/0104-Configurable-end-spike-seed.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable end spike seed diff --git a/src/main/java/net/minecraft/server/WorldGenEnder.java b/src/main/java/net/minecraft/server/WorldGenEnder.java -index 495d98e154..9df359d0ba 100644 +index 00a170720..5eb9b3d35 100644 --- a/src/main/java/net/minecraft/server/WorldGenEnder.java +++ b/src/main/java/net/minecraft/server/WorldGenEnder.java @@ -23,12 +23,14 @@ public class WorldGenEnder extends WorldGenerator list = worldgenfeatureendspikeconfiguration.b(); ++ public boolean generate(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEndSpikeConfiguration worldgenfeatureendspikeconfiguration) { return a(generatoraccessseed, chunkgenerator, random, blockposition, worldgenfeatureendspikeconfiguration); } // Purpur - decompile error? + public boolean a(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEndSpikeConfiguration worldgenfeatureendspikeconfiguration) { + List list = worldgenfeatureendspikeconfiguration.c(); diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index 2abbc6b177..e296f935ab 100644 +index 9d5246de9..fa6298719 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java @@ -1,5 +1,6 @@ @@ -35,8 +35,8 @@ index 2abbc6b177..e296f935ab 100644 import com.google.common.base.Throwables; import net.minecraft.server.MinecraftServer; import net.pl3x.purpur.command.PurpurCommand; -@@ -142,6 +143,13 @@ public class PurpurConfig { - cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob); +@@ -140,6 +141,13 @@ public class PurpurConfig { + pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput); } + public static int endSpikeSeed = -1; diff --git a/patches/server/0105-Configurable-dungeon-seed.patch b/patches/server/0105-Configurable-dungeon-seed.patch new file mode 100644 index 000000000..9787b7ed4 --- /dev/null +++ b/patches/server/0105-Configurable-dungeon-seed.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Wed, 15 Jul 2020 12:40:25 -0500 +Subject: [PATCH] Configurable dungeon seed + + +diff --git a/src/main/java/net/minecraft/server/WorldGenDungeons.java b/src/main/java/net/minecraft/server/WorldGenDungeons.java +index 07f7b69fe..6aa1626f3 100644 +--- a/src/main/java/net/minecraft/server/WorldGenDungeons.java ++++ b/src/main/java/net/minecraft/server/WorldGenDungeons.java +@@ -11,12 +11,21 @@ public class WorldGenDungeons extends WorldGenerator[] ab = new EntityTypes[]{EntityTypes.SKELETON, EntityTypes.ZOMBIE, EntityTypes.ZOMBIE, EntityTypes.SPIDER}; + private static final IBlockData ac = Blocks.CAVE_AIR.getBlockData(); ++ private Random random; // Purpur + + public WorldGenDungeons(Codec codec) { + super(codec); + } + ++ public boolean generate(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) { return a(generatoraccessseed, chunkgenerator, random, blockposition, worldgenfeatureemptyconfiguration); } // Purpur - decompile error? + public boolean a(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) { ++ // Purpur start ++ if (this.random == null) { ++ int seed = net.pl3x.purpur.PurpurConfig.dungeonSeed; ++ this.random = seed == -1 ? random : new Random(seed); ++ } ++ random = this.random; ++ // Purpur end + boolean flag = true; + int i = random.nextInt(2) + 2; + int j = -i - 1; +diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java +index fa6298719..60826d0d2 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java +@@ -141,10 +141,13 @@ public class PurpurConfig { + pingCommandOutput = getString("settings.messages.ping-command-output", pingCommandOutput); + } + ++ public static int dungeonSeed = -1; + public static int endSpikeSeed = -1; + private static void seedSettings() { ++ dungeonSeed = getInt("settings.seed.dungeon", dungeonSeed); + endSpikeSeed = getInt("settings.seed.end-spike", endSpikeSeed); + if (!TimingsManager.hiddenConfigs.contains("settings.seed")) TimingsManager.hiddenConfigs.add("settings.seed"); ++ if (!TimingsManager.hiddenConfigs.contains("settings.seed.dungeon")) TimingsManager.hiddenConfigs.add("settings.seed.dungeon"); + if (!TimingsManager.hiddenConfigs.contains("settings.seed.end-spike")) TimingsManager.hiddenConfigs.add("settings.seed.end-spike"); + } + diff --git a/patches/server/0110-Phantoms-burn-in-light.patch b/patches/server/0106-Phantoms-burn-in-light.patch similarity index 93% rename from patches/server/0110-Phantoms-burn-in-light.patch rename to patches/server/0106-Phantoms-burn-in-light.patch index b5145feaa..488a9db1d 100644 --- a/patches/server/0110-Phantoms-burn-in-light.patch +++ b/patches/server/0106-Phantoms-burn-in-light.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Phantoms burn in light diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java -index ec09ec241..d529a285e 100644 +index b3616185d..706760bae 100644 --- a/src/main/java/net/minecraft/server/EntityPhantom.java +++ b/src/main/java/net/minecraft/server/EntityPhantom.java @@ -13,6 +13,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { private BlockPosition d; public void setHome(BlockPosition home) { this.d = home; } public BlockPosition getHome() { return this.d; } // Purpur - OBFHELPER - private EntityPhantom.AttackPhase bv; public AttackPhase getAttackPhase() { return this.bv; } // Purpur - OBFHELPER + private EntityPhantom.AttackPhase bo; public AttackPhase getAttackPhase() { return this.bo; } // Purpur - OBFHELPER private Vec3D crystalPosition; // Purpur + private static final RecipeItemStack TORCH = RecipeItemStack.a(Items.torch(), Items.soulTorch()); // Purpur @@ -20,7 +20,7 @@ index ec09ec241..d529a285e 100644 @Override public void movementTick() { -- if (this.isAlive() && this.eH()) { +- if (this.isAlive() && this.eG()) { + if (this.isAlive() && ((world.purpurConfig.phantomBurnInDaylight && this.isInDaylight()) || (world.purpurConfig.phantomBurnInLight > 0 && world.getLightLevel(new BlockPosition(this)) >= world.purpurConfig.phantomBurnInLight))) { // Purpur this.setOnFire(8); } @@ -48,7 +48,7 @@ index ec09ec241..d529a285e 100644 return false; } else { diff --git a/src/main/java/net/minecraft/server/Items.java b/src/main/java/net/minecraft/server/Items.java -index b5305eaa9..7066c5dda 100644 +index 4c379916d..ea6b61c9b 100644 --- a/src/main/java/net/minecraft/server/Items.java +++ b/src/main/java/net/minecraft/server/Items.java @@ -173,7 +173,7 @@ public class Items { @@ -70,10 +70,10 @@ index b5305eaa9..7066c5dda 100644 public static final Item dr = a(Blocks.JACK_O_LANTERN, CreativeModeTab.b); public static final Item ds = a(Blocks.OAK_TRAPDOOR, CreativeModeTab.d); diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index f7be1373c..44abaaacc 100644 +index dff09553b..a96fd2abe 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -507,6 +507,9 @@ public class PurpurWorldConfig { +@@ -385,6 +385,9 @@ public class PurpurWorldConfig { public int phantomSpawnOverheadRadius = 10; public int phantomSpawnMinPerAttempt = 1; public int phantomSpawnMaxPerAttempt = -1; @@ -83,7 +83,7 @@ index f7be1373c..44abaaacc 100644 private void phantomSettings() { phantomAttackedByCrystalRadius = getDouble("mobs.phantom.attacked-by-crystal-range", phantomAttackedByCrystalRadius); phantomAttackedByCrystalDamage = (float) getDouble("mobs.phantom.attacked-by-crystal-damage", phantomAttackedByCrystalDamage); -@@ -523,6 +526,9 @@ public class PurpurWorldConfig { +@@ -401,6 +404,9 @@ public class PurpurWorldConfig { phantomSpawnOverheadRadius = getInt("mobs.phantom.spawn.overhead.radius", phantomSpawnOverheadRadius); phantomSpawnMinPerAttempt = getInt("mobs.phantom.spawn.per-attempt.min", phantomSpawnMinPerAttempt); phantomSpawnMaxPerAttempt = getInt("mobs.phantom.spawn.per-attempt.max", phantomSpawnMaxPerAttempt); @@ -92,4 +92,4 @@ index f7be1373c..44abaaacc 100644 + phantomIgnorePlayersWithTorch = getBoolean("mobs.phantom.ignore-players-with-torch", phantomIgnorePlayersWithTorch); } - public boolean pigRidable = false; + public boolean pigGiveSaddleBack = false; diff --git a/patches/server/0111-Configurable-villager-breeding.patch b/patches/server/0107-Configurable-villager-breeding.patch similarity index 66% rename from patches/server/0111-Configurable-villager-breeding.patch rename to patches/server/0107-Configurable-villager-breeding.patch index 1706b8d68..81f1c3c06 100644 --- a/patches/server/0111-Configurable-villager-breeding.patch +++ b/patches/server/0107-Configurable-villager-breeding.patch @@ -5,35 +5,35 @@ Subject: [PATCH] Configurable villager breeding diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 903940feb..ac81b6ec7 100644 +index 71644c3d9..0467020bb 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -645,7 +645,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -640,7 +640,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @Override public boolean canBreed() { -- return this.bE + this.fu() >= 12 && this.getAge() == 0; -+ return world.purpurConfig.villagerCanBreed && this.bE + this.fu() >= 12 && this.getAge() == 0; // Purpur +- return this.bx + this.fv() >= 12 && this.getAge() == 0; ++ return world.purpurConfig.villagerCanBreed && this.bx + this.fv() >= 12 && this.getAge() == 0; // Purpur } - private boolean fq() { + private boolean fr() { diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 44abaaacc..213a9b2f5 100644 +index a96fd2abe..fb0059e27 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -663,6 +663,7 @@ public class PurpurWorldConfig { +@@ -448,6 +448,7 @@ public class PurpurWorldConfig { public boolean villagerFollowEmeraldBlock = false; public int villagerSpawnIronGolemRadius = 0; public int villagerSpawnIronGolemLimit = 0; + public boolean villagerCanBreed = true; private void villagerSettings() { - villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable); - villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater); -@@ -673,6 +674,7 @@ public class PurpurWorldConfig { + villagerBrainTicks = getInt("mobs.villager.brain-ticks", villagerBrainTicks); + villagerUseBrainTicksOnlyWhenLagging = getBoolean("mobs.villager.use-brain-ticks-only-when-lagging", villagerUseBrainTicksOnlyWhenLagging); +@@ -456,6 +457,7 @@ public class PurpurWorldConfig { villagerFollowEmeraldBlock = getBoolean("mobs.villager.follow-emerald-blocks", villagerFollowEmeraldBlock); villagerSpawnIronGolemRadius = getInt("mobs.villager.spawn-iron-golem.radius", villagerSpawnIronGolemRadius); villagerSpawnIronGolemLimit = getInt("mobs.villager.spawn-iron-golem.limit", villagerSpawnIronGolemLimit); + villagerCanBreed = getBoolean("mobs.villager.can-breed", villagerCanBreed); } - public boolean villagerTraderRidable = false; + public boolean villagerTraderCanBeLeashed = false; diff --git a/patches/server/0112-Redstone-deactivates-spawners.patch b/patches/server/0108-Redstone-deactivates-spawners.patch similarity index 93% rename from patches/server/0112-Redstone-deactivates-spawners.patch rename to patches/server/0108-Redstone-deactivates-spawners.patch index 74adaf21a..bb8af2457 100644 --- a/patches/server/0112-Redstone-deactivates-spawners.patch +++ b/patches/server/0108-Redstone-deactivates-spawners.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Redstone deactivates spawners diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 17e5e1f19..844dcc90c 100644 +index c2e830db7..3b4cc9871 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -51,6 +51,7 @@ public abstract class MobSpawnerAbstract { @@ -16,7 +16,7 @@ index 17e5e1f19..844dcc90c 100644 return this.a().isAffectsSpawningPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper } -@@ -334,7 +335,7 @@ public abstract class MobSpawnerAbstract { +@@ -329,7 +330,7 @@ public abstract class MobSpawnerAbstract { public abstract void a(int i); @@ -26,7 +26,7 @@ index 17e5e1f19..844dcc90c 100644 public abstract BlockPosition b(); } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 213a9b2f5..26964f062 100644 +index fb0059e27..85d6d3fc3 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -267,6 +267,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0109-Configurable-dungeon-seed.patch b/patches/server/0109-Configurable-dungeon-seed.patch deleted file mode 100644 index 67dd7ad52..000000000 --- a/patches/server/0109-Configurable-dungeon-seed.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Wed, 15 Jul 2020 12:40:25 -0500 -Subject: [PATCH] Configurable dungeon seed - - -diff --git a/src/main/java/net/minecraft/server/WorldGenDecoratorDungeon.java b/src/main/java/net/minecraft/server/WorldGenDecoratorDungeon.java -index 70d2229960..2bebbd6995 100644 ---- a/src/main/java/net/minecraft/server/WorldGenDecoratorDungeon.java -+++ b/src/main/java/net/minecraft/server/WorldGenDecoratorDungeon.java -@@ -6,6 +6,7 @@ import java.util.stream.IntStream; - import java.util.stream.Stream; - - public class WorldGenDecoratorDungeon extends WorldGenDecorator { -+ private Random random; // Purpur - - public WorldGenDecoratorDungeon(Codec codec) { - super(codec); -@@ -14,10 +15,17 @@ public class WorldGenDecoratorDungeon extends WorldGenDecorator a(GeneratorAccess generatoraccess, ChunkGenerator chunkgenerator, Random random, WorldGenDecoratorDungeonConfiguration worldgendecoratordungeonconfiguration, BlockPosition blockposition) { - int i = worldgendecoratordungeonconfiguration.b; - -+ // Purpur start -+ if (this.random == null) { -+ int seed = net.pl3x.purpur.PurpurConfig.dungeonSeed; -+ this.random = seed == -1 ? random : new Random(seed); -+ } -+ final Random rand = this.random; -+ // Purpur end - return IntStream.range(0, i).mapToObj((j) -> { -- int k = random.nextInt(16) + blockposition.getX(); -- int l = random.nextInt(16) + blockposition.getZ(); -- int i1 = random.nextInt(chunkgenerator.getGenerationDepth()); -+ int k = rand.nextInt(16) + blockposition.getX(); // Purpur -+ int l = rand.nextInt(16) + blockposition.getZ(); // Purpur -+ int i1 = rand.nextInt(chunkgenerator.getGenerationDepth()); // Purpur - - return new BlockPosition(k, i1, l); - }); -diff --git a/src/main/java/net/minecraft/server/WorldGenDungeons.java b/src/main/java/net/minecraft/server/WorldGenDungeons.java -index 3c7c936453..1f6ff78488 100644 ---- a/src/main/java/net/minecraft/server/WorldGenDungeons.java -+++ b/src/main/java/net/minecraft/server/WorldGenDungeons.java -@@ -11,12 +11,21 @@ public class WorldGenDungeons extends WorldGenerator[] ac = new EntityTypes[]{EntityTypes.SKELETON, EntityTypes.ZOMBIE, EntityTypes.ZOMBIE, EntityTypes.SPIDER}; - private static final IBlockData ad = Blocks.CAVE_AIR.getBlockData(); -+ private Random random; // Purpur - - public WorldGenDungeons(Codec codec) { - super(codec); - } - -+ public boolean generate(GeneratorAccessSeed generatoraccessseed, StructureManager structuremanager, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) { return a(generatoraccessseed, structuremanager, chunkgenerator, random, blockposition, worldgenfeatureemptyconfiguration); } // Purpur - decompile error? - public boolean a(GeneratorAccessSeed generatoraccessseed, StructureManager structuremanager, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) { -+ // Purpur start -+ if (this.random == null) { -+ int seed = net.pl3x.purpur.PurpurConfig.dungeonSeed; -+ this.random = seed == -1 ? random : new Random(seed); -+ } -+ random = this.random; -+ // Purpur end - boolean flag = true; - int i = random.nextInt(2) + 2; - int j = -i - 1; -diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index e296f935ab..59b6414b2f 100644 ---- a/src/main/java/net/pl3x/purpur/PurpurConfig.java -+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java -@@ -143,10 +143,13 @@ public class PurpurConfig { - cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob); - } - -+ public static int dungeonSeed = -1; - public static int endSpikeSeed = -1; - private static void seedSettings() { -+ dungeonSeed = getInt("settings.seed.dungeon", dungeonSeed); - endSpikeSeed = getInt("settings.seed.end-spike", endSpikeSeed); - if (!TimingsManager.hiddenConfigs.contains("settings.seed")) TimingsManager.hiddenConfigs.add("settings.seed"); -+ if (!TimingsManager.hiddenConfigs.contains("settings.seed.dungeon")) TimingsManager.hiddenConfigs.add("settings.seed.dungeon"); - if (!TimingsManager.hiddenConfigs.contains("settings.seed.end-spike")) TimingsManager.hiddenConfigs.add("settings.seed.end-spike"); - } - diff --git a/patches/server/0113-Totems-work-in-inventory.patch b/patches/server/0109-Totems-work-in-inventory.patch similarity index 96% rename from patches/server/0113-Totems-work-in-inventory.patch rename to patches/server/0109-Totems-work-in-inventory.patch index 130f9183c..859895884 100644 --- a/patches/server/0113-Totems-work-in-inventory.patch +++ b/patches/server/0109-Totems-work-in-inventory.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Totems work in inventory diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 61df55b8c8..8530e78a9c 100644 +index e697f7e4a..8071816d1 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -1324,6 +1324,19 @@ public abstract class EntityLiving extends Entity { @@ -29,7 +29,7 @@ index 61df55b8c8..8530e78a9c 100644 event.setCancelled(itemstack == null); this.world.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 26964f0620..cb7812741e 100644 +index 85d6d3fc3..b2874758a 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -185,6 +185,11 @@ public class PurpurWorldConfig { diff --git a/patches/server/0114-Fix-death-message-colors.patch b/patches/server/0110-Fix-death-message-colors.patch similarity index 95% rename from patches/server/0114-Fix-death-message-colors.patch rename to patches/server/0110-Fix-death-message-colors.patch index 4b08f808c..c8064ea06 100644 --- a/patches/server/0114-Fix-death-message-colors.patch +++ b/patches/server/0110-Fix-death-message-colors.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix death message colors diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 5c74bbdc4e..e9a3dc4e27 100644 +index 10c9905c5..a63616b32 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -662,7 +662,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -667,7 +667,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting { IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage(); diff --git a/patches/server/0115-Duplicate-paper-s-vanilla-scoreboard-colors-patch-to.patch b/patches/server/0111-Duplicate-paper-s-vanilla-scoreboard-colors-patch-to.patch similarity index 94% rename from patches/server/0115-Duplicate-paper-s-vanilla-scoreboard-colors-patch-to.patch rename to patches/server/0111-Duplicate-paper-s-vanilla-scoreboard-colors-patch-to.patch index 7d2723303..6cbf17492 100644 --- a/patches/server/0115-Duplicate-paper-s-vanilla-scoreboard-colors-patch-to.patch +++ b/patches/server/0111-Duplicate-paper-s-vanilla-scoreboard-colors-patch-to.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Duplicate paper's vanilla scoreboard colors patch to sync diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 194bb355ca..9cadf0c32e 100644 +index c3691ab0c..7096e5aab 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1893,7 +1893,15 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1887,7 +1887,15 @@ public class PlayerConnection implements PacketListenerPlayIn { return null; } @@ -26,7 +26,7 @@ index 194bb355ca..9cadf0c32e 100644 PlayerConnection.this.minecraftServer.console.sendMessage(message); if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) { for (Object player : PlayerConnection.this.minecraftServer.getPlayerList().players) { -@@ -1926,7 +1934,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1920,7 +1928,7 @@ public class PlayerConnection implements PacketListenerPlayIn { // Paper Start - (Meh) Support for vanilla world scoreboard name coloring String displayName = event.getPlayer().getDisplayName(); if (this.player.getWorld().paperConfig.useVanillaScoreboardColoring) { diff --git a/patches/server/0116-Populator-seed-controls.patch b/patches/server/0112-Populator-seed-controls.patch similarity index 62% rename from patches/server/0116-Populator-seed-controls.patch rename to patches/server/0112-Populator-seed-controls.patch index e9df6c93b..4c9b9c434 100644 --- a/patches/server/0116-Populator-seed-controls.patch +++ b/patches/server/0112-Populator-seed-controls.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Populator seed controls diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java -index dae2e5d707..55b67f1057 100644 +index dae2e5d70..55b67f105 100644 --- a/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java @@ -293,7 +293,7 @@ public class TimingsExport extends Thread { @@ -18,7 +18,7 @@ index dae2e5d707..55b67f1057 100644 } final Object val = config.get(key); diff --git a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java -index 1c7b858ed5..338ecd2d75 100644 +index 996be9b7f..1c6347420 100644 --- a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java +++ b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java @@ -1,5 +1,6 @@ @@ -28,7 +28,7 @@ index 1c7b858ed5..338ecd2d75 100644 import com.destroystokyo.paper.util.SneakyThrow; import net.minecraft.server.TicketType; import org.bukkit.Bukkit; -@@ -249,6 +250,11 @@ public final class TuinityConfig { +@@ -243,6 +244,11 @@ public final class TuinityConfig { return this.config.getDouble(path, this.worldDefaults.getDouble(path)); } @@ -40,7 +40,7 @@ index 1c7b858ed5..338ecd2d75 100644 /** ignored if {@link TuinityConfig#tickWorldsInParallel} == false */ public int threads; -@@ -274,6 +280,19 @@ public final class TuinityConfig { +@@ -268,6 +274,19 @@ public final class TuinityConfig { this.spawnLimitAmbient = this.getInt(path + ".ambient", -1); } @@ -62,41 +62,43 @@ index 1c7b858ed5..338ecd2d75 100644 } \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index 9259ba1af5..37359b1cd2 100644 +index 0854ac9ef..df6874c1c 100644 --- a/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -350,6 +350,10 @@ public class BiomeBase { - return (List) this.r.get(worldgenstage_decoration); +@@ -189,6 +189,10 @@ public final class BiomeBase { + return this.k; } + // Tuinity start - populator seed control + private static final java.security.SecureRandom SECURE_RANDOM = new java.security.SecureRandom(); + // Tuinity end - populator seed control + - public void a(WorldGenStage.Decoration worldgenstage_decoration, StructureManager structuremanager, ChunkGenerator chunkgenerator, GeneratorAccessSeed generatoraccessseed, long i, SeededRandom seededrandom, BlockPosition blockposition) { - int j = 0; - Iterator iterator; -@@ -387,10 +391,22 @@ public class BiomeBase { + public void a(StructureManager structuremanager, ChunkGenerator chunkgenerator, RegionLimitedWorldAccess regionlimitedworldaccess, long i, SeededRandom seededrandom, BlockPosition blockposition) { + List>>> list = this.k.c(); + int j = WorldGenStage.Decoration.values().length; +@@ -225,12 +229,24 @@ public final class BiomeBase { + } } - } -+ // Tuinity start - populator seed control -+ long populatorSeed; -+ WorldServer world = (WorldServer)((ChunkProviderServer)generatoraccessseed.getChunkProvider()).getWorld(); -+ if (world.tuinityConfig.useRandomPopulatorSeed) { -+ populatorSeed = SECURE_RANDOM.nextLong(); -+ } else if (world.tuinityConfig.populatorSeed != null) { -+ populatorSeed = world.tuinityConfig.populatorSeed.longValue(); -+ } else { -+ populatorSeed = i; -+ } -+ // Tuinity end - populator seed control ++ // Tuinity start - populator seed control ++ long populatorSeed; ++ WorldServer world = (WorldServer)((ChunkProviderServer)regionlimitedworldaccess.getChunkProvider()).getWorld(); ++ if (world.tuinityConfig.useRandomPopulatorSeed) { ++ populatorSeed = SECURE_RANDOM.nextLong(); ++ } else if (world.tuinityConfig.populatorSeed != null) { ++ populatorSeed = world.tuinityConfig.populatorSeed.longValue(); ++ } else { ++ populatorSeed = i; ++ } ++ // Tuinity end - populator seed control + - for (iterator = ((List) this.r.get(worldgenstage_decoration)).iterator(); iterator.hasNext(); ++j) { - WorldGenFeatureConfigured worldgenfeatureconfigured = (WorldGenFeatureConfigured) iterator.next(); + if (list.size() > k) { + for (Iterator iterator1 = ((List) list.get(k)).iterator(); iterator1.hasNext(); ++l) { + Supplier> supplier = (Supplier) iterator1.next(); + WorldGenFeatureConfigured worldgenfeatureconfigured = (WorldGenFeatureConfigured) supplier.get(); -- seededrandom.b(i, j, worldgenstage_decoration.ordinal()); -+ seededrandom.b(populatorSeed, j, worldgenstage_decoration.ordinal()); // Tuinity - populator seed control - move i up into default branch +- seededrandom.b(i, l, k); ++ seededrandom.b(populatorSeed, l, k); // Tuinity - populator seed control - move i up into default branch - try { - worldgenfeatureconfigured.a(generatoraccessseed, structuremanager, chunkgenerator, seededrandom, blockposition); + try { + worldgenfeatureconfigured.a(regionlimitedworldaccess, chunkgenerator, seededrandom, blockposition); diff --git a/patches/server/0117-Add-vindicator-johnny-spawn-chance.patch b/patches/server/0113-Add-vindicator-johnny-spawn-chance.patch similarity index 68% rename from patches/server/0117-Add-vindicator-johnny-spawn-chance.patch rename to patches/server/0113-Add-vindicator-johnny-spawn-chance.patch index cca02e6c6..591e5a2d2 100644 --- a/patches/server/0117-Add-vindicator-johnny-spawn-chance.patch +++ b/patches/server/0113-Add-vindicator-johnny-spawn-chance.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Add vindicator johnny spawn chance diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java -index 958f86481a..9b227c8d68 100644 +index fd34d88c0..a945a0a07 100644 --- a/src/main/java/net/minecraft/server/EntityVindicator.java +++ b/src/main/java/net/minecraft/server/EntityVindicator.java -@@ -99,6 +99,12 @@ public class EntityVindicator extends EntityIllagerAbstract { +@@ -81,6 +81,12 @@ public class EntityVindicator extends EntityIllagerAbstract { ((Navigation) this.getNavigation()).a(true); this.a(difficultydamagescaler); this.b(difficultydamagescaler); + // Purpur start -+ World world = generatoraccess.getMinecraftWorld(); ++ World world = worldaccess.getMinecraftWorld(); + if (world.purpurConfig.vindicatorJohnnySpawnChance > 0D && random.nextDouble() <= world.purpurConfig.vindicatorJohnnySpawnChance) { + setCustomName(new ChatMessage("Johnny")); + } @@ -22,18 +22,18 @@ index 958f86481a..9b227c8d68 100644 } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index cb7812741e..f42af3d9f9 100644 +index b2874758a..54a0b8694 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -700,9 +700,11 @@ public class PurpurWorldConfig { - - public boolean vindicatorRidable = false; - public boolean vindicatorRidableInWater = false; -+ public double vindicatorJohnnySpawnChance = 0D; - private void vindicatorSettings() { - vindicatorRidable = getBoolean("mobs.vindicator.ridable", vindicatorRidable); - vindicatorRidableInWater = getBoolean("mobs.vindicator.ridable-in-water", vindicatorRidableInWater); -+ vindicatorJohnnySpawnChance = getDouble("mobs.vindicator.johnny.spawn-chance", vindicatorJohnnySpawnChance); +@@ -40,6 +40,11 @@ public class PurpurWorldConfig { + } } - public boolean witchRidable = false; ++ public double vindicatorJohnnySpawnChance = 0D; ++ private void vindicatorSettings() { ++ vindicatorJohnnySpawnChance = getDouble("mobs.vindicator.johnny.spawn-chance", vindicatorJohnnySpawnChance); ++ } ++ + private ConfigurationSection getConfigurationSection(String path) { + ConfigurationSection section = PurpurConfig.config.getConfigurationSection("world-settings." + worldName + "." + path); + return section != null ? section : PurpurConfig.config.getConfigurationSection("world-settings.default." + path); diff --git a/patches/server/0118-DragonEggPlaceEvent.patch b/patches/server/0114-DragonEggPlaceEvent.patch similarity index 94% rename from patches/server/0118-DragonEggPlaceEvent.patch rename to patches/server/0114-DragonEggPlaceEvent.patch index ae2b1ef1e..023a6fd16 100644 --- a/patches/server/0118-DragonEggPlaceEvent.patch +++ b/patches/server/0114-DragonEggPlaceEvent.patch @@ -5,11 +5,11 @@ Subject: [PATCH] DragonEggPlaceEvent diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java -index cff39b25a3..5f1afd76ce 100644 +index 4f3f7cb42..f29edc410 100644 --- a/src/main/java/net/minecraft/server/EnderDragonBattle.java +++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java @@ -359,7 +359,13 @@ public class EnderDragonBattle { - this.a(true); + this.generateExitPortal(true); this.n(); if (this.world.purpurConfig.enderDragonAlwaysDropsEggBlock || !this.previouslyKilled) { // Purpur - always place dragon egg - this.world.setTypeUpdate(this.world.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, WorldGenEndTrophy.a), Blocks.DRAGON_EGG.getBlockData()); diff --git a/patches/server/0119-Add-option-to-disable-mushroom-block-updates.patch b/patches/server/0115-Add-option-to-disable-mushroom-block-updates.patch similarity index 98% rename from patches/server/0119-Add-option-to-disable-mushroom-block-updates.patch rename to patches/server/0115-Add-option-to-disable-mushroom-block-updates.patch index 75d1ee3ed..6dd7bc23f 100644 --- a/patches/server/0119-Add-option-to-disable-mushroom-block-updates.patch +++ b/patches/server/0115-Add-option-to-disable-mushroom-block-updates.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option to disable mushroom block updates diff --git a/src/main/java/net/minecraft/server/BlockHugeMushroom.java b/src/main/java/net/minecraft/server/BlockHugeMushroom.java -index e8f340b9f2..3490af6fe0 100644 +index e8f340b9f..3490af6fe 100644 --- a/src/main/java/net/minecraft/server/BlockHugeMushroom.java +++ b/src/main/java/net/minecraft/server/BlockHugeMushroom.java @@ -14,30 +14,57 @@ public class BlockHugeMushroom extends Block { @@ -73,10 +73,10 @@ index e8f340b9f2..3490af6fe0 100644 @Override diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index 2e75ad1a75..b040d7b58b 100644 +index 60826d0d2..bef137935 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java -@@ -207,6 +207,11 @@ public class PurpurConfig { +@@ -205,6 +205,11 @@ public class PurpurConfig { allowWaterPlacementInTheEnd = getBoolean("settings.allow-water-placement-in-the-end", allowWaterPlacementInTheEnd); } diff --git a/patches/server/0120-PaperMC-Buffer-joins.patch b/patches/server/0116-PaperMC-Buffer-joins.patch similarity index 90% rename from patches/server/0120-PaperMC-Buffer-joins.patch rename to patches/server/0116-PaperMC-Buffer-joins.patch index e4e5a9fb1..d40273eaa 100644 --- a/patches/server/0120-PaperMC-Buffer-joins.patch +++ b/patches/server/0116-PaperMC-Buffer-joins.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PaperMC - Buffer joins diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 54e374cc94..8bcba67e6b 100644 +index 66f239040..fe9a770cb 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -412,10 +412,24 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -412,10 +412,23 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } // Paper end @@ -22,8 +22,7 @@ index 54e374cc94..8bcba67e6b 100644 + currTick = thisTick; + loginsThisTick = 0; + } -+ - this.o(); + this.p(); if (this.packetListener instanceof LoginListener) { - ((LoginListener) this.packetListener).tick(); + if ( ((LoginListener) this.packetListener).getLoginState() != LoginListener.EnumProtocolState.READY_TO_ACCEPT @@ -35,10 +34,10 @@ index 54e374cc94..8bcba67e6b 100644 if (this.packetListener instanceof PlayerConnection) { diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index 0438126662..bb69477c41 100644 +index 5f4dacf9c..9b2f93a4b 100644 --- a/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -121,7 +121,7 @@ public class ServerConnection { +@@ -124,7 +124,7 @@ public class ServerConnection { public void c() { List list = this.connectedChannels; diff --git a/patches/server/0121-Dispensers-place-anvils-option.patch b/patches/server/0117-Dispensers-place-anvils-option.patch similarity index 93% rename from patches/server/0121-Dispensers-place-anvils-option.patch rename to patches/server/0117-Dispensers-place-anvils-option.patch index c4607654d..0ae345d19 100644 --- a/patches/server/0121-Dispensers-place-anvils-option.patch +++ b/patches/server/0117-Dispensers-place-anvils-option.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Dispensers place anvils option diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java -index 5a04654657..0ec5ea0659 100644 +index 36aafc3b7..d43939077 100644 --- a/src/main/java/net/minecraft/server/EnumDirection.java +++ b/src/main/java/net/minecraft/server/EnumDirection.java @@ -102,6 +102,7 @@ public enum EnumDirection implements INamable { @@ -33,10 +33,10 @@ index 5a04654657..0ec5ea0659 100644 return this.k; } diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java -index 660f44975a..2cf10277ef 100644 +index 7b8a470d9..d1f9d2884 100644 --- a/src/main/java/net/minecraft/server/IDispenseBehavior.java +++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java -@@ -914,6 +914,23 @@ public interface IDispenseBehavior { +@@ -915,6 +915,23 @@ public interface IDispenseBehavior { } })); BlockDispenser.a((IMaterial) Items.SHEARS.getItem(), (IDispenseBehavior) (new DispenseBehaviorShears())); @@ -61,10 +61,10 @@ index 660f44975a..2cf10277ef 100644 static void a(ISourceBlock isourceblock, Entity entity, EnumDirection enumdirection) { diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index f42af3d9f9..278b100de9 100644 +index 54a0b8694..6a8f6cb8c 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -230,8 +230,10 @@ public class PurpurWorldConfig { +@@ -235,8 +235,10 @@ public class PurpurWorldConfig { } public boolean dispenserApplyCursedArmor = true; diff --git a/patches/server/0122-Allow-anvil-colors.patch b/patches/server/0118-Allow-anvil-colors.patch similarity index 95% rename from patches/server/0122-Allow-anvil-colors.patch rename to patches/server/0118-Allow-anvil-colors.patch index 62da684e9..fb8b6f4de 100644 --- a/patches/server/0122-Allow-anvil-colors.patch +++ b/patches/server/0118-Allow-anvil-colors.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow anvil colors diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java -index 4aa6b035a6..5e4e59e5c8 100644 +index 4aa6b035a..5e4e59e5c 100644 --- a/src/main/java/net/minecraft/server/ContainerAnvil.java +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java @@ -251,6 +251,25 @@ public class ContainerAnvil extends ContainerAnvilAbstract { @@ -35,10 +35,10 @@ index 4aa6b035a6..5e4e59e5c8 100644 } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 278b100de9..711858a716 100644 +index 6a8f6cb8c..b19295cce 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -206,6 +206,11 @@ public class PurpurWorldConfig { +@@ -211,6 +211,11 @@ public class PurpurWorldConfig { }); } diff --git a/patches/server/0123-Add-no-tick-block-list.patch b/patches/server/0119-Add-no-tick-block-list.patch similarity index 94% rename from patches/server/0123-Add-no-tick-block-list.patch rename to patches/server/0119-Add-no-tick-block-list.patch index f78fddeae..a0174eeec 100644 --- a/patches/server/0123-Add-no-tick-block-list.patch +++ b/patches/server/0119-Add-no-tick-block-list.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add no-tick block list diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index a53e096515..f01277ae07 100644 +index 82e07b357..05a7422fb 100644 --- a/src/main/java/net/minecraft/server/BlockBase.java +++ b/src/main/java/net/minecraft/server/BlockBase.java @@ -566,10 +566,12 @@ public abstract class BlockBase { @@ -22,10 +22,10 @@ index a53e096515..f01277ae07 100644 } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 97f803d0ad..296371b3a4 100644 +index 17105c9a1..6c783f07a 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -303,14 +303,14 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -305,14 +305,14 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit end if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { @@ -43,7 +43,7 @@ index 97f803d0ad..296371b3a4 100644 this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { return fluidtype == null || fluidtype == FluidTypes.EMPTY; diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 711858a716..849c454057 100644 +index b19295cce..8f9f1a263 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -11,8 +11,10 @@ import org.bukkit.configuration.ConfigurationSection; @@ -57,7 +57,7 @@ index 711858a716..849c454057 100644 import java.util.logging.Level; import static net.pl3x.purpur.PurpurConfig.log; -@@ -180,6 +182,16 @@ public class PurpurWorldConfig { +@@ -185,6 +187,16 @@ public class PurpurWorldConfig { playerInvulnerableWhileAcceptingResourcePack = getBoolean("gameplay-mechanics.player.invulnerable-while-accepting-resource-pack", playerInvulnerableWhileAcceptingResourcePack); } diff --git a/patches/server/0124-Add-option-to-disable-dolphin-treasure-searching.patch b/patches/server/0120-Add-option-to-disable-dolphin-treasure-searching.patch similarity index 79% rename from patches/server/0124-Add-option-to-disable-dolphin-treasure-searching.patch rename to patches/server/0120-Add-option-to-disable-dolphin-treasure-searching.patch index 0d3c10cba..a56af3a1d 100644 --- a/patches/server/0124-Add-option-to-disable-dolphin-treasure-searching.patch +++ b/patches/server/0120-Add-option-to-disable-dolphin-treasure-searching.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to disable dolphin treasure searching diff --git a/src/main/java/net/minecraft/server/EntityDolphin.java b/src/main/java/net/minecraft/server/EntityDolphin.java -index 053ca43e50..6ac7cdea55 100644 +index 8d9ab06c8..0f51dbf8d 100644 --- a/src/main/java/net/minecraft/server/EntityDolphin.java +++ b/src/main/java/net/minecraft/server/EntityDolphin.java -@@ -320,6 +320,7 @@ public class EntityDolphin extends EntityWaterAnimal { +@@ -328,6 +328,7 @@ public class EntityDolphin extends EntityWaterAnimal { @Override public boolean a() { @@ -17,10 +17,10 @@ index 053ca43e50..6ac7cdea55 100644 } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 849c454057..9945c25a2e 100644 +index 8f9f1a263..1f86580cf 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -354,6 +354,11 @@ public class PurpurWorldConfig { +@@ -336,6 +336,11 @@ public class PurpurWorldConfig { creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance); } @@ -29,6 +29,6 @@ index 849c454057..9945c25a2e 100644 + dolphinDisableTreasureSearching = getBoolean("mobs.dolphin.disable-treasure-searching", dolphinDisableTreasureSearching); + } + - public boolean donkeyRidableInWater = false; - private void donkeySettings() { - donkeyRidableInWater = getBoolean("mobs.donkey.ridable-in-water", donkeyRidableInWater); + public boolean drownedJockeyOnlyBaby = true; + public double drownedJockeyChance = 0.05D; + public boolean drownedJockeyTryExistingChickens = true; diff --git a/patches/server/0125-Add-option-to-reset-reputation-when-villager-is-cure.patch b/patches/server/0121-Add-option-to-reset-reputation-when-villager-is-cure.patch similarity index 71% rename from patches/server/0125-Add-option-to-reset-reputation-when-villager-is-cure.patch rename to patches/server/0121-Add-option-to-reset-reputation-when-villager-is-cure.patch index 729407ecb..89c884848 100644 --- a/patches/server/0125-Add-option-to-reset-reputation-when-villager-is-cure.patch +++ b/patches/server/0121-Add-option-to-reset-reputation-when-villager-is-cure.patch @@ -5,38 +5,36 @@ Subject: [PATCH] Add option to reset reputation when villager is cured diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index ac81b6ec71..a7e76f196f 100644 +index 0467020bb..7add2fca1 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -39,7 +39,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @Nullable - private EntityHuman bC; - private byte bE; -- private final Reputation bF; -+ private Reputation bF; // Purpur - remove final - private long bG; - private long bH; - private int bI; -@@ -963,6 +963,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + private EntityHuman bv; + private byte bx; +- private final Reputation by; ++ private Reputation by; // Purpur - remove final + private long bz; + private long bA; + private int bB; +@@ -940,6 +940,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @Override public void a(ReputationEvent reputationevent, Entity entity) { if (reputationevent == ReputationEvent.a) { -+ if (world.purpurConfig.zombieVillagerResetReputationsWhenCured) this.bF = new Reputation(); // Purpur - this.bF.a(entity.getUniqueID(), ReputationType.MAJOR_POSITIVE, 20); - this.bF.a(entity.getUniqueID(), ReputationType.MINOR_POSITIVE, 25); ++ if (world.purpurConfig.zombieVillagerResetReputationsWhenCured) this.by = new Reputation(); // Purpur + this.by.a(entity.getUniqueID(), ReputationType.MAJOR_POSITIVE, 20); + this.by.a(entity.getUniqueID(), ReputationType.MINOR_POSITIVE, 25); } else if (reputationevent == ReputationEvent.e) { diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 9945c25a2e..d2332b00b9 100644 +index 1f86580cf..6329b1c50 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -803,11 +803,13 @@ public class PurpurWorldConfig { +@@ -539,9 +539,11 @@ public class PurpurWorldConfig { public boolean zombieVillagerJockeyOnlyBaby = true; public double zombieVillagerJockeyChance = 0.05D; public boolean zombieVillagerJockeyTryExistingChickens = true; + public boolean zombieVillagerResetReputationsWhenCured = false; private void zombieVillagerSettings() { - zombieVillagerRidable = getBoolean("mobs.zombie_villager.ridable", zombieVillagerRidable); - zombieVillagerRidableInWater = getBoolean("mobs.zombie_villager.ridable-in-water", zombieVillagerRidableInWater); zombieVillagerJockeyOnlyBaby = getBoolean("mobs.zombie_villager.jockey.only-babies", zombieVillagerJockeyOnlyBaby); zombieVillagerJockeyChance = getDouble("mobs.zombie_villager.jockey.chance", zombieVillagerJockeyChance); zombieVillagerJockeyTryExistingChickens = getBoolean("mobs.zombie_villager.jockey.try-existing-chickens", zombieVillagerJockeyTryExistingChickens); diff --git a/patches/server/0126-PaperPR-Optimize-redstone-algorithm.patch b/patches/server/0122-PaperPR-Optimize-redstone-algorithm.patch similarity index 99% rename from patches/server/0126-PaperPR-Optimize-redstone-algorithm.patch rename to patches/server/0122-PaperPR-Optimize-redstone-algorithm.patch index 56986a616..263ebf6ec 100644 --- a/patches/server/0126-PaperPR-Optimize-redstone-algorithm.patch +++ b/patches/server/0122-PaperPR-Optimize-redstone-algorithm.patch @@ -19,10 +19,10 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee Just added Bukkit's event system and took a few liberties with dead code and comment misspellings. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 09fda504df..c72f7e94ff 100644 +index fedea8106..56f1b4b5d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -666,4 +666,14 @@ public class PaperWorldConfig { +@@ -655,4 +655,14 @@ public class PaperWorldConfig { maxLightningFlashDistance = 512; // Vanilla value } } @@ -39,7 +39,7 @@ index 09fda504df..c72f7e94ff 100644 } diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java new file mode 100644 -index 0000000000..b69803cbf2 +index 000000000..b69803cbf --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java @@ -0,0 +1,915 @@ @@ -959,7 +959,7 @@ index 0000000000..b69803cbf2 + } +} diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java -index 7b3ccded04..6abc3d4cfb 100644 +index 7b3ccded0..6abc3d4cf 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java @@ -1,5 +1,7 @@ @@ -1137,10 +1137,10 @@ index 7b3ccded04..6abc3d4cfb 100644 c(iblockdata, world, blockposition); world.a(blockposition, false); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 657d005d29..2269b7e651 100644 +index 90b4beba7..6fb930b99 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -677,6 +677,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -614,6 +614,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } @@ -1148,7 +1148,7 @@ index 657d005d29..2269b7e651 100644 public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) { if (!this.isClientSide) { IBlockData iblockdata = this.getType(blockposition); -@@ -1337,6 +1338,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1274,6 +1275,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return this.getBlockFacePower(blockposition.down(), EnumDirection.DOWN) > 0 ? true : (this.getBlockFacePower(blockposition.up(), EnumDirection.UP) > 0 ? true : (this.getBlockFacePower(blockposition.north(), EnumDirection.NORTH) > 0 ? true : (this.getBlockFacePower(blockposition.south(), EnumDirection.SOUTH) > 0 ? true : (this.getBlockFacePower(blockposition.west(), EnumDirection.WEST) > 0 ? true : this.getBlockFacePower(blockposition.east(), EnumDirection.EAST) > 0)))); } diff --git a/patches/server/0127-Short-enderman-height.patch b/patches/server/0123-Short-enderman-height.patch similarity index 91% rename from patches/server/0127-Short-enderman-height.patch rename to patches/server/0123-Short-enderman-height.patch index 3185aca31..f856fa882 100644 --- a/patches/server/0127-Short-enderman-height.patch +++ b/patches/server/0123-Short-enderman-height.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Short enderman height diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index a1c6679f0d..291a3924e3 100644 +index b45a75a45..fde60d6c8 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -336,6 +336,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -321,6 +321,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { public boolean damageEntity(DamageSource damagesource, float f) { if (this.isInvulnerable(damagesource)) { return false; + } else if (net.pl3x.purpur.PurpurConfig.endermanShortHeight && damagesource == DamageSource.STUCK) { return false; // Purpur - no suffocation damage if short height - } else if (hasRider()) { return super.damageEntity(damagesource, f); // Purpur - no teleporting on damage } else if (damagesource instanceof EntityDamageSourceIndirect) { if (this.tryEscape(EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start + for (int i = 0; i < 64; ++i) { diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 5aea855957..f45269bbfd 100644 +index 8300e7d1e..312b96764 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -34,7 +34,7 @@ public class EntityTypes { @@ -30,10 +30,10 @@ index 5aea855957..f45269bbfd 100644 public static final EntityTypes EVOKER = a("evoker", EntityTypes.Builder.a(EntityEvoker::new, EnumCreatureType.MONSTER).a(0.6F, 1.95F).trackingRange(8)); public static final EntityTypes EVOKER_FANGS = a("evoker_fangs", EntityTypes.Builder.a(EntityEvokerFangs::new, EnumCreatureType.MISC).a(0.5F, 0.8F).trackingRange(6).updateInterval(2)); diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index 83b6c65716..af3739c79a 100644 +index bef137935..8714d1574 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java -@@ -192,6 +192,11 @@ public class PurpurConfig { +@@ -190,6 +190,11 @@ public class PurpurConfig { enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows); } diff --git a/patches/server/0124-Stop-squids-floating-on-top-of-water.patch b/patches/server/0124-Stop-squids-floating-on-top-of-water.patch new file mode 100644 index 000000000..b11da4e69 --- /dev/null +++ b/patches/server/0124-Stop-squids-floating-on-top-of-water.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Thu, 13 Aug 2020 04:00:26 -0500 +Subject: [PATCH] Stop squids floating on top of water + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index bf17d9daf..c827e4628 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -3381,8 +3381,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + this.lastYaw = this.yaw; + } + ++ // Purpur start ++ public AxisAlignedBB getAxisForFluidCheck() { ++ return this.getBoundingBox().shrink(0.001D); ++ } + public boolean a(Tag tag, double d0) { +- AxisAlignedBB axisalignedbb = this.getBoundingBox().shrink(0.001D); ++ AxisAlignedBB axisalignedbb = getAxisForFluidCheck(); ++ // Purpur end + int i = MathHelper.floor(axisalignedbb.minX); + int j = MathHelper.f(axisalignedbb.maxX); + int k = MathHelper.floor(axisalignedbb.minY); +diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java +index 03d707ed0..028a7fe2c 100644 +--- a/src/main/java/net/minecraft/server/EntitySquid.java ++++ b/src/main/java/net/minecraft/server/EntitySquid.java +@@ -25,6 +25,14 @@ public class EntitySquid extends EntityWaterAnimal { + this.bu = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; + } + ++ // Purpur start ++ @Override ++ public AxisAlignedBB getAxisForFluidCheck() { ++ // Stops squids from floating just over the water ++ return this.getBoundingBox().shrink(0.001D).offsetY(world.purpurConfig.squidOffsetWaterCheck); ++ } ++ // Purpur end ++ + @Override + protected void initPathfinder() { + this.goalSelector.a(0, new EntitySquid.PathfinderGoalSquid(this)); +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index 6329b1c50..421781136 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -476,8 +476,10 @@ public class PurpurWorldConfig { + } + + public boolean squidImmuneToEAR = true; ++ public double squidOffsetWaterCheck = 0.0D; + private void squidSettings() { + squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR); ++ squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck); + } + + public int villagerBrainTicks = 1; diff --git a/patches/server/0105-Ridables.patch b/patches/server/0125-Ridables.patch similarity index 51% rename from patches/server/0105-Ridables.patch rename to patches/server/0125-Ridables.patch index e774d6742..2b3dd771c 100644 --- a/patches/server/0105-Ridables.patch +++ b/patches/server/0125-Ridables.patch @@ -4,8 +4,127 @@ Date: Sun, 5 Jul 2020 22:19:49 -0500 Subject: [PATCH] Ridables +diff --git a/src/main/java/net/minecraft/server/AttributeDefaults.java b/src/main/java/net/minecraft/server/AttributeDefaults.java +index da66cf0a4..3aa05a80f 100644 +--- a/src/main/java/net/minecraft/server/AttributeDefaults.java ++++ b/src/main/java/net/minecraft/server/AttributeDefaults.java +@@ -9,7 +9,80 @@ import org.apache.logging.log4j.Logger; + public class AttributeDefaults { + + private static final Logger LOGGER = LogManager.getLogger(); +- private static final Map, AttributeProvider> b = ImmutableMap.builder().put(EntityTypes.ARMOR_STAND, EntityLiving.cK().a()).put(EntityTypes.BAT, EntityBat.m().a()).put(EntityTypes.BEE, EntityBee.eZ().a()).put(EntityTypes.BLAZE, EntityBlaze.m().a()).put(EntityTypes.CAT, EntityCat.fa().a()).put(EntityTypes.CAVE_SPIDER, EntityCaveSpider.m().a()).put(EntityTypes.CHICKEN, EntityChicken.eK().a()).put(EntityTypes.COD, EntityFish.m().a()).put(EntityTypes.COW, EntityCow.eK().a()).put(EntityTypes.CREEPER, EntityCreeper.m().a()).put(EntityTypes.DOLPHIN, EntityDolphin.eM().a()).put(EntityTypes.DONKEY, EntityHorseChestedAbstract.eL().a()).put(EntityTypes.DROWNED, EntityZombie.eS().a()).put(EntityTypes.ELDER_GUARDIAN, EntityGuardianElder.m().a()).put(EntityTypes.ENDERMAN, EntityEnderman.m().a()).put(EntityTypes.ENDERMITE, EntityEndermite.m().a()).put(EntityTypes.ENDER_DRAGON, EntityEnderDragon.m().a()).put(EntityTypes.EVOKER, EntityEvoker.eK().a()).put(EntityTypes.FOX, EntityFox.eK().a()).put(EntityTypes.GHAST, EntityGhast.eJ().a()).put(EntityTypes.GIANT, EntityGiantZombie.m().a()).put(EntityTypes.GUARDIAN, EntityGuardian.eM().a()).put(EntityTypes.HOGLIN, EntityHoglin.eK().a()).put(EntityTypes.HORSE, EntityHorseAbstract.fi().a()).put(EntityTypes.HUSK, EntityZombie.eS().a()).put(EntityTypes.ILLUSIONER, EntityIllagerIllusioner.eK().a()).put(EntityTypes.IRON_GOLEM, EntityIronGolem.m().a()).put(EntityTypes.LLAMA, EntityLlama.fw().a()).put(EntityTypes.MAGMA_CUBE, EntityMagmaCube.m().a()).put(EntityTypes.MOOSHROOM, EntityCow.eK().a()).put(EntityTypes.MULE, EntityHorseChestedAbstract.eL().a()).put(EntityTypes.OCELOT, EntityOcelot.eK().a()).put(EntityTypes.PANDA, EntityPanda.eY().a()).put(EntityTypes.PARROT, EntityParrot.eU().a()).put(EntityTypes.PHANTOM, EntityMonster.eR().a()).put(EntityTypes.PIG, EntityPig.eK().a()).put(EntityTypes.PIGLIN, EntityPiglin.eT().a()).put(EntityTypes.PIGLIN_BRUTE, EntityPiglinBrute.eS().a()).put(EntityTypes.PILLAGER, EntityPillager.eK().a()).put(EntityTypes.PLAYER, EntityHuman.eo().a()).put(EntityTypes.POLAR_BEAR, EntityPolarBear.eK().a()).put(EntityTypes.PUFFERFISH, EntityFish.m().a()).put(EntityTypes.RABBIT, EntityRabbit.eL().a()).put(EntityTypes.RAVAGER, EntityRavager.m().a()).put(EntityTypes.SALMON, EntityFish.m().a()).put(EntityTypes.SHEEP, EntitySheep.eK().a()).put(EntityTypes.SHULKER, EntityShulker.m().a()).put(EntityTypes.SILVERFISH, EntitySilverfish.m().a()).put(EntityTypes.SKELETON, EntitySkeletonAbstract.m().a()).put(EntityTypes.SKELETON_HORSE, EntityHorseSkeleton.eL().a()).put(EntityTypes.SLIME, EntityMonster.eR().a()).put(EntityTypes.SNOW_GOLEM, EntitySnowman.m().a()).put(EntityTypes.SPIDER, EntitySpider.eK().a()).put(EntityTypes.SQUID, EntitySquid.m().a()).put(EntityTypes.STRAY, EntitySkeletonAbstract.m().a()).put(EntityTypes.STRIDER, EntityStrider.eM().a()).put(EntityTypes.TRADER_LLAMA, EntityLlama.fw().a()).put(EntityTypes.TROPICAL_FISH, EntityFish.m().a()).put(EntityTypes.TURTLE, EntityTurtle.eM().a()).put(EntityTypes.VEX, EntityVex.m().a()).put(EntityTypes.VILLAGER, EntityVillager.eY().a()).put(EntityTypes.VINDICATOR, EntityVindicator.eK().a()).put(EntityTypes.WANDERING_TRADER, EntityInsentient.p().a()).put(EntityTypes.WITCH, EntityWitch.eK().a()).put(EntityTypes.WITHER, EntityWither.eK().a()).put(EntityTypes.WITHER_SKELETON, EntitySkeletonAbstract.m().a()).put(EntityTypes.WOLF, EntityWolf.eU().a()).put(EntityTypes.ZOGLIN, EntityZoglin.m().a()).put(EntityTypes.ZOMBIE, EntityZombie.eS().a()).put(EntityTypes.ZOMBIE_HORSE, EntityHorseZombie.eL().a()).put(EntityTypes.ZOMBIE_VILLAGER, EntityZombie.eS().a()).put(EntityTypes.ZOMBIFIED_PIGLIN, EntityPigZombie.eW().a()).build(); ++ private static final Map, AttributeProvider> b = ImmutableMap., AttributeProvider>builder() // Purpur decompile error ++ .put(EntityTypes.ARMOR_STAND, EntityLiving.cK().a()) ++ .put(EntityTypes.BAT, EntityBat.m().a()) ++ .put(EntityTypes.BEE, EntityBee.eZ().a()) ++ .put(EntityTypes.BLAZE, EntityBlaze.m().a()) ++ .put(EntityTypes.CAT, EntityCat.fa().a()) ++ .put(EntityTypes.CAVE_SPIDER, EntityCaveSpider.m().a()) ++ .put(EntityTypes.CHICKEN, EntityChicken.eK().a()) ++ .put(EntityTypes.COD, EntityFish.m().a()) ++ .put(EntityTypes.COW, EntityCow.eK().a()) ++ .put(EntityTypes.CREEPER, EntityCreeper.m().a()) ++ .put(EntityTypes.DOLPHIN, EntityDolphin.eM().a()) ++ .put(EntityTypes.DONKEY, EntityHorseChestedAbstract.eL().a()) ++ .put(EntityTypes.DROWNED, EntityZombie.eS().a()) ++ .put(EntityTypes.ELDER_GUARDIAN, EntityGuardianElder.m().a()) ++ .put(EntityTypes.ENDERMAN, EntityEnderman.m().a()) ++ .put(EntityTypes.ENDERMITE, EntityEndermite.m().a()) ++ .put(EntityTypes.ENDER_DRAGON, EntityEnderDragon.m().a()) ++ .put(EntityTypes.EVOKER, EntityEvoker.eK().a()) ++ .put(EntityTypes.FOX, EntityFox.eK().a()) ++ .put(EntityTypes.GHAST, EntityGhast.eJ().a()) ++ .put(EntityTypes.GIANT, EntityGiantZombie.m().a()) ++ .put(EntityTypes.GUARDIAN, EntityGuardian.eM().a()) ++ .put(EntityTypes.HOGLIN, EntityHoglin.eK().a()) ++ .put(EntityTypes.HORSE, EntityHorseAbstract.fi().a()) ++ .put(EntityTypes.HUSK, EntityZombie.eS().a()) ++ .put(EntityTypes.ILLUSIONER, EntityIllagerIllusioner.eK().a()) ++ .put(EntityTypes.IRON_GOLEM, EntityIronGolem.m().a()) ++ .put(EntityTypes.LLAMA, EntityLlama.fw().a()) ++ .put(EntityTypes.MAGMA_CUBE, EntityMagmaCube.m().a()) ++ .put(EntityTypes.MOOSHROOM, EntityCow.eK().a()) ++ .put(EntityTypes.MULE, EntityHorseChestedAbstract.eL().a()) ++ .put(EntityTypes.OCELOT, EntityOcelot.eK().a()) ++ .put(EntityTypes.PANDA, EntityPanda.eY().a()) ++ .put(EntityTypes.PARROT, EntityParrot.eU().a()) ++ .put(EntityTypes.PHANTOM, EntityPhantom.defaultAttributes().build()) // Purpur ++ .put(EntityTypes.PIG, EntityPig.eK().a()) ++ .put(EntityTypes.PIGLIN, EntityPiglin.eT().a()) ++ .put(EntityTypes.PIGLIN_BRUTE, EntityPiglinBrute.eS().a()) ++ .put(EntityTypes.PILLAGER, EntityPillager.eK().a()) ++ .put(EntityTypes.PLAYER, EntityHuman.eo().a()) ++ .put(EntityTypes.POLAR_BEAR, EntityPolarBear.eK().a()) ++ .put(EntityTypes.PUFFERFISH, EntityFish.m().a()) ++ .put(EntityTypes.RABBIT, EntityRabbit.eL().a()) ++ .put(EntityTypes.RAVAGER, EntityRavager.m().a()) ++ .put(EntityTypes.SALMON, EntityFish.m().a()) ++ .put(EntityTypes.SHEEP, EntitySheep.eK().a()) ++ .put(EntityTypes.SHULKER, EntityShulker.m().a()) ++ .put(EntityTypes.SILVERFISH, EntitySilverfish.m().a()) ++ .put(EntityTypes.SKELETON, EntitySkeletonAbstract.m().a()) ++ .put(EntityTypes.SKELETON_HORSE, EntityHorseSkeleton.eL().a()) ++ .put(EntityTypes.SLIME, EntityMonster.eR().a()) ++ .put(EntityTypes.SNOW_GOLEM, EntitySnowman.m().a()) ++ .put(EntityTypes.SPIDER, EntitySpider.eK().a()) ++ .put(EntityTypes.SQUID, EntitySquid.m().a()) ++ .put(EntityTypes.STRAY, EntitySkeletonAbstract.m().a()) ++ .put(EntityTypes.STRIDER, EntityStrider.eM().a()) ++ .put(EntityTypes.TRADER_LLAMA, EntityLlama.fw().a()) ++ .put(EntityTypes.TROPICAL_FISH, EntityFish.m().a()) ++ .put(EntityTypes.TURTLE, EntityTurtle.eM().a()) ++ .put(EntityTypes.VEX, EntityVex.m().a()) ++ .put(EntityTypes.VILLAGER, EntityVillager.eY().a()) ++ .put(EntityTypes.VINDICATOR, EntityVindicator.eK().a()) ++ .put(EntityTypes.WANDERING_TRADER, EntityInsentient.p().a()) ++ .put(EntityTypes.WITCH, EntityWitch.eK().a()) ++ .put(EntityTypes.WITHER, EntityWither.eK().a()) ++ .put(EntityTypes.WITHER_SKELETON, EntitySkeletonAbstract.m().a()) ++ .put(EntityTypes.WOLF, EntityWolf.eU().a()) ++ .put(EntityTypes.ZOGLIN, EntityZoglin.m().a()) ++ .put(EntityTypes.ZOMBIE, EntityZombie.eS().a()) ++ .put(EntityTypes.ZOMBIE_HORSE, EntityHorseZombie.eL().a()) ++ .put(EntityTypes.ZOMBIE_VILLAGER, EntityZombie.eS().a()) ++ .put(EntityTypes.ZOMBIFIED_PIGLIN, EntityPigZombie.eW().a()) ++ .build(); + + public static AttributeProvider a(EntityTypes entitytypes) { + return (AttributeProvider) AttributeDefaults.b.get(entitytypes); +diff --git a/src/main/java/net/minecraft/server/AttributeProvider.java b/src/main/java/net/minecraft/server/AttributeProvider.java +index dd235a6fc..ac902c614 100644 +--- a/src/main/java/net/minecraft/server/AttributeProvider.java ++++ b/src/main/java/net/minecraft/server/AttributeProvider.java +@@ -101,6 +101,7 @@ public class AttributeProvider { + return this; + } + ++ public AttributeProvider build() { return a(); } // Purpur - OBFHELPER + public AttributeProvider a() { + this.b = true; + return new AttributeProvider(this.a); +diff --git a/src/main/java/net/minecraft/server/ControllerLookDolphin.java b/src/main/java/net/minecraft/server/ControllerLookDolphin.java +index e5bdddfc1..8200ba60b 100644 +--- a/src/main/java/net/minecraft/server/ControllerLookDolphin.java ++++ b/src/main/java/net/minecraft/server/ControllerLookDolphin.java +@@ -1,6 +1,6 @@ + package net.minecraft.server; + +-public class ControllerLookDolphin extends ControllerLook { ++public class ControllerLookDolphin extends net.pl3x.purpur.controller.ControllerLookWASD { // Purpur + + private final int h; + +@@ -10,7 +10,7 @@ public class ControllerLookDolphin extends ControllerLook { + } + + @Override +- public void a() { ++ public void tick() { // Purpur + if (this.d) { + this.d = false; + this.a.aC = this.a(this.a.aC, this.h() + 20.0F, this.b); diff --git a/src/main/java/net/minecraft/server/ControllerMove.java b/src/main/java/net/minecraft/server/ControllerMove.java -index 6393ff765f..9515926b22 100644 +index 8f9fb058c..eaf446946 100644 --- a/src/main/java/net/minecraft/server/ControllerMove.java +++ b/src/main/java/net/minecraft/server/ControllerMove.java @@ -6,9 +6,9 @@ public class ControllerMove { @@ -21,8 +140,28 @@ index 6393ff765f..9515926b22 100644 protected ControllerMove.Operation h; public ControllerMove(EntityInsentient entityinsentient) { +diff --git a/src/main/java/net/minecraft/server/DamageSource.java b/src/main/java/net/minecraft/server/DamageSource.java +index bd0267ee4..8b36ac2b0 100644 +--- a/src/main/java/net/minecraft/server/DamageSource.java ++++ b/src/main/java/net/minecraft/server/DamageSource.java +@@ -56,6 +56,7 @@ public class DamageSource { + return new EntityDamageSource("mob", entityliving); + } + ++ public static DamageSource indirectMobAttack(Entity entity, EntityLiving entityliving) { return a(entity, entityliving); } // Purpur - OBFHELPER + public static DamageSource a(Entity entity, EntityLiving entityliving) { + return new EntityDamageSourceIndirect("mob", entity, entityliving); + } +@@ -117,6 +118,7 @@ public class DamageSource { + return this.B; + } + ++ public DamageSource setProjectile() { return c(); } // Purpur - OBFHELPER + public DamageSource c() { + this.B = true; + return this; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ae26a83873..446ba7b232 100644 +index c827e4628..6f5e43526 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -80,7 +80,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -34,6 +173,15 @@ index ae26a83873..446ba7b232 100644 boolean collisionLoadChunks = false; // Paper Throwable addedToWorldStack; // Paper - entity debug public CraftEntity getBukkitEntity() { +@@ -105,7 +105,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + private int id; + public boolean i; public final boolean blocksEntitySpawning() { return this.i; } // Paper - OBFHELPER + public final List passengers; +- protected int j; ++ protected int j; public int getRideCooldown() { return j; } // Purpur - OBFHELPER + @Nullable + private Entity vehicle; + public boolean attachedToPlayer; @@ -121,7 +121,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public float lastYaw; public float lastPitch; @@ -43,7 +191,7 @@ index ae26a83873..446ba7b232 100644 public boolean positionChanged; public boolean v; public boolean velocityChanged; -@@ -2202,6 +2202,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2194,6 +2194,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return this.a(entity, false); } @@ -51,11 +199,10 @@ index ae26a83873..446ba7b232 100644 public boolean a(Entity entity, boolean flag) { for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) { if (entity1.vehicle == this) { -@@ -2296,7 +2297,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } else { +@@ -2289,6 +2290,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.passengers.add(entity); } -- + + // Purpur start + if (isRidable() && passengers.get(0) == entity && entity instanceof EntityHuman) { + EntityHuman entityhuman = (EntityHuman) entity; @@ -66,7 +213,7 @@ index ae26a83873..446ba7b232 100644 } return true; // CraftBukkit } -@@ -2337,6 +2344,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2329,6 +2337,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return false; } // Spigot end @@ -79,15 +226,23 @@ index ae26a83873..446ba7b232 100644 this.passengers.remove(entity); entity.j = 60; } -@@ -2728,6 +2741,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2494,6 +2508,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + this.setFlag(4, flag); + } + ++ public boolean isGlowing() { return bD(); } // Purpur - OBFHELPER + public boolean bD() { + return this.glowing || this.world.isClientSide && this.getFlag(6); + } +@@ -2712,6 +2727,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public void setHeadRotation(float f) {} -+ public void setBodyYaw(float yaw) { l(yaw); } // Purpur - OBFHELPER - public void l(float f) {} ++ public void setBodyYaw(float yaw) { n(yaw); } // Purpur - OBFHELPER + public void n(float f) {} - public boolean bH() { -@@ -3141,6 +3155,18 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + public boolean bK() { +@@ -3134,6 +3150,18 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return false; } @@ -106,7 +261,7 @@ index ae26a83873..446ba7b232 100644 @Override public void sendMessage(IChatBaseComponent ichatbasecomponent, UUID uuid) {} -@@ -3580,4 +3606,39 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -3576,4 +3604,39 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke void accept(Entity entity, double d0, double d1, double d2); } @@ -146,8 +301,294 @@ index ae26a83873..446ba7b232 100644 + } + // Purpur end } +diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java +index b84aa1db8..ab7c43a5c 100644 +--- a/src/main/java/net/minecraft/server/EntityBat.java ++++ b/src/main/java/net/minecraft/server/EntityBat.java +@@ -14,9 +14,47 @@ public class EntityBat extends EntityAmbient { + + public EntityBat(EntityTypes entitytypes, World world) { + super(entitytypes, world); ++ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASDFlyingWithSpacebar(this, 0.075F); // Purpur + this.setAsleep(true); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.batRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.batRidableInWater; ++ } ++ ++ @Override ++ public double getMaxY() { ++ return world.purpurConfig.batMaxY; ++ } ++ ++ @Override ++ public void onMount(EntityHuman entityhuman) { ++ if (isAsleep()) { ++ setAsleep(false); ++ world.playEffect(null, 1025, new BlockPosition(this).up(), 0); ++ } ++ } ++ ++ @Override ++ public void g(Vec3D vec3d) { ++ super.g(vec3d); ++ if (hasRider() && !onGround) { ++ float speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue() * 2; ++ setSpeed(speed); ++ Vec3D mot = getMot(); ++ move(EnumMoveType.SELF, mot.multiply(speed, 0.25, speed)); ++ setMot(mot.a(0.9D)); ++ } ++ } ++ // Purpur end ++ + @Override + protected void initDatawatcher() { + super.initDatawatcher(); +@@ -61,7 +99,7 @@ public class EntityBat extends EntityAmbient { + protected void collideNearby() {} + + public static AttributeProvider.Builder m() { +- return EntityInsentient.p().a(GenericAttributes.MAX_HEALTH, 6.0D); ++ return EntityInsentient.p().a(GenericAttributes.MAX_HEALTH, 6.0D).a(GenericAttributes.FLYING_SPEED, 0.6D); // Purpur + } + + public boolean isAsleep() { +@@ -93,6 +131,13 @@ public class EntityBat extends EntityAmbient { + + @Override + protected void mobTick() { ++ // Purpur start ++ if (hasRider()) { ++ Vec3D mot = getMot(); ++ setMot(mot.x, mot.y + (getVertical() > 0 ? 0.07D : 0.0D), mot.z); ++ return; ++ } ++ // Purpur end + super.mobTick(); + BlockPosition blockposition = this.getChunkCoordinates(); + BlockPosition blockposition1 = blockposition.up(); +diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java +index b1ff30fb1..0ed37e18f 100644 +--- a/src/main/java/net/minecraft/server/EntityBee.java ++++ b/src/main/java/net/minecraft/server/EntityBee.java +@@ -37,6 +37,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB + + public EntityBee(EntityTypes entitytypes, World world) { + super(entitytypes, world); ++ final net.pl3x.purpur.controller.ControllerMoveWASDFlying flyingController = new net.pl3x.purpur.controller.ControllerMoveWASDFlying(this, 0.25F, false); // Purpur + // Paper start - apply gravity to bees when they get stuck in the void, fixes MC-167279 + this.moveController = new ControllerMoveFlying(this, 20, true) { + @Override +@@ -46,6 +47,22 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB + } + super.tick(); + } ++ ++ // Purpur start ++ @Override ++ public void a() { // tick ++ if (getEntity().hasRider()) { ++ flyingController.tick(getEntity().getRider()); ++ } else { ++ tick(); ++ } ++ } ++ ++ @Override ++ public boolean b() { // isUpdating ++ return getEntity().hasRider() || super.b(); ++ } ++ // Purpur end + }; + // Paper end + this.lookController = new EntityBee.j(this); +@@ -56,6 +73,35 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB + this.a(PathType.FENCE, -1.0F); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.beeRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.beeRidableInWater; ++ } ++ ++ @Override ++ public double getMaxY() { ++ return world.purpurConfig.beeMaxY; ++ } ++ ++ @Override ++ public void g(Vec3D vec3d) { ++ super.g(vec3d); ++ if (hasRider() && !onGround) { ++ float speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue() * 2; ++ setSpeed(speed); ++ Vec3D mot = getMot(); ++ move(EnumMoveType.SELF, mot.multiply(speed, speed, speed)); ++ setMot(mot.a(0.9D)); ++ } ++ } ++ // Purpur end ++ + @Override + protected void initDatawatcher() { + super.initDatawatcher(); +@@ -70,6 +116,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB + + @Override + protected void initPathfinder() { ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.goalSelector.a(0, new EntityBee.b(this, 1.399999976158142D, true)); + this.goalSelector.a(1, new EntityBee.d()); + this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D)); +@@ -85,6 +132,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB + this.goalSelector.a(7, new EntityBee.g()); + this.goalSelector.a(8, new EntityBee.l()); + this.goalSelector.a(9, new PathfinderGoalFloat(this)); ++ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.targetSelector.a(1, (new EntityBee.h(this)).a(new Class[0])); + this.targetSelector.a(2, new EntityBee.c(this)); + this.targetSelector.a(3, new PathfinderGoalUniversalAngerReset<>(this, true)); +@@ -555,6 +603,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB + + private d() { + super(); // CraftBukkit - decompile error ++ this.a(EnumSet.of(PathfinderGoal.Type.UNKNOWN_BEHAVIOR)); // Purpur - enter hive + } + + @Override +@@ -617,6 +666,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB + + private g() { + super(); // CraftBukkit - decompile error ++ this.a(EnumSet.of(PathfinderGoal.Type.UNKNOWN_BEHAVIOR)); // Purpur - grow crop + } + + @Override +@@ -681,6 +731,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB + + private i() { + super(); // CraftBukkit - decompile error ++ this.a(EnumSet.of(PathfinderGoal.Type.UNKNOWN_BEHAVIOR)); // Purpur - go to hive + } + + @Override +@@ -904,16 +955,16 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB + } + } + +- class j extends ControllerLook { ++ class j extends net.pl3x.purpur.controller.ControllerLookWASD { // Purpur + + j(EntityInsentient entityinsentient) { + super(entityinsentient); + } + + @Override +- public void a() { ++ public void tick() { // Purpur + if (!EntityBee.this.isAngry()) { +- super.a(); ++ super.tick(); // Purpur + } + } + +diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java +index f55f12530..22b9c84b0 100644 +--- a/src/main/java/net/minecraft/server/EntityBlaze.java ++++ b/src/main/java/net/minecraft/server/EntityBlaze.java +@@ -10,6 +10,7 @@ public class EntityBlaze extends EntityMonster { + + public EntityBlaze(EntityTypes entitytypes, World world) { + super(entitytypes, world); ++ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASDFlyingWithSpacebar(this, 0.3F); // Purpur + this.a(PathType.WATER, -1.0F); + this.a(PathType.LAVA, 8.0F); + this.a(PathType.DANGER_FIRE, 0.0F); +@@ -17,19 +18,50 @@ public class EntityBlaze extends EntityMonster { + this.f = 10; + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.blazeRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.blazeRidableInWater; ++ } ++ ++ @Override ++ public double getMaxY() { ++ return world.purpurConfig.blazeMaxY; ++ } ++ ++ @Override ++ public void g(Vec3D vec3d) { ++ super.g(vec3d); ++ if (hasRider() && !onGround) { ++ float speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue(); ++ setSpeed(speed); ++ Vec3D mot = getMot(); ++ move(EnumMoveType.SELF, mot.multiply(speed, 1.0, speed)); ++ setMot(mot.a(0.9D)); ++ } ++ } ++ // Purpur end ++ + @Override + protected void initPathfinder() { ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.goalSelector.a(4, new EntityBlaze.PathfinderGoalBlazeFireball(this)); + this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D)); + this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D, 0.0F)); + this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); + this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); +- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a()); ++ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur ++ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // Purpur - decompile error + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); + } + + public static AttributeProvider.Builder m() { +- return EntityMonster.eR().a(GenericAttributes.ATTACK_DAMAGE, 6.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.23000000417232513D).a(GenericAttributes.FOLLOW_RANGE, 48.0D); ++ return EntityMonster.eR().a(GenericAttributes.ATTACK_DAMAGE, 6.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.23000000417232513D).a(GenericAttributes.FOLLOW_RANGE, 48.0D).a(GenericAttributes.FLYING_SPEED, 0.6D); // Purpur + } + + @Override +@@ -84,6 +116,14 @@ public class EntityBlaze extends EntityMonster { + + @Override + protected void mobTick() { ++ // Purpur start ++ if (hasRider()) { ++ Vec3D mot = getMot(); ++ setMot(mot.x, getVertical() > 0 ? 0.07D : -0.07D, mot.z); ++ return; ++ } ++ // Purpur end ++ + --this.c; + if (this.c <= 0) { + this.c = 100; diff --git a/src/main/java/net/minecraft/server/EntityCat.java b/src/main/java/net/minecraft/server/EntityCat.java -index 20497c3962..cef2787eb8 100644 +index 314886398..ad988447a 100644 --- a/src/main/java/net/minecraft/server/EntityCat.java +++ b/src/main/java/net/minecraft/server/EntityCat.java @@ -41,6 +41,25 @@ public class EntityCat extends EntityTameableAnimal { @@ -173,42 +614,42 @@ index 20497c3962..cef2787eb8 100644 + } + // Purpur end + - public MinecraftKey eV() { - return (MinecraftKey) EntityCat.bx.getOrDefault(this.getCatType(), EntityCat.bx.get(0)); + public MinecraftKey eU() { + return (MinecraftKey) EntityCat.bq.getOrDefault(this.getCatType(), EntityCat.bq.get(0)); } @@ -48,7 +67,8 @@ public class EntityCat extends EntityTameableAnimal { @Override protected void initPathfinder() { - this.bE = new EntityCat.PathfinderGoalTemptChance(this, 0.6D, EntityCat.by, true); + this.bx = new EntityCat.PathfinderGoalTemptChance(this, 0.6D, EntityCat.br, true); - this.goalSelector.a(1, new PathfinderGoalFloat(this)); + this.goalSelector.a(0, new PathfinderGoalFloat(this)); // Purpur + this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.goalSelector.a(1, new PathfinderGoalSit(this)); this.goalSelector.a(2, new EntityCat.b(this)); - this.goalSelector.a(3, this.bE); + this.goalSelector.a(3, this.bx); @@ -60,6 +80,7 @@ public class EntityCat extends EntityTameableAnimal { this.goalSelector.a(10, new PathfinderGoalBreed(this, 0.8D)); this.goalSelector.a(11, new PathfinderGoalRandomStrollLand(this, 0.8D, 1.0000001E-5F)); this.goalSelector.a(12, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 10.0F)); + this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed<>(this, EntityRabbit.class, false, (Predicate) null)); - this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed<>(this, EntityTurtle.class, false, EntityTurtle.bv)); + this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed<>(this, EntityTurtle.class, false, EntityTurtle.bo)); } @@ -76,6 +97,7 @@ public class EntityCat extends EntityTameableAnimal { - this.datawatcher.set(EntityCat.bz, i); + this.datawatcher.set(EntityCat.bs, i); } + public void setSleepingWithOwner(boolean flag) { x(flag); } // Purpur - OBFHELPER public void x(boolean flag) { - this.datawatcher.set(EntityCat.bA, flag); + this.datawatcher.set(EntityCat.bt, flag); } @@ -84,6 +106,7 @@ public class EntityCat extends EntityTameableAnimal { - return (Boolean) this.datawatcher.get(EntityCat.bA); + return (Boolean) this.datawatcher.get(EntityCat.bt); } + public void setHeadDown(boolean flag) { y(flag); } // Purpur - OBFHELPER public void y(boolean flag) { - this.datawatcher.set(EntityCat.bB, flag); + this.datawatcher.set(EntityCat.bu, flag); } @@ -302,6 +325,7 @@ public class EntityCat extends EntityTameableAnimal { @@ -227,7 +668,7 @@ index 20497c3962..cef2787eb8 100644 @Override diff --git a/src/main/java/net/minecraft/server/EntityCaveSpider.java b/src/main/java/net/minecraft/server/EntityCaveSpider.java -index 346b77083c..eca1cbd7f7 100644 +index 776f3d25a..2e1f2dec1 100644 --- a/src/main/java/net/minecraft/server/EntityCaveSpider.java +++ b/src/main/java/net/minecraft/server/EntityCaveSpider.java @@ -8,6 +8,18 @@ public class EntityCaveSpider extends EntitySpider { @@ -247,10 +688,10 @@ index 346b77083c..eca1cbd7f7 100644 + // Purpur end + public static AttributeProvider.Builder m() { - return EntitySpider.eL().a(GenericAttributes.MAX_HEALTH, 12.0D); + return EntitySpider.eK().a(GenericAttributes.MAX_HEALTH, 12.0D); } diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java -index 137eada653..e772d90aec 100644 +index 26dee32bf..feca1b369 100644 --- a/src/main/java/net/minecraft/server/EntityChicken.java +++ b/src/main/java/net/minecraft/server/EntityChicken.java @@ -18,6 +18,16 @@ public class EntityChicken extends EntityAnimal { @@ -277,7 +718,7 @@ index 137eada653..e772d90aec 100644 + this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur //this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D)); // Purpur - moved down this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D)); - this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, false, EntityChicken.bC)); + this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, false, EntityChicken.bv)); @@ -41,6 +52,7 @@ public class EntityChicken extends EntityAnimal { // Purpur start if (world.purpurConfig.chickenRetaliate) { @@ -286,8 +727,31 @@ index 137eada653..e772d90aec 100644 this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this)); } else { this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D)); +diff --git a/src/main/java/net/minecraft/server/EntityCod.java b/src/main/java/net/minecraft/server/EntityCod.java +index 9a99af6e9..039fae4c2 100644 +--- a/src/main/java/net/minecraft/server/EntityCod.java ++++ b/src/main/java/net/minecraft/server/EntityCod.java +@@ -6,6 +6,18 @@ public class EntityCod extends EntityFishSchool { + super(entitytypes, world); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.codRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return true; ++ } ++ // Purpur end ++ + @Override + protected ItemStack eK() { + return new ItemStack(Items.COD_BUCKET); diff --git a/src/main/java/net/minecraft/server/EntityComplexPart.java b/src/main/java/net/minecraft/server/EntityComplexPart.java -index 920f4c7671..7fec83387a 100644 +index c1b1bd123..26ff230ef 100644 --- a/src/main/java/net/minecraft/server/EntityComplexPart.java +++ b/src/main/java/net/minecraft/server/EntityComplexPart.java @@ -47,4 +47,11 @@ public class EntityComplexPart extends Entity { @@ -303,7 +767,7 @@ index 920f4c7671..7fec83387a 100644 + // Purpur end } diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java -index d6baddb9d3..69537c6278 100644 +index cfb009c81..18c2d5393 100644 --- a/src/main/java/net/minecraft/server/EntityCow.java +++ b/src/main/java/net/minecraft/server/EntityCow.java @@ -11,9 +11,22 @@ public class EntityCow extends EntityAnimal { @@ -387,13 +851,13 @@ index d6baddb9d3..69537c6278 100644 this.world.addEntity(mooshroom); this.die(); diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java -index 2d5aab9e24..c387b3f56a 100644 +index 013639cc9..3ddfb5f34 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -18,12 +18,27 @@ public class EntityCreeper extends EntityMonster { public int maxFuseTicks = 30; public int explosionRadius = 3; - private int bz; + private int bs; + // Purpur start + private int spacebarCharge = 0; + private int prevSpacebarCharge = 0; @@ -416,11 +880,11 @@ index 2d5aab9e24..c387b3f56a 100644 + } + @Override - public GroupDataEntity prepare(GeneratorAccess generatoraccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, GroupDataEntity groupdataentity, NBTTagCompound nbttagcompound) { - double chance = generatoraccess.getMinecraftWorld().purpurConfig.creeperChargedChance; + public GroupDataEntity prepare(WorldAccess worldaccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @javax.annotation.Nullable GroupDataEntity groupdataentity, @javax.annotation.Nullable NBTTagCompound nbttagcompound) { + double chance = worldaccess.getMinecraftWorld().purpurConfig.creeperChargedChance; @@ -32,18 +47,69 @@ public class EntityCreeper extends EntityMonster { } - return super.prepare(generatoraccess, difficultydamagescaler, enummobspawn, groupdataentity, nbttagcompound); + return super.prepare(worldaccess, difficultydamagescaler, enummobspawn, groupdataentity, nbttagcompound); } + + @Override @@ -504,11 +968,144 @@ index 2d5aab9e24..c387b3f56a 100644 } } // Paper end +diff --git a/src/main/java/net/minecraft/server/EntityDolphin.java b/src/main/java/net/minecraft/server/EntityDolphin.java +index 0f51dbf8d..09a3a00e3 100644 +--- a/src/main/java/net/minecraft/server/EntityDolphin.java ++++ b/src/main/java/net/minecraft/server/EntityDolphin.java +@@ -17,6 +17,7 @@ public class EntityDolphin extends EntityWaterAnimal { + public static final Predicate b = (entityitem) -> { + return !entityitem.p() && entityitem.isAlive() && entityitem.isInWater(); + }; ++ private int spitCooldown; // Purpur + + public EntityDolphin(EntityTypes entitytypes, World world) { + super(entitytypes, world); +@@ -25,6 +26,45 @@ public class EntityDolphin extends EntityWaterAnimal { + this.setCanPickupLoot(true); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.dolphinRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return true; ++ } ++ ++ @Override ++ public boolean onSpacebar() { ++ if (spitCooldown == 0 && hasRider()) { ++ spitCooldown = world.purpurConfig.dolphinSpitCooldown; ++ if (!hasRider()) { ++ return false; ++ } ++ ++ org.bukkit.craftbukkit.entity.CraftPlayer player = (org.bukkit.craftbukkit.entity.CraftPlayer) getRider().getBukkitEntity(); ++ if (!player.hasPermission("allow.special.dolphin")) { ++ return false; ++ } ++ ++ org.bukkit.Location loc = player.getEyeLocation(); ++ loc.setPitch(loc.getPitch() - 10); ++ org.bukkit.util.Vector target = loc.getDirection().normalize().multiply(10).add(loc.toVector()); ++ ++ net.pl3x.purpur.entity.DolphinSpit spit = new net.pl3x.purpur.entity.DolphinSpit(world, this); ++ spit.shoot(target.getX() - locX(), target.getY() - locY(), target.getZ() - locZ(), world.purpurConfig.dolphinSpitSpeed, 5.0F); ++ ++ world.addEntity(spit); ++ playSound(SoundEffects.ENTITY_DOLPHIN_ATTACK, 1.0F, 1.0F + (random.nextFloat() - random.nextFloat()) * 0.2F); ++ return true; ++ } ++ return false; ++ } ++ // Purpur end ++ + @Nullable + @Override + public GroupDataEntity prepare(WorldAccess worldaccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) { +@@ -99,6 +139,7 @@ public class EntityDolphin extends EntityWaterAnimal { + protected void initPathfinder() { + this.goalSelector.a(0, new PathfinderGoalBreath(this)); + this.goalSelector.a(0, new PathfinderGoalWater(this)); ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.goalSelector.a(1, new EntityDolphin.b(this)); + this.goalSelector.a(2, new EntityDolphin.c(this, 4.0D)); + this.goalSelector.a(4, new PathfinderGoalRandomSwim(this, 1.0D, 10)); +@@ -109,6 +150,7 @@ public class EntityDolphin extends EntityWaterAnimal { + this.goalSelector.a(8, new EntityDolphin.d()); + this.goalSelector.a(8, new PathfinderGoalFollowBoat(this)); + this.goalSelector.a(9, new PathfinderGoalAvoidTarget<>(this, EntityGuardian.class, 8.0F, 1.0D, 1.0D)); ++ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityGuardian.class})).a(new Class[0])); // CraftBukkit - decompile error + } + +@@ -160,7 +202,7 @@ public class EntityDolphin extends EntityWaterAnimal { + + @Override + protected boolean n(Entity entity) { +- return true; ++ return getRideCooldown() <= 0; // Purpur - make dolphin honor ride cooldown like all other non-boss mobs + } + + @Override +@@ -194,6 +236,9 @@ public class EntityDolphin extends EntityWaterAnimal { + @Override + public void tick() { + super.tick(); ++ if (spitCooldown > 0) { ++ spitCooldown--; ++ } + if (this.isNoAI()) { + this.setAirTicks(this.bG()); + } else { +@@ -467,7 +512,7 @@ public class EntityDolphin extends EntityWaterAnimal { + + private int b; + +- private d() {} ++ private d() { this.a(java.util.EnumSet.of(PathfinderGoal.Type.MOVE)); } // Purpur - play with item + + @Override + public boolean a() { +@@ -535,7 +580,7 @@ public class EntityDolphin extends EntityWaterAnimal { + } + } + +- static class a extends ControllerMove { ++ static class a extends net.pl3x.purpur.controller.ControllerMoveWASDWater { // Purpur + + private final EntityDolphin i; + +@@ -545,7 +590,20 @@ public class EntityDolphin extends EntityWaterAnimal { + } + + @Override +- public void a() { ++ // Purpur start ++ public void tick(EntityHuman rider) { ++ if (this.i.getAirTicks() < 150) { ++ // if drowning override player WASD controls to find air ++ tick(); ++ } else { ++ super.tick(rider); ++ this.i.setMot(this.i.getMot().add(0.0D, 0.005D, 0.0D)); ++ } ++ } ++ ++ @Override ++ public void tick() { ++ // Purpur end + if (this.i.isInWater()) { + this.i.setMot(this.i.getMot().add(0.0D, 0.005D, 0.0D)); + } diff --git a/src/main/java/net/minecraft/server/EntityDrowned.java b/src/main/java/net/minecraft/server/EntityDrowned.java -index 6fc8d1213a..7879b70c5c 100644 +index 6853ba319..8aa53c617 100644 --- a/src/main/java/net/minecraft/server/EntityDrowned.java +++ b/src/main/java/net/minecraft/server/EntityDrowned.java -@@ -20,6 +20,16 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { +@@ -22,6 +22,16 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { } // Purpur start @@ -525,7 +1122,7 @@ index 6fc8d1213a..7879b70c5c 100644 @Override public boolean jockeyOnlyBaby() { return world.purpurConfig.drownedJockeyOnlyBaby; -@@ -217,7 +227,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { +@@ -219,7 +229,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { this.d = flag; } @@ -534,7 +1131,7 @@ index 6fc8d1213a..7879b70c5c 100644 private final EntityDrowned i; -@@ -227,7 +237,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { +@@ -229,7 +239,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { } @Override @@ -542,8 +1139,8 @@ index 6fc8d1213a..7879b70c5c 100644 + public void tick() { // Purpur EntityLiving entityliving = this.i.getGoalTarget(); - if (this.i.eX() && this.i.isInWater()) { -@@ -260,7 +270,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { + if (this.i.eW() && this.i.isInWater()) { +@@ -262,7 +272,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { this.i.setMot(this.i.getMot().add(0.0D, -0.008D, 0.0D)); } @@ -552,7 +1149,7 @@ index 6fc8d1213a..7879b70c5c 100644 } } -@@ -399,6 +409,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { +@@ -401,6 +411,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { this.a = entitydrowned; this.b = d0; this.c = i; @@ -561,7 +1158,7 @@ index 6fc8d1213a..7879b70c5c 100644 @Override diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index 245fc38def..a1c6679f0d 100644 +index fde60d6c8..768764930 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -30,9 +30,22 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { @@ -592,22 +1189,22 @@ index 245fc38def..a1c6679f0d 100644 this.goalSelector.a(10, new EntityEnderman.PathfinderGoalEndermanPlaceBlock(this)); this.goalSelector.a(11, new EntityEnderman.PathfinderGoalEndermanPickupBlock(this)); + this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur - this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::b)); - this.targetSelector.a(2, new EntityEnderman.PathfinderGoalPlayerWhoLookedAtTarget(this)); - this.targetSelector.a(3, new PathfinderGoalHurtByTarget(this, new Class[0])); -@@ -221,7 +235,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { + this.targetSelector.a(1, new EntityEnderman.PathfinderGoalPlayerWhoLookedAtTarget(this, this::a_)); + this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, new Class[0])); + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityEndermite.class, 10, true, false, EntityEnderman.bq)); +@@ -220,7 +234,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { @Override protected void mobTick() { -- if (this.world.isDay() && this.ticksLived >= this.bz + 600) { -+ if (!hasRider() && this.world.isDay() && this.ticksLived >= this.bz + 600) { // Purpur - no random teleporting - float f = this.aO(); +- if (this.world.isDay() && this.ticksLived >= this.bs + 600) { ++ if (!hasRider() && this.world.isDay() && this.ticksLived >= this.bs + 600) { // Purpur - no random teleporting + float f = this.aQ(); - if (f > 0.5F && this.world.f(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper + if (f > 0.5F && this.world.e(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper @@ -322,6 +336,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { - public boolean damageEntity(DamageSource damagesource, float f) { if (this.isInvulnerable(damagesource)) { return false; + } else if (net.pl3x.purpur.PurpurConfig.endermanShortHeight && damagesource == DamageSource.STUCK) { return false; // Purpur - no suffocation damage if short height + } else if (hasRider()) { return super.damageEntity(damagesource, f); // Purpur - no teleporting on damage } else if (damagesource instanceof EntityDamageSourceIndirect) { if (this.tryEscape(EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start @@ -620,7 +1217,7 @@ index 245fc38def..a1c6679f0d 100644 } @Override -@@ -410,6 +426,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -408,6 +424,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { public PathfinderGoalEndermanPlaceBlock(EntityEnderman entityenderman) { this.a = entityenderman; @@ -629,7 +1226,7 @@ index 245fc38def..a1c6679f0d 100644 @Override diff --git a/src/main/java/net/minecraft/server/EntityEndermite.java b/src/main/java/net/minecraft/server/EntityEndermite.java -index a85489d56b..24d68bbb55 100644 +index c4b1f318f..30f602bbc 100644 --- a/src/main/java/net/minecraft/server/EntityEndermite.java +++ b/src/main/java/net/minecraft/server/EntityEndermite.java @@ -12,14 +12,28 @@ public class EntityEndermite extends EntityMonster { @@ -663,7 +1260,7 @@ index a85489d56b..24d68bbb55 100644 } diff --git a/src/main/java/net/minecraft/server/EntityEvoker.java b/src/main/java/net/minecraft/server/EntityEvoker.java -index c37c2930e7..843e392395 100644 +index 4bea4ca7e..533b2bd4f 100644 --- a/src/main/java/net/minecraft/server/EntityEvoker.java +++ b/src/main/java/net/minecraft/server/EntityEvoker.java @@ -12,10 +12,23 @@ public class EntityEvoker extends EntityIllagerWizard { @@ -714,7 +1311,7 @@ index c37c2930e7..843e392395 100644 } @Override -@@ -237,6 +253,7 @@ public class EntityEvoker extends EntityIllagerWizard { +@@ -239,6 +255,7 @@ public class EntityEvoker extends EntityIllagerWizard { private a() { super(); @@ -723,20 +1320,82 @@ index c37c2930e7..843e392395 100644 @Override diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java -index db1ede61c5..d1803eca27 100644 +index 27d0f9351..d281114e5 100644 --- a/src/main/java/net/minecraft/server/EntityFish.java +++ b/src/main/java/net/minecraft/server/EntityFish.java -@@ -75,7 +75,7 @@ public abstract class EntityFish extends EntityWaterAnimal { - Predicate predicate = IEntitySelector.g; - - predicate.getClass(); +@@ -70,13 +70,12 @@ public abstract class EntityFish extends EntityWaterAnimal { + @Override + protected void initPathfinder() { + super.initPathfinder(); +- this.goalSelector.a(0, new PathfinderGoalPanic(this, 1.25D)); +- PathfinderGoalSelector pathfindergoalselector = this.goalSelector; +- Predicate predicate = IEntitySelector.g; +- +- predicate.getClass(); - pathfindergoalselector.a(2, new PathfinderGoalAvoidTarget<>(this, EntityHuman.class, 8.0F, 1.6D, 1.4D, predicate::test)); -+ pathfindergoalselector.a(2, new PathfinderGoalAvoidTarget(this, EntityHuman.class, 8.0F, 1.6D, 1.4D, predicate::test)); // Purpur - decompile error - this.goalSelector.a(4, new EntityFish.b(this)); +- this.goalSelector.a(4, new EntityFish.b(this)); ++ // Purpur start ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur ++ this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.25D)); ++ this.goalSelector.a(3, new PathfinderGoalAvoidTarget<>(this, EntityHuman.class, 8.0F, 1.6D, 1.4D, IEntitySelector.g::test)); // Purpur - decompile error ++ this.goalSelector.a(5, new EntityFish.b(this)); ++ // Purpur end } + @Override +@@ -87,7 +86,7 @@ public abstract class EntityFish extends EntityWaterAnimal { + @Override + public void g(Vec3D vec3d) { + if (this.doAITick() && this.isInWater()) { +- this.a(0.01F, vec3d); ++ this.a(hasRider() ? getSpeed() : 0.1F, vec3d); // Purpur + this.move(EnumMoveType.SELF, this.getMot()); + this.setMot(this.getMot().a(0.9D)); + if (this.getGoalTarget() == null) { +@@ -161,9 +160,9 @@ public abstract class EntityFish extends EntityWaterAnimal { + @Override + protected void b(BlockPosition blockposition, IBlockData iblockdata) {} + +- static class a extends ControllerMove { ++ static class a extends net.pl3x.purpur.controller.ControllerMoveWASDWater { // Purpur + +- private final EntityFish i; ++ private final EntityFish i; public EntityFish getFish() { return i; } // Purpur - OBFHELPER + + a(EntityFish entityfish) { + super(entityfish); +@@ -171,7 +170,15 @@ public abstract class EntityFish extends EntityWaterAnimal { + } + + @Override +- public void a() { ++ // Purpur start ++ public void tick(EntityHuman rider) { ++ super.tick(rider); ++ getFish().setMot(getFish().getMot().add(0.0D, 0.005D, 0.0D)); ++ } ++ ++ @Override ++ public void tick() { ++ // Purpur end + if (this.i.a((Tag) TagsFluid.WATER)) { + this.i.setMot(this.i.getMot().add(0.0D, 0.005D, 0.0D)); + } +diff --git a/src/main/java/net/minecraft/server/EntityFishSchool.java b/src/main/java/net/minecraft/server/EntityFishSchool.java +index 08372b722..6a8e15f01 100644 +--- a/src/main/java/net/minecraft/server/EntityFishSchool.java ++++ b/src/main/java/net/minecraft/server/EntityFishSchool.java +@@ -16,7 +16,7 @@ public abstract class EntityFishSchool extends EntityFish { + @Override + protected void initPathfinder() { + super.initPathfinder(); +- this.goalSelector.a(5, new PathfinderGoalFishSchool(this)); ++ this.goalSelector.a(6, new PathfinderGoalFishSchool(this)); // Purpur + } + + @Override diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java -index 90b01adbec..26de8c3ad6 100644 +index f47a78e56..a3447a530 100644 --- a/src/main/java/net/minecraft/server/EntityFox.java +++ b/src/main/java/net/minecraft/server/EntityFox.java @@ -55,6 +55,39 @@ public class EntityFox extends EntityAnimal { @@ -793,10 +1452,10 @@ index 90b01adbec..26de8c3ad6 100644 this.goalSelector.a(13, new EntityFox.r()); + this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.targetSelector.a(3, new EntityFox.a(EntityLiving.class, false, false, (entityliving) -> { - return EntityFox.bA.test(entityliving) && !this.c(entityliving.getUniqueID()); + return EntityFox.bt.test(entityliving) && !this.c(entityliving.getUniqueID()); })); @@ -386,6 +421,7 @@ public class EntityFox extends EntityAnimal { - return itemstack1.isEmpty() || this.bK > 0 && item.isFood() && !itemstack1.getItem().isFood(); + return itemstack1.isEmpty() || this.bD > 0 && item.isFood() && !itemstack1.getItem().isFood(); } + public void spit(ItemStack itemstack) { m(itemstack); } // Purpur - OBFHELPER @@ -815,8 +1474,8 @@ index 90b01adbec..26de8c3ad6 100644 this.setSleeping(false); } -+ public void stopActions() { fe(); } // Purpur - OBFHELPER - private void fe() { ++ public void stopActions() { fd(); } // Purpur - OBFHELPER + private void fd() { this.w(false); this.setCrouching(false); @@ -687,16 +725,16 @@ public class EntityFox extends EntityAnimal { @@ -839,7 +1498,7 @@ index 90b01adbec..26de8c3ad6 100644 } } -@@ -1365,16 +1403,16 @@ public class EntityFox extends EntityAnimal { +@@ -1366,16 +1404,16 @@ public class EntityFox extends EntityAnimal { } } @@ -853,14 +1512,88 @@ index 90b01adbec..26de8c3ad6 100644 @Override - public void a() { + public void tick() { // Purpur - if (EntityFox.this.ff()) { + if (EntityFox.this.fe()) { - super.a(); + super.tick(); // Purpur } } +diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java +index a67611c4f..e857d6f85 100644 +--- a/src/main/java/net/minecraft/server/EntityGhast.java ++++ b/src/main/java/net/minecraft/server/EntityGhast.java +@@ -14,11 +14,42 @@ public class EntityGhast extends EntityFlying implements IMonster { + this.moveController = new EntityGhast.ControllerGhast(this); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.ghastRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.ghastRidableInWater; ++ } ++ ++ @Override ++ public double getMaxY() { ++ return world.purpurConfig.ghastMaxY; ++ } ++ ++ @Override ++ public void g(Vec3D vec3d) { ++ super.g(vec3d); ++ if (hasRider() && !onGround) { ++ float speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue(); ++ setSpeed(speed); ++ Vec3D mot = getMot(); ++ move(EnumMoveType.SELF, mot.multiply(speed, 1.0, speed)); ++ setMot(mot.a(0.9D)); ++ } ++ } ++ // Purpur end ++ + @Override + protected void initPathfinder() { ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.goalSelector.a(5, new EntityGhast.PathfinderGoalGhastIdleMove(this)); + this.goalSelector.a(7, new EntityGhast.PathfinderGoalGhastMoveTowardsTarget(this)); + this.goalSelector.a(7, new EntityGhast.PathfinderGoalGhastAttackTarget(this)); ++ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, (entityliving) -> { + return Math.abs(entityliving.locY() - this.locY()) <= 4.0D; + })); +@@ -56,7 +87,7 @@ public class EntityGhast extends EntityFlying implements IMonster { + } + + public static AttributeProvider.Builder eJ() { +- return EntityInsentient.p().a(GenericAttributes.MAX_HEALTH, 10.0D).a(GenericAttributes.FOLLOW_RANGE, 100.0D); ++ return EntityInsentient.p().a(GenericAttributes.MAX_HEALTH, 10.0D).a(GenericAttributes.FOLLOW_RANGE, 100.0D).a(GenericAttributes.FLYING_SPEED, 0.6D); // Purpur + } + + @Override +@@ -255,7 +286,7 @@ public class EntityGhast extends EntityFlying implements IMonster { + } + } + +- static class ControllerGhast extends ControllerMove { ++ static class ControllerGhast extends net.pl3x.purpur.controller.ControllerMoveWASDFlying { // Purpur + + private final EntityGhast i; + private int j; +@@ -266,7 +297,7 @@ public class EntityGhast extends EntityFlying implements IMonster { + } + + @Override +- public void a() { ++ public void tick() { // Purpur + if (this.h == ControllerMove.Operation.MOVE_TO) { + if (this.j-- <= 0) { + this.j += this.i.getRandom().nextInt(5) + 2; diff --git a/src/main/java/net/minecraft/server/EntityGiantZombie.java b/src/main/java/net/minecraft/server/EntityGiantZombie.java -index 143041003d..d7c5a3153e 100644 +index 8dce2aad7..24eb6dca5 100644 --- a/src/main/java/net/minecraft/server/EntityGiantZombie.java +++ b/src/main/java/net/minecraft/server/EntityGiantZombie.java @@ -11,16 +11,28 @@ public class EntityGiantZombie extends EntityMonster { @@ -892,11 +1625,138 @@ index 143041003d..d7c5a3153e 100644 this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this).a(EntityPigZombie.class)); this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillager.class, false)); +diff --git a/src/main/java/net/minecraft/server/EntityGuardian.java b/src/main/java/net/minecraft/server/EntityGuardian.java +index 2d0f64d3b..be060cfbd 100644 +--- a/src/main/java/net/minecraft/server/EntityGuardian.java ++++ b/src/main/java/net/minecraft/server/EntityGuardian.java +@@ -24,15 +24,36 @@ public class EntityGuardian extends EntityMonster { + this.f = 10; + this.a(PathType.WATER, 0.0F); + this.moveController = new EntityGuardian.ControllerMoveGuardian(this); ++ // Purpur start ++ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this) { ++ @Override ++ public void setYawPitch(float yaw, float pitch) { ++ super.setYawPitch(yaw, pitch * 0.35F); ++ } ++ }; ++ // Purpur end + this.bo = this.random.nextFloat(); + this.bp = this.bo; + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.guardianRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return true; ++ } ++ // Purpur end ++ + @Override + protected void initPathfinder() { + PathfinderGoalMoveTowardsRestriction pathfindergoalmovetowardsrestriction = new PathfinderGoalMoveTowardsRestriction(this, 1.0D); + + this.goalRandomStroll = new PathfinderGoalRandomStroll(this, 1.0D, 80); ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.goalSelector.a(4, new EntityGuardian.PathfinderGoalGuardianAttack(this)); + this.goalSelector.a(5, pathfindergoalmovetowardsrestriction); + this.goalSelector.a(7, this.goalRandomStroll); +@@ -41,6 +62,7 @@ public class EntityGuardian extends EntityMonster { + this.goalSelector.a(9, new PathfinderGoalRandomLookaround(this)); + this.goalRandomStroll.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK)); + pathfindergoalmovetowardsrestriction.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK)); ++ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget<>(this, EntityLiving.class, 10, true, false, new EntityGuardian.EntitySelectorGuardianTargetHumanSquid(this))); + } + +@@ -74,6 +96,7 @@ public class EntityGuardian extends EntityMonster { + return (Boolean) this.datawatcher.get(EntityGuardian.b); + } + ++ private void setMovingFlag(boolean movingFlag) { t(movingFlag); } // Purpur - OBFHELPER + private void t(boolean flag) { + this.datawatcher.set(EntityGuardian.b, flag); + } +@@ -288,7 +311,7 @@ public class EntityGuardian extends EntityMonster { + @Override + public void g(Vec3D vec3d) { + if (this.doAITick() && this.isInWater()) { +- this.a(0.1F, vec3d); ++ this.a(hasRider() ? getSpeed() : 0.1F, vec3d); // Purpur + this.move(EnumMoveType.SELF, this.getMot()); + this.setMot(this.getMot().a(0.9D)); + if (!this.eN() && this.getGoalTarget() == null) { +@@ -300,17 +323,26 @@ public class EntityGuardian extends EntityMonster { + + } + +- static class ControllerMoveGuardian extends ControllerMove { ++ static class ControllerMoveGuardian extends net.pl3x.purpur.controller.ControllerMoveWASDWater { // Purpur + +- private final EntityGuardian i; ++ private final EntityGuardian i; private EntityGuardian getGuardian() { return i; } // Purpur - OBFHELPER + + public ControllerMoveGuardian(EntityGuardian entityguardian) { + super(entityguardian); + this.i = entityguardian; + } + ++ // Purpur start ++ @Override ++ public void tick(EntityHuman rider) { ++ super.tick(rider); ++ getGuardian().setMot(getGuardian().getMot().add(0.0D, 0.005D, 0.0D)); ++ getGuardian().setMovingFlag(getGuardian().getForward() > 0.0F); // control tail speed ++ } ++ // Purpur end ++ + @Override +- public void a() { ++ public void tick() { // Purpur + if (this.h == ControllerMove.Operation.MOVE_TO && !this.i.getNavigation().m()) { + Vec3D vec3d = new Vec3D(this.b - this.i.locX(), this.c - this.i.locY(), this.d - this.i.locZ()); + double d0 = vec3d.f(); +diff --git a/src/main/java/net/minecraft/server/EntityGuardianElder.java b/src/main/java/net/minecraft/server/EntityGuardianElder.java +index 5d2870f0e..8148bc8b4 100644 +--- a/src/main/java/net/minecraft/server/EntityGuardianElder.java ++++ b/src/main/java/net/minecraft/server/EntityGuardianElder.java +@@ -16,6 +16,18 @@ public class EntityGuardianElder extends EntityGuardian { + + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.elderGuardianRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return true; ++ } ++ // Purpur end ++ + public static AttributeProvider.Builder m() { + return EntityGuardian.eM().a(GenericAttributes.MOVEMENT_SPEED, 0.30000001192092896D).a(GenericAttributes.ATTACK_DAMAGE, 8.0D).a(GenericAttributes.MAX_HEALTH, 80.0D); + } diff --git a/src/main/java/net/minecraft/server/EntityHoglin.java b/src/main/java/net/minecraft/server/EntityHoglin.java -index be8b07a7d7..4f98c1d2ab 100644 +index cf64c8ca2..7f642fe67 100644 --- a/src/main/java/net/minecraft/server/EntityHoglin.java +++ b/src/main/java/net/minecraft/server/EntityHoglin.java -@@ -21,6 +21,18 @@ public class EntityHoglin extends EntityAnimal implements IMonster, IOglin { +@@ -13,13 +13,25 @@ public class EntityHoglin extends EntityAnimal implements IMonster, IOglin { + public int conversionTicks = 0; + public boolean cannotBeHunted = false; + protected static final ImmutableList>> bo = ImmutableList.of(SensorType.c, SensorType.d, SensorType.n, SensorType.m); +- protected static final ImmutableList> bp = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLIN, new MemoryModuleType[]{MemoryModuleType.AVOID_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_ADULT_HOGLINS, MemoryModuleType.NEAREST_VISIBLE_ADULY, MemoryModuleType.NEAREST_REPELLENT, MemoryModuleType.PACIFIED}); ++ protected static final ImmutableList> bp = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLIN, MemoryModuleType.AVOID_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_ADULT_HOGLINS, MemoryModuleType.NEAREST_VISIBLE_ADULY, MemoryModuleType.NEAREST_REPELLENT, MemoryModuleType.PACIFIED); // Purpur - decompile error + + public EntityHoglin(EntityTypes entitytypes, World world) { + super(entitytypes, world); this.f = 5; } @@ -915,16 +1775,34 @@ index be8b07a7d7..4f98c1d2ab 100644 @Override public boolean a(EntityHuman entityhuman) { return !this.isLeashed(); -@@ -84,6 +96,7 @@ public class EntityHoglin extends EntityAnimal implements IMonster, IOglin { +@@ -77,13 +89,14 @@ public class EntityHoglin extends EntityAnimal implements IMonster, IOglin { + + @Override + public BehaviorController getBehaviorController() { +- return super.getBehaviorController(); ++ return (BehaviorController) super.getBehaviorController(); // Purpur - decompile error + } + @Override protected void mobTick() { this.world.getMethodProfiler().enter("hoglinBrain"); +- this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this); + if (getRider() == null) // Purpur - only use brain if no rider - this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error ++ this.getBehaviorController().a((WorldServer) this.world, this); // Purpur - decompile error this.world.getMethodProfiler().exit(); HoglinAI.a(this); + if (this.isConverting()) { +@@ -259,7 +272,7 @@ public class EntityHoglin extends EntityAnimal implements IMonster, IOglin { + + @Override + protected SoundEffect getSoundAmbient() { +- return this.world.isClientSide ? null : (SoundEffect) HoglinAI.b(this).orElse((Object) null); ++ return this.world.isClientSide ? null : (SoundEffect) HoglinAI.b(this).orElse(null); // Purpur - decompile error + } + + @Override diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java -index adf414b479..a6c2119be9 100644 +index 069111952..bd63a25e2 100644 --- a/src/main/java/net/minecraft/server/EntityHorse.java +++ b/src/main/java/net/minecraft/server/EntityHorse.java @@ -12,6 +12,13 @@ public class EntityHorse extends EntityHorseAbstract { @@ -939,10 +1817,10 @@ index adf414b479..a6c2119be9 100644 + // Purpur end + @Override - protected void eL() { - this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue((double) this.fq()); + protected void eK() { + this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue((double) this.fp()); diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -index c9ab80ccd1..2fa4628557 100644 +index 8cfbf8abf..c14889b09 100644 --- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java +++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java @@ -39,12 +39,27 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven @@ -978,11 +1856,11 @@ index c9ab80ccd1..2fa4628557 100644 this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); + this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHorseHasRider(this)); // Purpur - this.eW(); + this.eV(); } diff --git a/src/main/java/net/minecraft/server/EntityHorseDonkey.java b/src/main/java/net/minecraft/server/EntityHorseDonkey.java -index d349e8a34b..01672ed635 100644 +index 767d18d5a..cb8aee569 100644 --- a/src/main/java/net/minecraft/server/EntityHorseDonkey.java +++ b/src/main/java/net/minecraft/server/EntityHorseDonkey.java @@ -8,6 +8,13 @@ public class EntityHorseDonkey extends EntityHorseChestedAbstract { @@ -1000,10 +1878,10 @@ index d349e8a34b..01672ed635 100644 protected SoundEffect getSoundAmbient() { super.getSoundAmbient(); diff --git a/src/main/java/net/minecraft/server/EntityHorseMule.java b/src/main/java/net/minecraft/server/EntityHorseMule.java -index 5105418c42..4d45976d7c 100644 +index 3dd4d4f0f..243aeb736 100644 --- a/src/main/java/net/minecraft/server/EntityHorseMule.java +++ b/src/main/java/net/minecraft/server/EntityHorseMule.java -@@ -8,6 +8,13 @@ public class EntityHorseMule extends EntityHorseChestedAbstract { +@@ -8,6 +8,12 @@ public class EntityHorseMule extends EntityHorseChestedAbstract { super(entitytypes, world); } @@ -1013,12 +1891,11 @@ index 5105418c42..4d45976d7c 100644 + return world.purpurConfig.muleRidableInWater; + } + // Purpur end -+ @Override protected SoundEffect getSoundAmbient() { super.getSoundAmbient(); diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java -index 43e605f682..ca8f73c752 100644 +index abbc12c8e..b39feed7a 100644 --- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java +++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java @@ -12,6 +12,18 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { @@ -1037,29 +1914,29 @@ index 43e605f682..ca8f73c752 100644 + } + // Purpur end + - public static AttributeProvider.Builder eM() { - return fj().a(GenericAttributes.MAX_HEALTH, 15.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.20000000298023224D); + public static AttributeProvider.Builder eL() { + return fi().a(GenericAttributes.MAX_HEALTH, 15.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.20000000298023224D); } @@ -22,7 +34,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { } @Override -- protected void eW() {} -+ protected void eW() { if (world.purpurConfig.skeletonHorseCanSwim) goalSelector.a(0, new PathfinderGoalFloat(this)); } // Purpur +- protected void eV() {} ++ protected void eV() { if (world.purpurConfig.skeletonHorseCanSwim) goalSelector.a(0, new PathfinderGoalFloat(this)); } // Purpur @Override protected SoundEffect getSoundAmbient() { @@ -117,7 +129,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { @Override - public boolean bp() { + public boolean bs() { - return true; -+ return super.bp(); // Purpur ++ return super.bs(); // Purpur } @Override diff --git a/src/main/java/net/minecraft/server/EntityHorseZombie.java b/src/main/java/net/minecraft/server/EntityHorseZombie.java -index 0cbdccf4c5..19a21ff98d 100644 +index acc5b8ca9..6e9806662 100644 --- a/src/main/java/net/minecraft/server/EntityHorseZombie.java +++ b/src/main/java/net/minecraft/server/EntityHorseZombie.java @@ -8,6 +8,18 @@ public class EntityHorseZombie extends EntityHorseAbstract { @@ -1078,18 +1955,18 @@ index 0cbdccf4c5..19a21ff98d 100644 + } + // Purpur end + - public static AttributeProvider.Builder eM() { - return fj().a(GenericAttributes.MAX_HEALTH, 15.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.20000000298023224D); + public static AttributeProvider.Builder eL() { + return fi().a(GenericAttributes.MAX_HEALTH, 15.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.20000000298023224D); } @@ -79,5 +91,5 @@ public class EntityHorseZombie extends EntityHorseAbstract { } @Override -- protected void eW() {} -+ protected void eW() { if (world.purpurConfig.zombieHorseCanSwim) goalSelector.a(0, new PathfinderGoalFloat(this)); } // Purpur +- protected void eV() {} ++ protected void eV() { if (world.purpurConfig.zombieHorseCanSwim) goalSelector.a(0, new PathfinderGoalFloat(this)); } // Purpur } diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -index 0e23aa91d5..892ba2e59a 100644 +index 7b2c459ad..b9c4ead23 100644 --- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java +++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java @@ -20,6 +20,16 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan @@ -1105,7 +1982,7 @@ index 0e23aa91d5..892ba2e59a 100644 + public boolean isRidableInWater() { + return world.purpurConfig.illusionerRidableInWater; + } -+ ++ @Override protected void initAttributes(World world) { if (world != null) { @@ -1126,44 +2003,63 @@ index 0e23aa91d5..892ba2e59a 100644 this.targetSelector.a(2, (new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)).a(300)); this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)).a(300)); diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index e276a59203..9cab9e43a6 100644 +index 7f5095f7e..bb4994c44 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -29,7 +29,7 @@ public abstract class EntityInsentient extends EntityLiving { + protected int f; + protected ControllerLook lookController; + protected ControllerMove moveController; +- protected ControllerJump bi; ++ protected ControllerJump bi; public ControllerJump getJumpController() { return bi; } // Purpur - OBFHELPER + private final EntityAIBodyControl c; + protected NavigationAbstract navigation; + public PathfinderGoalSelector goalSelector; @@ -67,8 +67,8 @@ public abstract class EntityInsentient extends EntityLiving { - this.bH = -1.0F; + this.bA = -1.0F; this.goalSelector = new PathfinderGoalSelector(world.getMethodProfilerSupplier()); this.targetSelector = new PathfinderGoalSelector(world.getMethodProfilerSupplier()); - this.lookController = new ControllerLook(this); - this.moveController = new ControllerMove(this); -+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this); // Purpur + this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this); // Purpur - this.bp = new ControllerJump(this); ++ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this); // Purpur + this.bi = new ControllerJump(this); this.c = this.r(); this.navigation = this.b(world); -@@ -552,18 +552,22 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -254,10 +254,10 @@ public abstract class EntityInsentient extends EntityLiving { + // Purpur start + private void incrementTicksSinceLastInteraction() { + ++ticksSinceLastInteraction; +- //if (hasRider()) { +- // ticksSinceLastInteraction = 0; +- // return; +- //} ++ if (hasRider()) { ++ ticksSinceLastInteraction = 0; ++ return; ++ } + if (world.purpurConfig.entityLifeSpan <= 0) { + return; // feature disabled + } +@@ -552,14 +552,17 @@ public abstract class EntityInsentient extends EntityLiving { return super.do_(); } -+ public void setForwardSpeed(float speed) { this.q(speed); } // Purpur - OBFHELPER - public void q(float f) { - this.ba = f; ++ public void setForwardSpeed(float speed) { this.t(speed); } // Purpur - OBFHELPER + public void t(float f) { + this.aT = f; } -+ public void setVerticalSpeed(float speed) { this.r(speed); } // Purpur - OBFHELPER - public void r(float f) { - this.aZ = f; ++ public void setVerticalSpeed(float speed) { this.u(speed); } // Purpur - OBFHELPER + public void u(float f) { + this.aS = f; } -+ public void setStrafeSpeed(float speed) { this.s(speed); } // Purpur - OBFHELPER - public void s(float f) { - this.aY = f; ++ public void setStrafeSpeed(float speed) { this.v(speed); } // Purpur - OBFHELPER + public void v(float f) { + this.aR = f; } - -+ public void setSpeed(float speed) { n(speed); } // Purpur - OBFHELPER - @Override - public void n(float f) { - super.n(f); -@@ -1232,7 +1236,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1241,7 +1244,7 @@ public abstract class EntityInsentient extends EntityLiving { protected void a(EntityHuman entityhuman, EntityInsentient entityinsentient) {} protected EnumInteractionResult b(EntityHuman entityhuman, EnumHand enumhand) { @@ -1171,8 +2067,8 @@ index e276a59203..9cab9e43a6 100644 + return tryRide(entityhuman, enumhand); // Purpur } - public boolean ew() { -@@ -1589,4 +1593,45 @@ public abstract class EntityInsentient extends EntityLiving { + public boolean ev() { +@@ -1613,4 +1616,45 @@ public abstract class EntityInsentient extends EntityLiving { this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit this.unleash(true, false); } @@ -1219,7 +2115,7 @@ index e276a59203..9cab9e43a6 100644 + // Purpur end } diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java -index ab0731c2a0..2da50ef495 100644 +index bdff23688..954000a7b 100644 --- a/src/main/java/net/minecraft/server/EntityIronGolem.java +++ b/src/main/java/net/minecraft/server/EntityIronGolem.java @@ -22,9 +22,22 @@ public class EntityIronGolem extends EntityGolem implements IEntityAngerable { @@ -1252,7 +2148,7 @@ index ab0731c2a0..2da50ef495 100644 + this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.targetSelector.a(1, new PathfinderGoalDefendVillage(this)); this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, new Class[0])); - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::b)); + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::a_)); @@ -201,13 +215,13 @@ public class EntityIronGolem extends EntityGolem implements IEntityAngerable { Item item = itemstack.getItem(); @@ -1270,19 +2166,19 @@ index ab0731c2a0..2da50ef495 100644 float f1 = 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F; diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index d11e3369d8..2e3c0250b8 100644 +index 8071816d1..0d9dcd6b2 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -458,7 +458,7 @@ public abstract class EntityLiving extends Entity { +@@ -465,7 +465,7 @@ public abstract class EntityLiving extends Entity { @Override - public boolean bp() { + public boolean bs() { - return false; + return isRidableInWater(); // Purpur } protected void cT() { -@@ -2153,7 +2153,7 @@ public abstract class EntityLiving extends Entity { +@@ -2174,7 +2174,7 @@ public abstract class EntityLiving extends Entity { return 0.42F * this.getBlockJumpFactor(); } @@ -1291,8 +2187,21 @@ index d11e3369d8..2e3c0250b8 100644 float f = this.dI(); if (this.hasEffect(MobEffects.JUMP)) { +@@ -2423,10 +2423,12 @@ public abstract class EntityLiving extends Entity { + return this.onGround ? this.dM() * (0.21600002F / (f * f * f)) : this.aE; + } + ++ public float getSpeed() { return dM(); } // Purpur - OBFHELPER + public float dM() { + return this.bu; + } + ++ public void setSpeed(float speed) { q(speed); } // Purpur - OBFHELPER + public void q(float f) { + this.bu = f; + } diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java -index cf31920850..15efaffe24 100644 +index e90ff597d..a6ca8e68e 100644 --- a/src/main/java/net/minecraft/server/EntityLlama.java +++ b/src/main/java/net/minecraft/server/EntityLlama.java @@ -18,7 +18,46 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn @@ -1341,8 +2250,8 @@ index cf31920850..15efaffe24 100644 + // Purpur end public void setStrength(int i) { - this.datawatcher.set(EntityLlama.bE, Math.max(1, Math.min(5, i))); -@@ -64,6 +103,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn + this.datawatcher.set(EntityLlama.bx, Math.max(1, Math.min(5, i))); +@@ -66,6 +105,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn @Override protected void initPathfinder() { this.goalSelector.a(0, new PathfinderGoalFloat(this)); @@ -1350,7 +2259,7 @@ index cf31920850..15efaffe24 100644 this.goalSelector.a(1, new PathfinderGoalTame(this, 1.2D)); this.goalSelector.a(2, new PathfinderGoalLlamaFollow(this, 2.0999999046325684D)); this.goalSelector.a(3, new PathfinderGoalArrowAttack(this, 1.25D, 40, 20.0F)); -@@ -73,6 +113,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn +@@ -75,6 +115,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn this.goalSelector.a(6, new PathfinderGoalRandomStrollLand(this, 0.7D)); this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); @@ -1358,17 +2267,17 @@ index cf31920850..15efaffe24 100644 this.targetSelector.a(1, new EntityLlama.c(this)); this.targetSelector.a(2, new EntityLlama.a(this)); } -@@ -310,7 +351,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn +@@ -312,7 +353,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn } @Nullable -- public EnumColor fz() { -+ public EnumColor fz() { return getColor(); } public EnumColor getColor() { // Purpur - OBFHELPER - int i = (Integer) this.datawatcher.get(EntityLlama.bF); +- public EnumColor fy() { ++ public EnumColor fy() { return getColor(); } public EnumColor getColor() { // Purpur - OBFHELPER + int i = (Integer) this.datawatcher.get(EntityLlama.by); return i == -1 ? null : EnumColor.fromColorIndex(i); diff --git a/src/main/java/net/minecraft/server/EntityLlamaTrader.java b/src/main/java/net/minecraft/server/EntityLlamaTrader.java -index 11008c4323..de8ce2fd39 100644 +index 665a9e852..f65e93b74 100644 --- a/src/main/java/net/minecraft/server/EntityLlamaTrader.java +++ b/src/main/java/net/minecraft/server/EntityLlamaTrader.java @@ -11,6 +11,23 @@ public class EntityLlamaTrader extends EntityLlama { @@ -1393,10 +2302,52 @@ index 11008c4323..de8ce2fd39 100644 + // Purpur end + @Override - protected EntityLlama fA() { + protected EntityLlama fz() { return (EntityLlama) EntityTypes.TRADER_LLAMA.a(this.world); +diff --git a/src/main/java/net/minecraft/server/EntityMagmaCube.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java +index 8f9813ddd..9babff772 100644 +--- a/src/main/java/net/minecraft/server/EntityMagmaCube.java ++++ b/src/main/java/net/minecraft/server/EntityMagmaCube.java +@@ -8,6 +8,23 @@ public class EntityMagmaCube extends EntitySlime { + super(entitytypes, world); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.magmaCubeRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.magmaCubeRidableInWater; ++ } ++ ++ @Override ++ public float getJumpHeight() { ++ return 0.42F * this.getBlockJumpFactor(); // from EntityLiving ++ } ++ // Purpur end ++ + public static AttributeProvider.Builder m() { + return EntityMonster.eR().a(GenericAttributes.MOVEMENT_SPEED, 0.20000000298023224D); + } +@@ -58,11 +75,12 @@ public class EntityMagmaCube extends EntitySlime { + } + + @Override +- protected void jump() { ++ public void jump() { // Purpur - protected -> public + Vec3D vec3d = this.getMot(); + + this.setMot(vec3d.x, (double) (this.dI() + (float) this.getSize() * 0.1F), vec3d.z); + this.impulse = true; ++ this.actualJump = false; // Purpur + } + + @Override diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java -index ecbdc65ec5..a36e7d182f 100644 +index 38df17bd2..7966b34f8 100644 --- a/src/main/java/net/minecraft/server/EntityMushroomCow.java +++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java @@ -20,6 +20,18 @@ public class EntityMushroomCow extends EntityCow implements IShearable { @@ -1437,11 +2388,11 @@ index ecbdc65ec5..a36e7d182f 100644 Pair pair = (Pair) optional.get(); diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java -index 9c1f019f91..366acbfd91 100644 +index 9dc55b783..9bd6bc7d1 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java @@ -16,6 +16,18 @@ public class EntityOcelot extends EntityAnimal { - this.eM(); + this.eL(); } + // Purpur start @@ -1457,14 +2408,14 @@ index 9c1f019f91..366acbfd91 100644 + // Purpur end + private boolean isTrusting() { - return (Boolean) this.datawatcher.get(EntityOcelot.bw); + return (Boolean) this.datawatcher.get(EntityOcelot.bp); } @@ -47,12 +59,14 @@ public class EntityOcelot extends EntityAnimal { protected void initPathfinder() { - this.by = new EntityOcelot.b(this, 0.6D, EntityOcelot.bv, true); + this.br = new EntityOcelot.b(this, 0.6D, EntityOcelot.bo, true); this.goalSelector.a(1, new PathfinderGoalFloat(this)); + this.goalSelector.a(1, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur - this.goalSelector.a(3, this.by); + this.goalSelector.a(3, this.br); this.goalSelector.a(7, new PathfinderGoalLeapAtTarget(this, 0.3F)); this.goalSelector.a(8, new PathfinderGoalOcelotAttack(this)); this.goalSelector.a(9, new PathfinderGoalBreed(this, 0.8D)); @@ -1472,10 +2423,10 @@ index 9c1f019f91..366acbfd91 100644 this.goalSelector.a(11, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 10.0F)); + this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget<>(this, EntityChicken.class, false)); - this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, false, false, EntityTurtle.bv)); + this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, false, false, EntityTurtle.bo)); } diff --git a/src/main/java/net/minecraft/server/EntityPanda.java b/src/main/java/net/minecraft/server/EntityPanda.java -index 42df0d74ee..a0d00288fc 100644 +index 01cc3d94d..4379380c2 100644 --- a/src/main/java/net/minecraft/server/EntityPanda.java +++ b/src/main/java/net/minecraft/server/EntityPanda.java @@ -46,6 +46,27 @@ public class EntityPanda extends EntityAnimal { @@ -1522,13 +2473,13 @@ index 42df0d74ee..a0d00288fc 100644 public void u(boolean flag) { this.d(16, flag); } -@@ -85,6 +108,7 @@ public class EntityPanda extends EntityAnimal { - return (Integer) this.datawatcher.get(EntityPanda.by) > 0; +@@ -93,6 +116,7 @@ public class EntityPanda extends EntityAnimal { + return (Integer) this.datawatcher.get(EntityPanda.br); } + public void setEating(boolean eating) { this.v(eating); } // Purpur - OBFHELPER - public void v(boolean flag) { - this.datawatcher.set(EntityPanda.by, flag ? 1 : 0); + private void v(int i) { + this.datawatcher.set(EntityPanda.br, i); } @@ -201,6 +225,7 @@ public class EntityPanda extends EntityAnimal { @Override @@ -1546,25 +2497,25 @@ index 42df0d74ee..a0d00288fc 100644 this.targetSelector.a(1, (new EntityPanda.e(this, new Class[0])).a(new Class[0])); } -@@ -537,7 +563,7 @@ public class EntityPanda extends EntityAnimal { +@@ -536,7 +562,7 @@ public class EntityPanda extends EntityAnimal { ItemStack itemstack = entityhuman.b(enumhand); - if (this.fg()) { + if (this.ff()) { - return EnumInteractionResult.PASS; + return tryRide(entityhuman, enumhand); // Purpur - } else if (this.eO()) { + } else if (this.eN()) { this.u(false); return EnumInteractionResult.a(this.world.isClientSide); -@@ -554,7 +580,7 @@ public class EntityPanda extends EntityAnimal { +@@ -553,7 +579,7 @@ public class EntityPanda extends EntityAnimal { this.g(entityhuman); } else { - if (this.world.isClientSide || this.eN() || this.isInWater()) { + if (this.world.isClientSide || this.eM() || this.isInWater()) { - return EnumInteractionResult.PASS; + return tryRide(entityhuman, enumhand); // Purpur } - this.fu(); -@@ -571,7 +597,7 @@ public class EntityPanda extends EntityAnimal { + this.ft(); +@@ -570,7 +596,7 @@ public class EntityPanda extends EntityAnimal { return EnumInteractionResult.SUCCESS; } else { @@ -1573,7 +2524,7 @@ index 42df0d74ee..a0d00288fc 100644 } } -@@ -684,6 +710,7 @@ public class EntityPanda extends EntityAnimal { +@@ -683,6 +709,7 @@ public class EntityPanda extends EntityAnimal { public f(EntityPanda entitypanda) { this.a = entitypanda; @@ -1581,7 +2532,7 @@ index 42df0d74ee..a0d00288fc 100644 } @Override -@@ -847,6 +874,7 @@ public class EntityPanda extends EntityAnimal { +@@ -846,6 +873,7 @@ public class EntityPanda extends EntityAnimal { public l(EntityPanda entitypanda) { this.a = entitypanda; @@ -1589,7 +2540,7 @@ index 42df0d74ee..a0d00288fc 100644 } @Override -@@ -976,7 +1004,7 @@ public class EntityPanda extends EntityAnimal { +@@ -975,7 +1003,7 @@ public class EntityPanda extends EntityAnimal { } } @@ -1598,24 +2549,271 @@ index 42df0d74ee..a0d00288fc 100644 private final EntityPanda i; -@@ -986,9 +1014,9 @@ public class EntityPanda extends EntityAnimal { +@@ -985,9 +1013,9 @@ public class EntityPanda extends EntityAnimal { } @Override - public void a() { + public void tick() { // Purpur - if (this.i.fi()) { + if (this.i.fh()) { - super.a(); + super.tick(); // Purpur } } } +diff --git a/src/main/java/net/minecraft/server/EntityParrot.java b/src/main/java/net/minecraft/server/EntityParrot.java +index 6bb73f869..822fe2691 100644 +--- a/src/main/java/net/minecraft/server/EntityParrot.java ++++ b/src/main/java/net/minecraft/server/EntityParrot.java +@@ -65,12 +65,58 @@ public class EntityParrot extends EntityPerchable implements EntityBird { + + public EntityParrot(EntityTypes entitytypes, World world) { + super(entitytypes, world); +- this.moveController = new ControllerMoveFlying(this, 10, false); ++ // Purpur start ++ final net.pl3x.purpur.controller.ControllerMoveWASDFlyingWithSpacebar flyingController = new net.pl3x.purpur.controller.ControllerMoveWASDFlyingWithSpacebar(this, 0.3F); ++ this.moveController = new ControllerMoveFlying(this, 10, false) { ++ @Override ++ public void a() { // tick ++ if (getEntity().hasRider()) { ++ flyingController.tick(getEntity().getRider()); ++ } else { ++ tick(); ++ } ++ } ++ ++ @Override ++ public boolean b() { // isUpdating ++ return getEntity().hasRider() ? getForward() != 0 || getStrafe() != 0 : super.b(); ++ } ++ }; ++ // Purpur end + this.a(PathType.DANGER_FIRE, -1.0F); + this.a(PathType.DAMAGE_FIRE, -1.0F); + this.a(PathType.COCOA, -1.0F); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.parrotRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.parrotRidableInWater; ++ } ++ ++ @Override ++ public double getMaxY() { ++ return world.purpurConfig.parrotMaxY; ++ } ++ ++ @Override ++ public void g(Vec3D vec3d) { ++ super.g(vec3d); ++ if (hasRider() && !onGround) { ++ float speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue() * 2; ++ setSpeed(speed); ++ Vec3D mot = getMot(); ++ move(EnumMoveType.SELF, mot.multiply(speed, 0.25, speed)); ++ setMot(mot.a(0.9D)); ++ } ++ } ++ // Purpur end ++ + @Nullable + @Override + public GroupDataEntity prepare(WorldAccess worldaccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) { +@@ -89,8 +135,10 @@ public class EntityParrot extends EntityPerchable implements EntityBird { + + @Override + protected void initPathfinder() { +- this.goalSelector.a(0, new PathfinderGoalPanic(this, 1.25D)); ++ // this.goalSelector.a(0, new PathfinderGoalPanic(this, 1.25D)); // Purpur - move down + this.goalSelector.a(0, new PathfinderGoalFloat(this)); ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur ++ this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.25D)); // Purpur + this.goalSelector.a(1, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); + this.goalSelector.a(2, new PathfinderGoalSit(this)); + this.goalSelector.a(2, new PathfinderGoalFollowOwner(this, 1.0D, 5.0F, 1.0F, true)); +diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java +index 706760bae..aea27a098 100644 +--- a/src/main/java/net/minecraft/server/EntityPhantom.java ++++ b/src/main/java/net/minecraft/server/EntityPhantom.java +@@ -25,6 +25,58 @@ public class EntityPhantom extends EntityFlying implements IMonster { + this.lookController = new EntityPhantom.f(this); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.phantomRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.phantomRidableInWater; ++ } ++ ++ @Override ++ public double getMaxY() { ++ return world.purpurConfig.phantomMaxY; ++ } ++ ++ @Override ++ public void g(Vec3D vec3d) { ++ super.g(vec3d); ++ if (hasRider() && !onGround) { ++ float speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue(); ++ setSpeed(speed); ++ Vec3D mot = getMot(); ++ move(EnumMoveType.SELF, mot.multiply(speed, speed, speed)); ++ setMot(mot.a(0.9D)); ++ } ++ } ++ ++ public static AttributeProvider.Builder defaultAttributes() { ++ return EntityMonster.eR().a(GenericAttributes.FLYING_SPEED, 3.0D); ++ } ++ ++ @Override ++ public boolean onSpacebar() { ++ if (hasRider() && getRider().getBukkitEntity().hasPermission("allow.special.phantom")) { ++ shoot(); ++ } ++ return false; ++ } ++ ++ public boolean shoot() { ++ org.bukkit.Location loc = ((org.bukkit.entity.LivingEntity) getBukkitEntity()).getEyeLocation(); ++ loc.setPitch(-loc.getPitch()); ++ org.bukkit.util.Vector target = loc.getDirection().normalize().multiply(100).add(loc.toVector()); ++ ++ net.pl3x.purpur.entity.PhantomFlames flames = new net.pl3x.purpur.entity.PhantomFlames(world, this); ++ flames.shoot(target.getX() - locX(), target.getY() - locY(), target.getZ() - locZ(), 1.0F, 5.0F); ++ world.addEntity(flames); ++ return true; ++ } ++ // Purpur end ++ + @Override + protected EntityAIBodyControl r() { + return new EntityPhantom.d(this); +@@ -33,6 +85,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { + @Override + protected void initPathfinder() { + // Purpur start ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); + if (world.purpurConfig.phantomOrbitCrystalRadius > 0) { + this.goalSelector.a(1, new FindCrystalGoal(this)); + this.goalSelector.a(2, new OrbitCrystalGoal(this)); +@@ -40,6 +93,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { + this.goalSelector.a(3, new EntityPhantom.c()); // PickAttackGoal + this.goalSelector.a(4, new EntityPhantom.i()); // SweepAttackGoal + this.goalSelector.a(5, new EntityPhantom.e()); // OrbitPointGoal ++ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); + this.targetSelector.a(1, new EntityPhantom.b()); // AttackPlayer Goal + // Purpur end + } +@@ -126,7 +180,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { + + @Override + public void movementTick() { +- if (this.isAlive() && ((world.purpurConfig.phantomBurnInDaylight && this.isInDaylight()) || (world.purpurConfig.phantomBurnInLight > 0 && world.getLightLevel(new BlockPosition(this)) >= world.purpurConfig.phantomBurnInLight))) { // Purpur ++ if (this.isAlive() && !hasRider() && ((world.purpurConfig.phantomBurnInDaylight && this.isInDaylight()) || (world.purpurConfig.phantomBurnInLight > 0 && world.getLightLevel(new BlockPosition(this)) >= world.purpurConfig.phantomBurnInLight))) { // Purpur + this.setOnFire(8); + } + +@@ -368,7 +422,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { + + @Override + public boolean a() { +- if (isCirclingCrystal()) return false; // Purpur - pathfinder does not have a flag ++ if (getRider() != null || isCirclingCrystal()) return false; // Purpur - pathfinder does not have a flag + if (this.c > 0) { + --this.c; + return false; +@@ -397,7 +451,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { + + @Override + public boolean b() { +- if (isCirclingCrystal()) return false; // Purpur - pathfinder does not have a flag ++ if (getRider() != null || isCirclingCrystal()) return false; // Purpur - pathfinder does not have a flag + EntityLiving entityliving = EntityPhantom.this.getGoalTarget(); + + return entityliving != null ? EntityPhantom.this.a(entityliving, PathfinderTargetCondition.a) : false; +@@ -412,7 +466,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { + + @Override + public boolean a() { +- if (isCirclingCrystal()) return false; // Purpur - pathfinder does not have a flag ++ if (getRider() != null || isCirclingCrystal()) return false; // Purpur - pathfinder does not have a flag + EntityLiving entityliving = EntityPhantom.this.getGoalTarget(); + + return entityliving != null ? EntityPhantom.this.a(EntityPhantom.this.getGoalTarget(), PathfinderTargetCondition.a) : false; +@@ -610,14 +664,23 @@ public class EntityPhantom extends EntityFlying implements IMonster { + } + } + +- class f extends ControllerLook { ++ class f extends net.pl3x.purpur.controller.ControllerLookWASD { // Purpur + + public f(EntityInsentient entityinsentient) { + super(entityinsentient); + } + + @Override +- public void a() {} ++ // Purpur start ++ public void tick(EntityHuman rider) { ++ setYawPitch(rider.yaw, -rider.pitch * 0.75F); ++ } ++ ++ @Override ++ public void tick() { ++ // do nothing ++ } ++ // Purpur end + } + + class d extends EntityAIBodyControl { +@@ -633,7 +696,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { + } + } + +- class g extends ControllerMove { ++ class g extends net.pl3x.purpur.controller.ControllerMoveWASDFlying { // Purpur + + private float j = 0.1F; + +@@ -642,7 +705,19 @@ public class EntityPhantom extends EntityFlying implements IMonster { + } + + @Override +- public void a() { ++ // Purpur start ++ public void tick(EntityHuman rider) { ++ if (!EntityPhantom.this.onGround) { ++ // phantom is always in motion when flying ++ // TODO - FIX THIS ++ // rider.setForward(1.0F); ++ } ++ super.tick(rider); ++ } ++ ++ @Override ++ public void tick() { ++ // Purpur end + if (EntityPhantom.this.positionChanged) { + EntityPhantom.this.yaw += 180.0F; + this.j = 0.1F; diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java -index cf2df391a9..9bd4cdf138 100644 +index 87caac62b..43eaba96e 100644 --- a/src/main/java/net/minecraft/server/EntityPig.java +++ b/src/main/java/net/minecraft/server/EntityPig.java @@ -19,9 +19,22 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { - this.saddleStorage = new SaddleStorage(this.datawatcher, EntityPig.bw, EntityPig.bv); + this.saddleStorage = new SaddleStorage(this.datawatcher, EntityPig.bp, EntityPig.bo); } + // Purpur start @@ -1638,7 +2836,7 @@ index cf2df391a9..9bd4cdf138 100644 this.goalSelector.a(3, new PathfinderGoalBreed(this, 1.0D)); this.goalSelector.a(4, new PathfinderGoalTempt(this, 1.2D, RecipeItemStack.a(Items.CARROT_ON_A_STICK), false)); diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java -index fdd13b2ba6..7f378df36a 100644 +index 194b76059..dbc5a74f6 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -22,6 +22,16 @@ public class EntityPigZombie extends EntityZombie implements IEntityAngerable { @@ -1659,11 +2857,11 @@ index fdd13b2ba6..7f378df36a 100644 public boolean jockeyOnlyBaby() { return world.purpurConfig.zombifiedPiglinJockeyOnlyBaby; diff --git a/src/main/java/net/minecraft/server/EntityPiglin.java b/src/main/java/net/minecraft/server/EntityPiglin.java -index 63fa1581eb..4809a8dced 100644 +index e1b433007..55739e52e 100644 --- a/src/main/java/net/minecraft/server/EntityPiglin.java +++ b/src/main/java/net/minecraft/server/EntityPiglin.java -@@ -31,6 +31,18 @@ public class EntityPiglin extends EntityMonster implements ICrossbow { - this.a(PathType.DAMAGE_FIRE, -1.0F); +@@ -25,6 +25,18 @@ public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow { + this.f = 5; } + // Purpur start @@ -1681,16 +2879,78 @@ index 63fa1581eb..4809a8dced 100644 @Override public void saveData(NBTTagCompound nbttagcompound) { super.saveData(nbttagcompound); -@@ -236,6 +248,7 @@ public class EntityPiglin extends EntityMonster implements ICrossbow { +@@ -143,7 +155,7 @@ public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow { + + @Override + public BehaviorController getBehaviorController() { +- return super.getBehaviorController(); ++ return (BehaviorController) super.getBehaviorController(); // Purpur - decompile error + } + + @Override +@@ -202,7 +214,8 @@ public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow { @Override protected void mobTick() { this.world.getMethodProfiler().enter("piglinBrain"); +- this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this); + if (getRider() == null) // Purpur - only use brain if no rider - this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error ++ this.getBehaviorController().a((WorldServer) this.world, this); // Purpur - decompile error this.world.getMethodProfiler().exit(); PiglinAI.b(this); + super.mobTick(); +@@ -341,7 +354,7 @@ public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow { + + @Override + protected SoundEffect getSoundAmbient() { +- return this.world.isClientSide ? null : (SoundEffect) PiglinAI.d(this).orElse((Object) null); ++ return this.world.isClientSide ? null : (SoundEffect) PiglinAI.d(this).orElse(null); // Purpur - decompile error + } + + @Override +diff --git a/src/main/java/net/minecraft/server/EntityPiglinBrute.java b/src/main/java/net/minecraft/server/EntityPiglinBrute.java +index 00db2d166..c672e31fc 100644 +--- a/src/main/java/net/minecraft/server/EntityPiglinBrute.java ++++ b/src/main/java/net/minecraft/server/EntityPiglinBrute.java +@@ -15,6 +15,18 @@ public class EntityPiglinBrute extends EntityPiglinAbstract { + this.f = 20; + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.piglinBruteRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.piglinBruteRidableInWater; ++ } ++ // Purpur end ++ + public static AttributeProvider.Builder eS() { + return EntityMonster.eR().a(GenericAttributes.MAX_HEALTH, 50.0D).a(GenericAttributes.MOVEMENT_SPEED, 0.3499999940395355D).a(GenericAttributes.ATTACK_DAMAGE, 7.0D); + } +@@ -44,7 +56,7 @@ public class EntityPiglinBrute extends EntityPiglinAbstract { + + @Override + public BehaviorController getBehaviorController() { +- return super.getBehaviorController(); ++ return (BehaviorController) super.getBehaviorController(); // Purpur - decompile error + } + + @Override +@@ -60,7 +72,8 @@ public class EntityPiglinBrute extends EntityPiglinAbstract { + @Override + protected void mobTick() { + this.world.getMethodProfiler().enter("piglinBruteBrain"); +- this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this); ++ if (getRider() == null) // Purpur - only use brain if no rider ++ this.getBehaviorController().a((WorldServer) this.world, this); // Purpur - decompile error + this.world.getMethodProfiler().exit(); + PiglinBruteAI.b(this); + PiglinBruteAI.c(this); diff --git a/src/main/java/net/minecraft/server/EntityPillager.java b/src/main/java/net/minecraft/server/EntityPillager.java -index f73c30ae49..537f094654 100644 +index a3a428da9..bf5669c30 100644 --- a/src/main/java/net/minecraft/server/EntityPillager.java +++ b/src/main/java/net/minecraft/server/EntityPillager.java @@ -13,15 +13,29 @@ public class EntityPillager extends EntityIllagerAbstract implements ICrossbow { @@ -1724,13 +2984,13 @@ index f73c30ae49..537f094654 100644 this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); diff --git a/src/main/java/net/minecraft/server/EntityPolarBear.java b/src/main/java/net/minecraft/server/EntityPolarBear.java -index c26fd0e186..395b398263 100644 +index cd6d2e07e..c74a10d9b 100644 --- a/src/main/java/net/minecraft/server/EntityPolarBear.java +++ b/src/main/java/net/minecraft/server/EntityPolarBear.java -@@ -16,12 +16,34 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { - private static final IntRange bz = TimeRange.a(20, 39); - private int bA; - private UUID bB; +@@ -18,12 +18,34 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { + private static final IntRange bs = TimeRange.a(20, 39); + private int bt; + private UUID bu; + private int standTimer = 0; // Purpur public EntityPolarBear(EntityTypes entitytypes, World world) { @@ -1762,7 +3022,7 @@ index c26fd0e186..395b398263 100644 @Override public boolean mate(EntityAnimal entityanimal) { if (entityanimal == this) { -@@ -59,6 +81,7 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { +@@ -61,6 +83,7 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { protected void initPathfinder() { super.initPathfinder(); this.goalSelector.a(0, new PathfinderGoalFloat(this)); @@ -1770,15 +3030,15 @@ index c26fd0e186..395b398263 100644 this.goalSelector.a(1, new EntityPolarBear.c()); this.goalSelector.a(1, new EntityPolarBear.d()); // Purpur start -@@ -71,6 +94,7 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { +@@ -73,6 +96,7 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D)); this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F)); this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this)); + this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.targetSelector.a(1, new EntityPolarBear.b()); this.targetSelector.a(2, new EntityPolarBear.a()); - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::b)); -@@ -183,6 +207,11 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::a_)); +@@ -185,6 +209,11 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { this.a((WorldServer) this.world, true); } @@ -1790,19 +3050,97 @@ index c26fd0e186..395b398263 100644 } @Override -@@ -215,6 +244,7 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { - +@@ -218,6 +247,7 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable { public void setStanding(boolean standing) { t(standing); } // Purpur - OBFHELPER public void t(boolean flag) { + this.datawatcher.set(EntityPolarBear.bo, flag); + standTimer = flag ? 20 : -1; // Purpur - this.datawatcher.set(EntityPolarBear.bv, flag); } + @Override +diff --git a/src/main/java/net/minecraft/server/EntityPufferFish.java b/src/main/java/net/minecraft/server/EntityPufferFish.java +index 10c8e2288..b22d5b377 100644 +--- a/src/main/java/net/minecraft/server/EntityPufferFish.java ++++ b/src/main/java/net/minecraft/server/EntityPufferFish.java +@@ -17,6 +17,18 @@ public class EntityPufferFish extends EntityFish { + super(entitytypes, world); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.pufferfishRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return true; ++ } ++ // Purpur end ++ + @Override + protected void initDatawatcher() { + super.initDatawatcher(); +@@ -60,7 +72,7 @@ public class EntityPufferFish extends EntityFish { + @Override + protected void initPathfinder() { + super.initPathfinder(); +- this.goalSelector.a(1, new EntityPufferFish.a(this)); ++ this.goalSelector.a(2, new EntityPufferFish.a(this)); // Purpur + } + + @Override diff --git a/src/main/java/net/minecraft/server/EntityRabbit.java b/src/main/java/net/minecraft/server/EntityRabbit.java -index 42145a89c4..572ddd6638 100644 +index 98baf24bd..c5a9d7310 100644 --- a/src/main/java/net/minecraft/server/EntityRabbit.java +++ b/src/main/java/net/minecraft/server/EntityRabbit.java -@@ -60,7 +60,7 @@ public class EntityRabbit extends EntityAnimal { +@@ -20,6 +20,18 @@ public class EntityRabbit extends EntityAnimal { + this.initializePathFinderGoals(); // CraftBukkit - moved code + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.rabbitRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.rabbitRidableInWater; ++ } ++ // Purpur end ++ + // CraftBukkit start - code from constructor + public void initializePathFinderGoals(){ + this.i(0.0D); +@@ -28,7 +40,8 @@ public class EntityRabbit extends EntityAnimal { + + @Override + public void initPathfinder() { +- this.goalSelector.a(1, new PathfinderGoalFloat(this)); ++ this.goalSelector.a(0, new PathfinderGoalFloat(this)); // Purpur ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.goalSelector.a(1, new EntityRabbit.PathfinderGoalRabbitPanic(this, 2.2D)); + this.goalSelector.a(2, new PathfinderGoalBreed(this, 0.8D)); + this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, RecipeItemStack.a(Items.CARROT, Items.GOLDEN_CARROT, Blocks.DANDELION), false)); +@@ -41,7 +54,15 @@ public class EntityRabbit extends EntityAnimal { + } + + @Override +- protected float dI() { ++ // Purpur start ++ public float getJumpHeight() { ++ if (hasRider()) { ++ if (getForward() < 0) { ++ setSpeed(getForward() * 2F); ++ } ++ return actualJump ? 0.5F : 0.3F; ++ } ++ // Purpur end + if (!this.positionChanged && (!this.moveController.b() || this.moveController.e() <= this.locY() + 0.5D)) { + PathEntity pathentity = this.navigation.k(); + +@@ -60,7 +81,7 @@ public class EntityRabbit extends EntityAnimal { } @Override @@ -1811,8 +3149,114 @@ index 42145a89c4..572ddd6638 100644 super.jump(); double d0 = this.moveController.c(); +@@ -92,6 +113,7 @@ public class EntityRabbit extends EntityAnimal { + + } + ++ public void startJumping() { eK(); } // Purpur - OBFHELPER + public void eK() { + this.setJumping(true); + this.br = 10; +@@ -106,6 +128,13 @@ public class EntityRabbit extends EntityAnimal { + + @Override + public void mobTick() { ++ // Purpur start ++ if (hasRider()) { ++ handleJumping(); ++ return; ++ } ++ // Purpur end ++ + if (this.bt > 0) { + --this.bt; + } +@@ -156,6 +185,39 @@ public class EntityRabbit extends EntityAnimal { + this.bs = this.onGround; + } + ++ // Purpur start ++ private boolean wasOnGround; ++ private boolean actualJump; ++ ++ private void handleJumping() { ++ if (onGround) { ++ ControllerJumpRabbit jumpController = (ControllerJumpRabbit) getJumpController(); ++ if (!wasOnGround) { ++ setJumping(false); ++ jumpController.setCanJump(false); ++ } ++ if (!jumpController.isJumping()) { ++ if (moveController.b()) { // isUpdating ++ startJumping(); ++ } ++ } else if (!jumpController.canJump()) { ++ jumpController.setCanJump(true); ++ } ++ } ++ wasOnGround = onGround; ++ } ++ ++ @Override ++ public boolean onSpacebar() { ++ if (onGround) { ++ actualJump = true; ++ jump(); ++ actualJump = false; ++ } ++ return true; ++ } ++ // Purpur end ++ + @Override + public boolean aN() { + return false; +@@ -485,7 +547,7 @@ public class EntityRabbit extends EntityAnimal { + } + } + +- static class ControllerMoveRabbit extends ControllerMove { ++ static class ControllerMoveRabbit extends net.pl3x.purpur.controller.ControllerMoveWASD { // Purpur + + private final EntityRabbit i; + private double j; +@@ -496,14 +558,14 @@ public class EntityRabbit extends EntityAnimal { + } + + @Override +- public void a() { ++ public void tick() { // Purpur + if (this.i.onGround && !this.i.jumping && !((EntityRabbit.ControllerJumpRabbit) this.i.bi).c()) { + this.i.i(0.0D); + } else if (this.b()) { + this.i.i(this.j); + } + +- super.a(); ++ super.tick(); // Purpur + } + + @Override +@@ -530,14 +592,17 @@ public class EntityRabbit extends EntityAnimal { + this.c = entityrabbit; + } + ++ public boolean isJumping() { return c(); } // Purpur - OBFHELPER + public boolean c() { + return this.a; + } + ++ public boolean canJump() { return d(); } // Purpur - OBFHELPER + public boolean d() { + return this.d; + } + ++ public void setCanJump(boolean canJump) { a(canJump); } // Purpur - OBFHELPER + public void a(boolean flag) { + this.d = flag; + } diff --git a/src/main/java/net/minecraft/server/EntityRavager.java b/src/main/java/net/minecraft/server/EntityRavager.java -index 9734845c16..1e1615d9ff 100644 +index 7064a12c8..fbb4c2e38 100644 --- a/src/main/java/net/minecraft/server/EntityRavager.java +++ b/src/main/java/net/minecraft/server/EntityRavager.java @@ -20,14 +20,28 @@ public class EntityRavager extends EntityRaider { @@ -1844,8 +3288,31 @@ index 9734845c16..1e1615d9ff 100644 this.targetSelector.a(2, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); this.targetSelector.a(4, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, true)); +diff --git a/src/main/java/net/minecraft/server/EntitySalmon.java b/src/main/java/net/minecraft/server/EntitySalmon.java +index 51ec63413..6dfcee2c9 100644 +--- a/src/main/java/net/minecraft/server/EntitySalmon.java ++++ b/src/main/java/net/minecraft/server/EntitySalmon.java +@@ -6,6 +6,18 @@ public class EntitySalmon extends EntityFishSchool { + super(entitytypes, world); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.salmonRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return true; ++ } ++ // Purpur end ++ + @Override + public int eN() { + return 5; diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java -index a5532e49e7..e785087d7b 100644 +index 2908e9cc4..04e585f44 100644 --- a/src/main/java/net/minecraft/server/EntitySheep.java +++ b/src/main/java/net/minecraft/server/EntitySheep.java @@ -56,10 +56,23 @@ public class EntitySheep extends EntityAnimal implements IShearable { @@ -1866,14 +3333,14 @@ index a5532e49e7..e785087d7b 100644 + @Override protected void initPathfinder() { - this.bz = new PathfinderGoalEatTile(this); + this.bs = new PathfinderGoalEatTile(this); this.goalSelector.a(0, new PathfinderGoalFloat(this)); + this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.25D)); this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D)); this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.1D, RecipeItemStack.a(Items.WHEAT), false)); diff --git a/src/main/java/net/minecraft/server/EntityShulker.java b/src/main/java/net/minecraft/server/EntityShulker.java -index afc4cf4960..0456236b43 100644 +index a990af15d..11bf731d7 100644 --- a/src/main/java/net/minecraft/server/EntityShulker.java +++ b/src/main/java/net/minecraft/server/EntityShulker.java @@ -29,12 +29,26 @@ public class EntityShulker extends EntityGolem implements IMonster { @@ -1903,7 +3370,7 @@ index afc4cf4960..0456236b43 100644 this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error this.targetSelector.a(2, new EntityShulker.d(this)); this.targetSelector.a(3, new EntityShulker.c(this)); -@@ -519,7 +533,7 @@ public class EntityShulker extends EntityGolem implements IMonster { +@@ -518,7 +532,7 @@ public class EntityShulker extends EntityGolem implements IMonster { private int b; @@ -1913,7 +3380,7 @@ index afc4cf4960..0456236b43 100644 @Override public boolean a() { diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java -index 29c0a9c36a..730b2eb330 100644 +index 35f15c8dd..0ea7af085 100644 --- a/src/main/java/net/minecraft/server/EntitySilverfish.java +++ b/src/main/java/net/minecraft/server/EntitySilverfish.java @@ -11,13 +11,27 @@ public class EntitySilverfish extends EntityMonster { @@ -1953,7 +3420,7 @@ index 29c0a9c36a..730b2eb330 100644 public void g() { diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java -index 104f594cde..9f665cf728 100644 +index 7c39bec83..3f130e03b 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -6,6 +6,18 @@ public class EntitySkeleton extends EntitySkeletonAbstract { @@ -1976,7 +3443,7 @@ index 104f594cde..9f665cf728 100644 protected SoundEffect getSoundAmbient() { return SoundEffects.ENTITY_SKELETON_AMBIENT; diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -index 84f83d48a8..e2aa9e96ca 100644 +index 1f7b50b55..72f59b0ec 100644 --- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java @@ -28,12 +28,14 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR @@ -1995,7 +3462,7 @@ index 84f83d48a8..e2aa9e96ca 100644 this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); diff --git a/src/main/java/net/minecraft/server/EntitySkeletonStray.java b/src/main/java/net/minecraft/server/EntitySkeletonStray.java -index 6cfc0ece39..c0ca1c76c7 100644 +index f985caada..d123fb82b 100644 --- a/src/main/java/net/minecraft/server/EntitySkeletonStray.java +++ b/src/main/java/net/minecraft/server/EntitySkeletonStray.java @@ -8,6 +8,18 @@ public class EntitySkeletonStray extends EntitySkeletonAbstract { @@ -2014,11 +3481,11 @@ index 6cfc0ece39..c0ca1c76c7 100644 + } + // Purpur end + - public static boolean b(EntityTypes entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) { - return c(entitytypes, generatoraccess, enummobspawn, blockposition, random) && (enummobspawn == EnumMobSpawn.SPAWNER || generatoraccess.f(blockposition)); + public static boolean a(EntityTypes entitytypes, WorldAccess worldaccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) { + return b(entitytypes, worldaccess, enummobspawn, blockposition, random) && (enummobspawn == EnumMobSpawn.SPAWNER || worldaccess.e(blockposition)); } diff --git a/src/main/java/net/minecraft/server/EntitySkeletonWither.java b/src/main/java/net/minecraft/server/EntitySkeletonWither.java -index f415775ead..a8e76d49e7 100644 +index c872be77a..96cb080d9 100644 --- a/src/main/java/net/minecraft/server/EntitySkeletonWither.java +++ b/src/main/java/net/minecraft/server/EntitySkeletonWither.java @@ -9,6 +9,18 @@ public class EntitySkeletonWither extends EntitySkeletonAbstract { @@ -2039,12 +3506,58 @@ index f415775ead..a8e76d49e7 100644 + @Override protected void initPathfinder() { - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityPiglin.class, true)); + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityPiglinAbstract.class, true)); diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index a4642cc739..ecf2059b00 100644 +index f74c82785..8483458e4 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java -@@ -324,7 +324,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -34,12 +34,45 @@ public class EntitySlime extends EntityInsentient implements IMonster { + this.moveController = new EntitySlime.ControllerMoveSlime(this); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.slimeRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.slimeRidableInWater; ++ } ++ ++ protected boolean actualJump; ++ ++ @Override ++ public float getJumpHeight() { ++ float height = super.getJumpHeight(); ++ return hasRider() && actualJump ? height * 1.5F : height; ++ } ++ ++ @Override ++ public boolean onSpacebar() { ++ if (onGround && hasRider()) { ++ actualJump = true; ++ if (getRider().getForward() == 0 || getRider().getStrafe() == 0) { ++ jump(); // jump() here if not moving ++ } ++ } ++ return true; // do not jump() in wasd controller, let vanilla controller handle ++ } ++ // Purpur end ++ + @Override + protected void initPathfinder() { ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.goalSelector.a(1, new EntitySlime.PathfinderGoalSlimeRandomJump(this)); + this.goalSelector.a(2, new EntitySlime.PathfinderGoalSlimeNearestPlayer(this)); + this.goalSelector.a(3, new EntitySlime.PathfinderGoalSlimeRandomDirection(this)); + this.goalSelector.a(5, new EntitySlime.PathfinderGoalSlimeIdle(this)); ++ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, (entityliving) -> { + return Math.abs(entityliving.locY() - this.locY()) <= 4.0D; + })); +@@ -324,11 +357,12 @@ public class EntitySlime extends EntityInsentient implements IMonster { } @Override @@ -2053,15 +3566,71 @@ index a4642cc739..ecf2059b00 100644 Vec3D vec3d = this.getMot(); this.setMot(vec3d.x, (double) this.dI(), vec3d.z); + this.impulse = true; ++ this.actualJump = false; // Purpur + } + + @Nullable +@@ -497,10 +531,10 @@ public class EntitySlime extends EntityInsentient implements IMonster { + // Paper end + } + +- static class ControllerMoveSlime extends ControllerMove { ++ static class ControllerMoveSlime extends net.pl3x.purpur.controller.ControllerMoveWASD { // Purpur + + private float i; +- private int j; ++ private int j; private int getJumpDelay() { return j; } private void setJumpDelay(int delay) { j = delay; } // Purpur - OBFHELPER + private final EntitySlime k; + private boolean l; + +@@ -522,15 +556,27 @@ public class EntitySlime extends EntityInsentient implements IMonster { + + @Override + public void a() { ++ // Purpur start ++ if (entity.hasRider()) { ++ tick(entity.getRider()); ++ if (entity.getForward() != 0 || entity.getStrafe() != 0) { ++ if (getJumpDelay() > 10) { ++ setJumpDelay(6); ++ } ++ } else { ++ setJumpDelay(20); ++ } ++ } else { ++ // Purpur end + this.a.yaw = this.a(this.a.yaw, this.i, 90.0F); + this.a.aC = this.a.yaw; + this.a.aA = this.a.yaw; +- if (this.h != ControllerMove.Operation.MOVE_TO) { ++ } if (!entity.hasRider() && this.h != ControllerMove.Operation.MOVE_TO) { // Purpur + this.a.t(0.0F); + } else { + this.h = ControllerMove.Operation.WAIT; + if (this.a.isOnGround()) { +- this.a.q((float) (this.e * this.a.b(GenericAttributes.MOVEMENT_SPEED))); ++ this.a.q((float) (this.e * this.a.b(GenericAttributes.MOVEMENT_SPEED) * (entity.hasRider() && (entity.getRider().getForward() != 0 || entity.getRider().getStrafe() != 0) ? 2.0D : 1.0D))); // Purpur + if (this.j-- <= 0) { + this.j = this.k.eJ(); + if (this.l) { +@@ -547,7 +593,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { + this.a.q(0.0F); + } + } else { +- this.a.q((float) (this.e * this.a.b(GenericAttributes.MOVEMENT_SPEED))); ++ this.a.q((float) (this.e * this.a.b(GenericAttributes.MOVEMENT_SPEED) * (entity.hasRider() && (entity.getRider().getForward() != 0 || entity.getRider().getStrafe() != 0) ? 2.0D : 1.0D))); // Purpur + } + + } diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java -index dfe615814d..a9c44967b2 100644 +index dfe615814..bc3ac62b4 100644 --- a/src/main/java/net/minecraft/server/EntitySnowman.java +++ b/src/main/java/net/minecraft/server/EntitySnowman.java -@@ -13,13 +13,27 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt - public EntitySnowman(EntityTypes entitytypes, World world) { +@@ -14,12 +14,26 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt super(entitytypes, world); } -+ + + // Purpur start + @Override + public boolean isRidable() { @@ -2073,7 +3642,7 @@ index dfe615814d..a9c44967b2 100644 + return world.purpurConfig.snowGolemRidableInWater; + } + // Purpur end - ++ @Override protected void initPathfinder() { + this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur @@ -2085,16 +3654,15 @@ index dfe615814d..a9c44967b2 100644 this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget<>(this, EntityInsentient.class, 10, true, false, (entityliving) -> { return entityliving instanceof IMonster; })); -@@ -71,6 +85,8 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt +@@ -71,6 +85,7 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt return; } + if (hasRider() && !world.purpurConfig.snowGolemLeaveTrailWhenRidden) return; // Purpur - don't leave snow trail when being ridden -+ IBlockData iblockdata = Blocks.SNOW.getBlockData(); for (int l = 0; l < 4; ++l) { -@@ -113,7 +129,7 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt +@@ -113,7 +128,7 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt if (itemstack.getItem() == Items.SHEARS && this.canShear()) { // CraftBukkit start if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) { @@ -2103,7 +3671,7 @@ index dfe615814d..a9c44967b2 100644 } // CraftBukkit end this.shear(SoundCategory.PLAYERS); -@@ -141,7 +157,7 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt +@@ -141,7 +156,7 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt return EnumInteractionResult.SUCCESS; // Purpur end } else { @@ -2113,7 +3681,7 @@ index dfe615814d..a9c44967b2 100644 } diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java -index f6a6772002..be1189d57c 100644 +index 42f02b03b..889712b79 100644 --- a/src/main/java/net/minecraft/server/EntitySpider.java +++ b/src/main/java/net/minecraft/server/EntitySpider.java @@ -11,14 +11,28 @@ public class EntitySpider extends EntityMonster { @@ -2145,8 +3713,108 @@ index f6a6772002..be1189d57c 100644 this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, new Class[0])); this.targetSelector.a(2, new EntitySpider.PathfinderGoalSpiderNearestAttackableTarget<>(this, EntityHuman.class)); this.targetSelector.a(3, new EntitySpider.PathfinderGoalSpiderNearestAttackableTarget<>(this, EntityIronGolem.class)); +diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java +index 028a7fe2c..c9d246131 100644 +--- a/src/main/java/net/minecraft/server/EntitySquid.java ++++ b/src/main/java/net/minecraft/server/EntitySquid.java +@@ -26,17 +26,38 @@ public class EntitySquid extends EntityWaterAnimal { + } + + // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.squidRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return true; ++ } ++ + @Override + public AxisAlignedBB getAxisForFluidCheck() { + // Stops squids from floating just over the water + return this.getBoundingBox().shrink(0.001D).offsetY(world.purpurConfig.squidOffsetWaterCheck); + } ++ ++ private void rotateVectorAroundY(org.bukkit.util.Vector vector, double degrees) { ++ double rad = Math.toRadians(degrees); ++ double cos = Math.cos(rad); ++ double sine = Math.sin(rad); ++ double x = vector.getX(); ++ double z = vector.getZ(); ++ vector.setX(cos * x - sine * z); ++ vector.setZ(sine * x + cos * z); ++ } + // Purpur end + + @Override + protected void initPathfinder() { + this.goalSelector.a(0, new EntitySquid.PathfinderGoalSquid(this)); +- this.goalSelector.a(1, new EntitySquid.a()); ++ this.goalSelector.a(1, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur ++ this.goalSelector.a(2, new EntitySquid.a()); // Purpur + } + + public static AttributeProvider.Builder m() { +@@ -181,6 +202,7 @@ public class EntitySquid extends EntityWaterAnimal { + return blockposition.getY() > generatoraccess.getMinecraftWorld().spigotConfig.squidSpawnRangeMin && blockposition.getY() < maxHeight; // Spigot // Paper + } + ++ public void setMovementVector(float x, float y, float z) { a(x, y, z); } // Purpur - OBFHELPER + public void a(float f, float f1, float f2) { + this.bw = f; + this.bx = f1; +@@ -252,7 +274,7 @@ public class EntitySquid extends EntityWaterAnimal { + + class PathfinderGoalSquid extends PathfinderGoal { + +- private final EntitySquid b; ++ private final EntitySquid b; public EntitySquid getSquid() { return b; } // Purpur - OBFHELPER + + public PathfinderGoalSquid(EntitySquid entitysquid) { + this.b = entitysquid; +@@ -265,6 +287,38 @@ public class EntitySquid extends EntityWaterAnimal { + + @Override + public void e() { ++ // Purpur start ++ EntitySquid squid = getSquid(); ++ EntityHuman rider = squid.getRider(); ++ if (rider != null) { ++ if (rider.jumping) { ++ squid.onSpacebar(); ++ } ++ float forward = rider.getForward(); ++ float strafe = rider.getStrafe(); ++ float speed = (float) squid.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue() * 10F; ++ if (forward < 0.0F) { ++ speed *= -0.5; ++ } ++ org.bukkit.util.Vector dir = rider.getBukkitEntity().getEyeLocation().getDirection().normalize().multiply(speed / 20.0F); ++ if (strafe != 0.0F) { ++ if (forward == 0.0F) { ++ dir.setY(0); ++ rotateVectorAroundY(dir, strafe > 0.0F ? -90 : 90); ++ } else if (forward < 0.0F) { ++ rotateVectorAroundY(dir, strafe > 0.0F ? 45 : -45); ++ } else { ++ rotateVectorAroundY(dir, strafe > 0.0F ? -45 : 45); ++ } ++ } ++ if (forward != 0.0F || strafe != 0.0F) { ++ squid.setMovementVector((float) dir.getX(), (float) dir.getY(), (float) dir.getZ()); ++ } else { ++ squid.setMovementVector(0.0F, 0.0F, 0.0F); ++ } ++ return; ++ } ++ // Purpur end + int i = this.b.dc(); + + if (i > 100) { diff --git a/src/main/java/net/minecraft/server/EntityStrider.java b/src/main/java/net/minecraft/server/EntityStrider.java -index c123e9fe97..4cb4f60fd4 100644 +index 3bd9b53d4..3069a408a 100644 --- a/src/main/java/net/minecraft/server/EntityStrider.java +++ b/src/main/java/net/minecraft/server/EntityStrider.java @@ -28,6 +28,18 @@ public class EntityStrider extends EntityAnimal implements ISteerable, ISaddleab @@ -2171,12 +3839,12 @@ index c123e9fe97..4cb4f60fd4 100644 @@ -89,6 +101,7 @@ public class EntityStrider extends EntityAnimal implements ISteerable, ISaddleab @Override protected void initPathfinder() { - this.bC = new PathfinderGoalPanic(this, 1.65D); + this.bv = new PathfinderGoalPanic(this, 1.65D); + this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur - this.goalSelector.a(1, this.bC); - this.goalSelector.a(3, new PathfinderGoalBreed(this, 1.0D)); - this.bB = new PathfinderGoalTempt(this, 1.4D, false, EntityStrider.bw); -@@ -380,7 +393,7 @@ public class EntityStrider extends EntityAnimal implements ISteerable, ISaddleab + this.goalSelector.a(1, this.bv); + this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D)); + this.bu = new PathfinderGoalTempt(this, 1.4D, false, EntityStrider.bp); +@@ -363,7 +376,7 @@ public class EntityStrider extends EntityAnimal implements ISteerable, ISaddleab if (!enuminteractionresult.a()) { ItemStack itemstack = entityhuman.b(enumhand); @@ -2186,19 +3854,221 @@ index c123e9fe97..4cb4f60fd4 100644 if (flag && !this.isSilent()) { this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_STRIDER_EAT, this.getSoundCategory(), 1.0F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F); diff --git a/src/main/java/net/minecraft/server/EntityTameableAnimal.java b/src/main/java/net/minecraft/server/EntityTameableAnimal.java -index 9b0d937f06..0b0cca4e35 100644 +index 9e008d56b..8f227678d 100644 --- a/src/main/java/net/minecraft/server/EntityTameableAnimal.java +++ b/src/main/java/net/minecraft/server/EntityTameableAnimal.java @@ -130,6 +130,7 @@ public abstract class EntityTameableAnimal extends EntityAnimal { - return this.j(entityliving) ? false : super.d(entityliving); + return this.i(entityliving) ? false : super.c(entityliving); } -+ public boolean isOwner(EntityLiving entityLiving) { return j(entityLiving); } // Purpur - OBFHELPER - public boolean j(EntityLiving entityliving) { ++ public boolean isOwner(EntityLiving entityLiving) { return i(entityLiving); } // Purpur - OBFHELPER + public boolean i(EntityLiving entityliving) { return entityliving == this.getOwner(); } +diff --git a/src/main/java/net/minecraft/server/EntityTropicalFish.java b/src/main/java/net/minecraft/server/EntityTropicalFish.java +index 495c28ccb..2c9df356e 100644 +--- a/src/main/java/net/minecraft/server/EntityTropicalFish.java ++++ b/src/main/java/net/minecraft/server/EntityTropicalFish.java +@@ -19,6 +19,18 @@ public class EntityTropicalFish extends EntityFishSchool { + super(entitytypes, world); + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.tropicalFishRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return true; ++ } ++ // Purpur end ++ + @Override + protected void initDatawatcher() { + super.initDatawatcher(); +diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java +index 430f9d23a..2f7570dd6 100644 +--- a/src/main/java/net/minecraft/server/EntityTurtle.java ++++ b/src/main/java/net/minecraft/server/EntityTurtle.java +@@ -27,6 +27,18 @@ public class EntityTurtle extends EntityAnimal { + this.G = 1.0F; + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.turtleRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.turtleRidableInWater; ++ } ++ // Purpur end ++ + public void setHomePos(BlockPosition blockposition) { + this.datawatcher.set(EntityTurtle.bp, blockposition.immutableCopy()); // Paper - called with mutablepos... + } +@@ -135,12 +147,13 @@ public class EntityTurtle extends EntityAnimal { + + @Override + protected void initPathfinder() { +- this.goalSelector.a(0, new EntityTurtle.f(this, 1.2D)); +- this.goalSelector.a(1, new EntityTurtle.a(this, 1.0D)); +- this.goalSelector.a(1, new EntityTurtle.d(this, 1.0D)); +- this.goalSelector.a(2, new EntityTurtle.i(this, 1.1D, Blocks.SEAGRASS.getItem())); +- this.goalSelector.a(3, new EntityTurtle.c(this, 1.0D)); +- this.goalSelector.a(4, new EntityTurtle.b(this, 1.0D)); ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur ++ this.goalSelector.a(1, new EntityTurtle.f(this, 1.2D)); // Purpur ++ this.goalSelector.a(2, new EntityTurtle.a(this, 1.0D)); // Purpur ++ this.goalSelector.a(2, new EntityTurtle.d(this, 1.0D)); // Purpur ++ this.goalSelector.a(3, new EntityTurtle.i(this, 1.1D, Blocks.SEAGRASS.getItem())); // Purpur ++ this.goalSelector.a(4, new EntityTurtle.c(this, 1.0D)); // Purpur ++ this.goalSelector.a(5, new EntityTurtle.b(this, 1.0D)); // Purpur + this.goalSelector.a(7, new EntityTurtle.j(this, 1.0D)); + this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); + this.goalSelector.a(9, new EntityTurtle.h(this, 1.0D, 100)); +@@ -323,13 +336,15 @@ public class EntityTurtle extends EntityAnimal { + } + } + +- static class e extends ControllerMove { ++ static class e extends net.pl3x.purpur.controller.ControllerMoveWASD { // Purpur + +- private final EntityTurtle i; ++ private final EntityTurtle i; public EntityTurtle getTurtle() { return i; } // Purpur - OBFHELPER ++ private final net.pl3x.purpur.controller.ControllerMoveWASDWater waterController; // Purpur + + e(EntityTurtle entityturtle) { +- super(entityturtle); ++ super(entityturtle, 0.1D); // Purpur + this.i = entityturtle; ++ waterController = new net.pl3x.purpur.controller.ControllerMoveWASDWater(entityturtle, 0.25D); // Purpur + } + + private void g() { +@@ -349,7 +364,18 @@ public class EntityTurtle extends EntityAnimal { + } + + @Override +- public void a() { ++ // Purpur start ++ public void tick(EntityHuman rider) { ++ if (getTurtle().isInWater()) { ++ waterController.tick(rider); ++ } else { ++ super.tick(rider); ++ } ++ } ++ ++ @Override ++ public void tick() { ++ // Purpur end + this.g(); + if (this.h == ControllerMove.Operation.MOVE_TO && !this.i.getNavigation().m()) { + double d0 = this.b - this.i.locX(); +diff --git a/src/main/java/net/minecraft/server/EntityVex.java b/src/main/java/net/minecraft/server/EntityVex.java +index ae05856f2..a70855235 100644 +--- a/src/main/java/net/minecraft/server/EntityVex.java ++++ b/src/main/java/net/minecraft/server/EntityVex.java +@@ -19,6 +19,45 @@ public class EntityVex extends EntityMonster { + this.f = 3; + } + ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return world.purpurConfig.vexRidable; ++ } ++ ++ @Override ++ public boolean isRidableInWater() { ++ return world.purpurConfig.vexRidableInWater; ++ } ++ ++ @Override ++ public double getMaxY() { ++ return world.purpurConfig.vexMaxY; ++ } ++ ++ @Override ++ public void g(Vec3D vec3d) { ++ super.g(vec3d); ++ if (hasRider()) { ++ float speed; ++ if (onGround) { ++ speed = (float) getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue() * 0.1F; ++ } else { ++ speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue(); ++ } ++ setSpeed(speed); ++ Vec3D mot = getMot(); ++ move(EnumMoveType.SELF, mot.multiply(speed, 1.0, speed)); ++ setMot(mot.a(0.9D)); ++ } ++ } ++ ++ @Override ++ public boolean b(float f, float f1) { ++ return false; // no fall damage please ++ } ++ // Purpur end ++ + @Override + public void move(EnumMoveType enummovetype, Vec3D vec3d) { + super.move(enummovetype, vec3d); +@@ -27,7 +66,7 @@ public class EntityVex extends EntityMonster { + + @Override + public void tick() { +- this.noclip = true; ++ this.noclip = !hasRider(); // Purpur + super.tick(); + this.noclip = false; + this.setNoGravity(true); +@@ -42,17 +81,19 @@ public class EntityVex extends EntityMonster { + protected void initPathfinder() { + super.initPathfinder(); + this.goalSelector.a(0, new PathfinderGoalFloat(this)); ++ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.goalSelector.a(4, new EntityVex.a()); + this.goalSelector.a(8, new EntityVex.d()); + this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 3.0F, 1.0F)); + this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F)); ++ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur + this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // CraftBukkit - decompile error + this.targetSelector.a(2, new EntityVex.b(this)); + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); + } + + public static AttributeProvider.Builder m() { +- return EntityMonster.eR().a(GenericAttributes.MAX_HEALTH, 14.0D).a(GenericAttributes.ATTACK_DAMAGE, 4.0D); ++ return EntityMonster.eR().a(GenericAttributes.MAX_HEALTH, 14.0D).a(GenericAttributes.ATTACK_DAMAGE, 4.0D).a(GenericAttributes.FLYING_SPEED, 0.6D); // Purpur + } + + @Override +@@ -284,14 +325,14 @@ public class EntityVex extends EntityMonster { + } + } + +- class c extends ControllerMove { ++ class c extends net.pl3x.purpur.controller.ControllerMoveWASDFlying { // Purpur + + public c(EntityVex entityvex) { + super(entityvex); + } + + @Override +- public void a() { ++ public void tick() { // Purpur + if (this.h == ControllerMove.Operation.MOVE_TO) { + Vec3D vec3d = new Vec3D(this.b - EntityVex.this.locX(), this.c - EntityVex.this.locY(), this.d - EntityVex.this.locZ()); + double d0 = vec3d.f(); diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 86de40d15b..903940feb6 100644 +index 7add2fca1..a51aa76ce 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -75,8 +75,19 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -2221,8 +4091,28 @@ index 86de40d15b..903940feb6 100644 if (world.purpurConfig.villagerFollowEmeraldBlock) this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, false, TEMPT_ITEMS)); } +@@ -241,7 +252,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + if (itemstack.getItem() != Items.VILLAGER_SPAWN_EGG && this.isAlive() && !this.eN() && !this.isSleeping()) { + if (this.isBaby()) { + this.fk(); +- return EnumInteractionResult.a(this.world.isClientSide); ++ return super.b(entityhuman, enumhand); // Purpur + } else { + boolean flag = this.getOffers().isEmpty(); + +@@ -254,8 +265,9 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + } + + if (flag) { +- return EnumInteractionResult.a(this.world.isClientSide); ++ return tryRide(entityhuman, enumhand); // Purpur + } else { ++ if (itemstack.isEmpty()) return tryRide(entityhuman, enumhand); // Purpur + if (!this.world.isClientSide && !this.trades.isEmpty()) { + this.h(entityhuman); + } diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java -index 9985afb124..2f59c1c91a 100644 +index 96dda6a14..98c7b4c6c 100644 --- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java +++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java @@ -23,6 +23,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { @@ -2231,7 +4121,7 @@ index 9985afb124..2f59c1c91a 100644 this.goalSelector.a(0, new PathfinderGoalFloat(this)); + this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.goalSelector.a(0, new PathfinderGoalUseItem<>(this, PotionUtil.a(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEffects.ENTITY_WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> { - return !this.world.isDay() && !entityvillagertrader.isInvisible(); + return this.world.isNight() && !entityvillagertrader.isInvisible(); })); @@ -48,6 +49,16 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { } @@ -2250,8 +4140,19 @@ index 9985afb124..2f59c1c91a 100644 @Override public boolean a(EntityHuman entityhuman) { return world.purpurConfig.villagerTraderCanBeLeashed && !this.isLeashed(); +@@ -75,8 +86,9 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { + } + + if (this.getOffers().isEmpty()) { +- return EnumInteractionResult.a(this.world.isClientSide); ++ return tryRide(entityhuman, enumhand); // Purpur + } else { ++ if (itemstack.isEmpty()) return tryRide(entityhuman, enumhand); // Purpur + if (!this.world.isClientSide) { + this.setTradingPlayer(entityhuman); + this.openTrade(entityhuman, this.getScoreboardDisplayName(), 1); diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java -index 58315906b6..958f86481a 100644 +index a945a0a07..5e702f97a 100644 --- a/src/main/java/net/minecraft/server/EntityVindicator.java +++ b/src/main/java/net/minecraft/server/EntityVindicator.java @@ -17,14 +17,28 @@ public class EntityVindicator extends EntityIllagerAbstract { @@ -2284,7 +4185,7 @@ index 58315906b6..958f86481a 100644 this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, true)); diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java -index e8d8935b8e..0f6ec6bc60 100644 +index 0ef981e5a..76fd72f33 100644 --- a/src/main/java/net/minecraft/server/EntityWitch.java +++ b/src/main/java/net/minecraft/server/EntityWitch.java @@ -24,6 +24,18 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { @@ -2308,7 +4209,7 @@ index e8d8935b8e..0f6ec6bc60 100644 super.initPathfinder(); @@ -32,10 +44,12 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { }); - this.bz = new PathfinderGoalNearestAttackableTargetWitch<>(this, EntityHuman.class, 10, true, false, (Predicate) null); + this.bs = new PathfinderGoalNearestAttackableTargetWitch<>(this, EntityHuman.class, 10, true, false, (Predicate) null); this.goalSelector.a(1, new PathfinderGoalFloat(this)); + this.goalSelector.a(1, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, 1.0D, 60, 10.0F)); @@ -2317,10 +4218,10 @@ index e8d8935b8e..0f6ec6bc60 100644 this.goalSelector.a(3, new PathfinderGoalRandomLookaround(this)); + this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})); - this.targetSelector.a(2, this.by); - this.targetSelector.a(3, this.bz); + this.targetSelector.a(2, this.br); + this.targetSelector.a(3, this.bs); diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java -index 5b519fa394..927d308254 100644 +index 5779d1c9f..506b2a96f 100644 --- a/src/main/java/net/minecraft/server/EntityWolf.java +++ b/src/main/java/net/minecraft/server/EntityWolf.java @@ -33,9 +33,27 @@ public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable @@ -2360,7 +4261,7 @@ index 5b519fa394..927d308254 100644 this.targetSelector.a(2, new PathfinderGoalOwnerHurtTarget(this)); this.targetSelector.a(3, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/EntityZoglin.java b/src/main/java/net/minecraft/server/EntityZoglin.java -index 28adbbebd1..c0b5476ff7 100644 +index 55df54733..ce4072f6e 100644 --- a/src/main/java/net/minecraft/server/EntityZoglin.java +++ b/src/main/java/net/minecraft/server/EntityZoglin.java @@ -21,6 +21,18 @@ public class EntityZoglin extends EntityMonster implements IMonster, IOglin { @@ -2385,36 +4286,35 @@ index 28adbbebd1..c0b5476ff7 100644 @@ -52,10 +64,10 @@ public class EntityZoglin extends EntityMonster implements IMonster, IOglin { } - private Optional eP() { -- return ((List) this.getBehaviorController().getMemory(MemoryModuleType.VISIBLE_MOBS).orElse(ImmutableList.of())).stream().filter(EntityZoglin::j).findFirst(); + private Optional eO() { +- return ((List) this.getBehaviorController().getMemory(MemoryModuleType.VISIBLE_MOBS).orElse(ImmutableList.of())).stream().filter(EntityZoglin::i).findFirst(); + return (this.getBehaviorController().getMemory(MemoryModuleType.VISIBLE_MOBS).orElse(ImmutableList.of())).stream().filter(EntityZoglin::predicate).findFirst(); // Purpur - decompile error } -- private static boolean j(EntityLiving entityliving) { +- private static boolean i(EntityLiving entityliving) { + private static boolean predicate(EntityLiving entityliving) { // Purpur - decompile error EntityTypes entitytypes = entityliving.getEntityType(); return entitytypes != EntityTypes.ZOGLIN && entitytypes != EntityTypes.CREEPER && IEntitySelector.f.test(entityliving); -@@ -130,14 +142,14 @@ public class EntityZoglin extends EntityMonster implements IMonster, IOglin { +@@ -140,14 +152,14 @@ public class EntityZoglin extends EntityMonster implements IMonster, IOglin { @Override public BehaviorController getBehaviorController() { - return super.getBehaviorController(); -+ return (BehaviorController) super.getBehaviorController(); // Purpur decompile error ++ return (BehaviorController) super.getBehaviorController(); // Purpur - decompile error } - protected void eM() { -- Activity activity = (Activity) this.bn.f().orElse((Object) null); -+ Activity activity = this.bn.f().orElse(null); // Purpur - decompile error + protected void eL() { +- Activity activity = (Activity) this.bg.f().orElse((Object) null); ++ Activity activity = (Activity) this.bg.f().orElse(null); // Purpur - decompile error -- this.bn.a((List) ImmutableList.of(Activity.FLIGHT, Activity.IDLE)); -- Activity activity1 = (Activity) this.bn.f().orElse((Object) null); -+ this.bn.a(ImmutableList.of(Activity.FLIGHT, Activity.IDLE)); // Purpur - decompile error -+ Activity activity1 = this.bn.f().orElse(null); // Purpur - decompile error + this.bg.a((List) ImmutableList.of(Activity.FLIGHT, Activity.IDLE)); +- Activity activity1 = (Activity) this.bg.f().orElse((Object) null); ++ Activity activity1 = (Activity) this.bg.f().orElse(null); // Purpur - decompile error if (activity1 == Activity.FLIGHT && activity != Activity.FLIGHT) { - this.eO(); -@@ -149,7 +161,8 @@ public class EntityZoglin extends EntityMonster implements IMonster, IOglin { + this.eN(); +@@ -159,7 +171,8 @@ public class EntityZoglin extends EntityMonster implements IMonster, IOglin { @Override protected void mobTick() { this.world.getMethodProfiler().enter("zoglinBrain"); @@ -2422,10 +4322,10 @@ index 28adbbebd1..c0b5476ff7 100644 + if (getRider() == null) // Purpur - only use brain if no rider + this.getBehaviorController().a((WorldServer) this.world, this); // Purpur - decompile error this.world.getMethodProfiler().exit(); - this.eM(); + this.eL(); } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index d8fb6afa6a..9620368426 100644 +index 1ea68f617..89135d903 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -46,6 +46,16 @@ public class EntityZombie extends EntityMonster { @@ -2458,7 +4358,7 @@ index d8fb6afa6a..9620368426 100644 } diff --git a/src/main/java/net/minecraft/server/EntityZombieHusk.java b/src/main/java/net/minecraft/server/EntityZombieHusk.java -index 2daff85620..1130a7712d 100644 +index ce6d79780..02b0ae550 100644 --- a/src/main/java/net/minecraft/server/EntityZombieHusk.java +++ b/src/main/java/net/minecraft/server/EntityZombieHusk.java @@ -9,6 +9,16 @@ public class EntityZombieHusk extends EntityZombie { @@ -2479,10 +4379,10 @@ index 2daff85620..1130a7712d 100644 public boolean jockeyOnlyBaby() { return world.purpurConfig.huskJockeyOnlyBaby; diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java -index cd796f5b86..cd12e5c74d 100644 +index 69e98dceb..cdcf3d1cf 100644 --- a/src/main/java/net/minecraft/server/EntityZombieVillager.java +++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java -@@ -28,6 +28,16 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo +@@ -29,6 +29,16 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo } // Purpur start @@ -2499,11 +4399,95 @@ index cd796f5b86..cd12e5c74d 100644 @Override public boolean jockeyOnlyBaby() { return world.purpurConfig.zombieVillagerJockeyOnlyBaby; +diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +index 0bac6b050..6c52af04a 100644 +--- a/src/main/java/net/minecraft/server/IProjectile.java ++++ b/src/main/java/net/minecraft/server/IProjectile.java +@@ -12,7 +12,7 @@ public abstract class IProjectile extends Entity { + + private UUID shooter; + private int c; +- private boolean d; ++ private boolean d; public boolean leftOwner() { return d; } public void setLeftOwner(boolean leftOwner) { this.d = leftOwner; } // Purpur - OBFHELPER + + IProjectile(EntityTypes entitytypes, World world) { + super(entitytypes, world); +@@ -81,6 +81,7 @@ public abstract class IProjectile extends Entity { + super.tick(); + } + ++ public boolean checkIfLeftOwner() { return this.h(); } // Purpur - OBFHELPER + private boolean h() { + Entity entity = this.getShooter(); + +@@ -144,6 +145,7 @@ public abstract class IProjectile extends Entity { + iblockdata.a(this.world, iblockdata, movingobjectpositionblock, this); + } + ++ public boolean hitPredicate(Entity target) { return a(target); } // Purpur - OBFHELPER + protected boolean a(Entity entity) { + if (!entity.isSpectator() && entity.isAlive() && entity.isInteractable()) { + Entity entity1 = this.getShooter(); +diff --git a/src/main/java/net/minecraft/server/ProjectileHelper.java b/src/main/java/net/minecraft/server/ProjectileHelper.java +index b2c64b314..515ba50ae 100644 +--- a/src/main/java/net/minecraft/server/ProjectileHelper.java ++++ b/src/main/java/net/minecraft/server/ProjectileHelper.java +@@ -7,6 +7,7 @@ import javax.annotation.Nullable; + + public final class ProjectileHelper { + ++ public static MovingObjectPosition getHitResult(Entity entity, Predicate predicate) { return a(entity, predicate); } // Purpur - OBFHELPER + public static MovingObjectPosition a(Entity entity, Predicate predicate) { + Vec3D vec3d = entity.getMot(); + World world = entity.world; +diff --git a/src/main/java/net/minecraft/server/Vec3D.java b/src/main/java/net/minecraft/server/Vec3D.java +index 84858ba39..9b8114d76 100644 +--- a/src/main/java/net/minecraft/server/Vec3D.java ++++ b/src/main/java/net/minecraft/server/Vec3D.java +@@ -39,6 +39,7 @@ public class Vec3D implements IPosition { + return new Vec3D(vec3d.x - this.x, vec3d.y - this.y, vec3d.z - this.z); + } + ++ public Vec3D normalize() { return d(); } // Purpur - OBFHELPER + public Vec3D d() { + double d0 = (double) MathHelper.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + +@@ -98,6 +99,7 @@ public class Vec3D implements IPosition { + return d3 * d3 + d4 * d4 + d5 * d5; + } + ++ public Vec3D scale(double scale) { return a(scale); } // Purpur - OBFHELPER + public Vec3D a(double d0) { + return this.d(d0, d0, d0); + } +@@ -106,6 +108,7 @@ public class Vec3D implements IPosition { + return this.d(vec3d.x, vec3d.y, vec3d.z); + } + ++ public Vec3D multiply (double x, double y, double z) { return d(x, y, z); } // Purpur - OBFHELPER + public Vec3D d(double d0, double d1, double d2) { + return new Vec3D(this.x * d0, this.y * d1, this.z * d2); + } +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index a4bb58136..8ce1173eb 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1516,5 +1516,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public boolean isTheEnd() { + return getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END; + } ++ ++ // Purpur start ++ public void playEffect(@Nullable EntityHuman entityhuman, int i, BlockPosition blockposition, int j) { ++ this.a(entityhuman, i, blockposition, j); ++ } + // Purpur end + } diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java -index 9d5246de95..2abbc6b177 100644 +index 8714d1574..af3739c79 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java -@@ -133,11 +133,13 @@ public class PurpurConfig { +@@ -134,11 +134,13 @@ public class PurpurConfig { public static String afkBroadcastBack = "§e§o%s is no longer AFK"; public static String afkTabListPrefix = "[AFK] "; public static String pingCommandOutput = "§a%s's ping is %sms"; @@ -2516,15 +4500,54 @@ index 9d5246de95..2abbc6b177 100644 + cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob); } - public static String serverModName = "Purpur"; + public static int dungeonSeed = -1; diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -index 4e8a6992ab..87b8630315 100644 +index 421781136..153735b0d 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java -@@ -271,36 +271,68 @@ public class PurpurWorldConfig { +@@ -42,11 +42,6 @@ public class PurpurWorldConfig { + } + } + +- public double vindicatorJohnnySpawnChance = 0D; +- private void vindicatorSettings() { +- vindicatorJohnnySpawnChance = getDouble("mobs.vindicator.johnny.spawn-chance", vindicatorJohnnySpawnChance); +- } +- + private ConfigurationSection getConfigurationSection(String path) { + ConfigurationSection section = PurpurConfig.config.getConfigurationSection("world-settings." + worldName + "." + path); + return section != null ? section : PurpurConfig.config.getConfigurationSection("world-settings.default." + path); +@@ -310,46 +305,123 @@ public class PurpurWorldConfig { turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts); } ++ public boolean batRidable = false; ++ public boolean batRidableInWater = false; ++ public double batMaxY = 256D; ++ private void batSettings() { ++ batRidable = getBoolean("mobs.bat.ridable", batRidable); ++ batRidableInWater = getBoolean("mobs.bat.ridable-in-water", batRidableInWater); ++ batMaxY = getDouble("mobs.bat.ridable-max-y", batMaxY); ++ } ++ ++ public boolean beeRidable = false; ++ public boolean beeRidableInWater = false; ++ public double beeMaxY = 256D; ++ private void beeSettings() { ++ beeRidable = getBoolean("mobs.bee.ridable", beeRidable); ++ beeRidableInWater = getBoolean("mobs.bee.ridable-in-water", beeRidableInWater); ++ beeMaxY = getDouble("mobs.bee.ridable-max-y", beeMaxY); ++ } ++ ++ public boolean blazeRidable = false; ++ public boolean blazeRidableInWater = false; ++ public double blazeMaxY = 256D; ++ private void blazeSettings() { ++ blazeRidable = getBoolean("mobs.blaze.ridable", blazeRidable); ++ blazeRidableInWater = getBoolean("mobs.blaze.ridable-in-water", blazeRidableInWater); ++ blazeMaxY = getDouble("mobs.blaze.ridable-max-y", blazeMaxY); ++ } ++ + public boolean catRidable = false; + public boolean catRidableInWater = false; public int catSpawnDelay = 1200; @@ -2554,6 +4577,11 @@ index 4e8a6992ab..87b8630315 100644 chickenRetaliate = getBoolean("mobs.chicken.retaliate", chickenRetaliate); } ++ public boolean codRidable = false; ++ private void codSettings() { ++ codRidable = getBoolean("mobs.cod.ridable", codRidable); ++ } ++ + public boolean cowRidable = false; + public boolean cowRidableInWater = false; public int cowFeedMushrooms = 0; @@ -2574,6 +4602,19 @@ index 4e8a6992ab..87b8630315 100644 creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance); } ++ public boolean dolphinRidable = false; ++ public int dolphinSpitCooldown = 20; ++ public float dolphinSpitSpeed = 1.0F; ++ public float dolphinSpitDamage = 2.0F; + public boolean dolphinDisableTreasureSearching = false; + private void dolphinSettings() { ++ dolphinRidable = getBoolean("mobs.dolphin.ridable", dolphinRidable); ++ dolphinSpitCooldown = getInt("mobs.dolphin.spit.cooldown", dolphinSpitCooldown); ++ dolphinSpitSpeed = (float) getDouble("mobs.dolphin.spit.speed", dolphinSpitSpeed); ++ dolphinSpitDamage = (float) getDouble("mobs.dolphin.spit.damage", dolphinSpitDamage); + dolphinDisableTreasureSearching = getBoolean("mobs.dolphin.disable-treasure-searching", dolphinDisableTreasureSearching); + } + + public boolean donkeyRidableInWater = false; + private void donkeySettings() { + donkeyRidableInWater = getBoolean("mobs.donkey.ridable-in-water", donkeyRidableInWater); @@ -2590,7 +4631,17 @@ index 4e8a6992ab..87b8630315 100644 drownedJockeyOnlyBaby = getBoolean("mobs.drowned.jockey.only-babies", drownedJockeyOnlyBaby); drownedJockeyChance = getDouble("mobs.drowned.jockey.chance", drownedJockeyChance); drownedJockeyTryExistingChickens = getBoolean("mobs.drowned.jockey.try-existing-chickens", drownedJockeyTryExistingChickens); -@@ -315,16 +347,40 @@ public class PurpurWorldConfig { + } + ++ public boolean elderGuardianRidable = false; ++ private void elderGuardianSettings() { ++ elderGuardianRidable = getBoolean("mobs.elder_guardian.ridable", elderGuardianRidable); ++ } ++ + public boolean enderDragonAlwaysDropsEggBlock = false; + public boolean enderDragonAlwaysDropsFullExp = false; + public double enderDragonMaxHealth = 200.0D; +@@ -359,16 +431,49 @@ public class PurpurWorldConfig { enderDragonMaxHealth = getDouble("mobs.ender_dragon.max-health", enderDragonMaxHealth); } @@ -2626,12 +4677,21 @@ index 4e8a6992ab..87b8630315 100644 foxTypeChangesWithTulips = getBoolean("mobs.fox.tulips-change-type", foxTypeChangesWithTulips); } ++ public boolean ghastRidable = false; ++ public boolean ghastRidableInWater = false; ++ public double ghastMaxY = 256D; ++ private void ghastSettings() { ++ ghastRidable = getBoolean("mobs.ghast.ridable", ghastRidable); ++ ghastRidableInWater = getBoolean("mobs.ghast.ridable-in-water", ghastRidableInWater); ++ ghastMaxY = getDouble("mobs.ghast.ridable-max-y", ghastMaxY); ++ } ++ + public boolean giantRidable = false; + public boolean giantRidableInWater = false; public float giantStepHeight = 2.0F; public float giantJumpHeight = 1.0F; public double giantMaxHealth = 100.0D; -@@ -333,6 +389,8 @@ public class PurpurWorldConfig { +@@ -377,6 +482,8 @@ public class PurpurWorldConfig { public boolean giantHaveAI = false; public boolean giantHaveHostileAI = false; private void giantSettings() { @@ -2640,10 +4700,15 @@ index 4e8a6992ab..87b8630315 100644 giantStepHeight = (float) getDouble("mobs.giant.step-height", giantStepHeight); giantJumpHeight = (float) getDouble("mobs.giant.jump-height", giantJumpHeight); giantMaxHealth = getDouble("mobs.giant.max-health", giantMaxHealth); -@@ -342,29 +400,93 @@ public class PurpurWorldConfig { +@@ -386,29 +493,119 @@ public class PurpurWorldConfig { giantHaveHostileAI = getBoolean("mobs.giant.have-hostile-ai", giantHaveHostileAI); } ++ public boolean guardianRidable = false; ++ private void guardianSettings() { ++ guardianRidable = getBoolean("mobs.guardian.ridable", guardianRidable); ++ } ++ + public boolean hoglinRidable = false; + public boolean hoglinRidableInWater = false; + private void hoglinSettings() { @@ -2705,6 +4770,13 @@ index 4e8a6992ab..87b8630315 100644 + llamaTraderRidableInWater = getBoolean("mobs.trader_llama.ridable-in-water", llamaTraderRidableInWater); + } + ++ public boolean magmaCubeRidable = false; ++ public boolean magmaCubeRidableInWater = false; ++ private void magmaCubeSettings() { ++ magmaCubeRidable = getBoolean("mobs.magma_cube.ridable", magmaCubeRidable); ++ magmaCubeRidableInWater = getBoolean("mobs.magma_cube.ridable-in-water", magmaCubeRidableInWater); ++ } ++ + public boolean mooshroomRidable = false; + public boolean mooshroomRidableInWater = false; + private void mooshroomSettings() { @@ -2731,11 +4803,37 @@ index 4e8a6992ab..87b8630315 100644 + pandaRidableInWater = getBoolean("mobs.panda.ridable-in-water", pandaRidableInWater); + } + ++ public boolean parrotRidable = false; ++ public boolean parrotRidableInWater = false; ++ public double parrotMaxY = 256D; ++ private void parrotSettings() { ++ parrotRidable = getBoolean("mobs.parrot.ridable", parrotRidable); ++ parrotRidableInWater = getBoolean("mobs.parrot.ridable-in-water", parrotRidableInWater); ++ parrotMaxY = getDouble("mobs.parrot.ridable-max-y", parrotMaxY); ++ } ++ ++ public boolean phantomRidable = false; ++ public boolean phantomRidableInWater = false; ++ public double phantomMaxY = 256D; ++ public float phantomFlameDamage = 1.0F; ++ public int phantomFlameFireTime = 8; public double phantomAttackedByCrystalRadius = 0.0D; public float phantomAttackedByCrystalDamage = 1.0F; public double phantomOrbitCrystalRadius = 0.0D; -@@ -398,14 +520,36 @@ public class PurpurWorldConfig { - phantomSpawnMaxPerAttempt = getInt("mobs.phantom.spawn.per-attempt.max", phantomSpawnMaxPerAttempt); +@@ -428,6 +625,11 @@ public class PurpurWorldConfig { + public boolean phantomIgnorePlayersWithTorch = false; + public boolean phantomBurnInDaylight = true; + private void phantomSettings() { ++ phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable); ++ phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater); ++ phantomMaxY = getDouble("mobs.phantom.ridable-max-y", phantomMaxY); ++ phantomFlameDamage = (float) getDouble("mobs.phantom.flames.damage", phantomFlameDamage); ++ phantomFlameFireTime = getInt("mobs.phantom.flames.fire-time", phantomFlameFireTime); + phantomAttackedByCrystalRadius = getDouble("mobs.phantom.attacked-by-crystal-range", phantomAttackedByCrystalRadius); + phantomAttackedByCrystalDamage = (float) getDouble("mobs.phantom.attacked-by-crystal-damage", phantomAttackedByCrystalDamage); + phantomOrbitCrystalRadius = getDouble("mobs.phantom.orbit-crystal-radius", phantomOrbitCrystalRadius); +@@ -448,40 +650,184 @@ public class PurpurWorldConfig { + phantomIgnorePlayersWithTorch = getBoolean("mobs.phantom.ignore-players-with-torch", phantomIgnorePlayersWithTorch); } + public boolean pigRidable = false; @@ -2754,6 +4852,13 @@ index 4e8a6992ab..87b8630315 100644 + piglinRidableInWater = getBoolean("mobs.piglin.ridable-in-water", piglinRidableInWater); + } + ++ public boolean piglinBruteRidable = false; ++ public boolean piglinBruteRidableInWater = false; ++ private void piglinBruteSettings() { ++ piglinBruteRidable = getBoolean("mobs.piglin_brute.ridable", piglinBruteRidable); ++ piglinBruteRidableInWater = getBoolean("mobs.piglin_brute.ridable-in-water", piglinBruteRidableInWater); ++ } ++ + public boolean pillagerRidable = false; + public boolean pillagerRidableInWater = false; + private void pillagerSettings() { @@ -2771,7 +4876,21 @@ index 4e8a6992ab..87b8630315 100644 polarBearBreedableItemString = getString("mobs.polar_bear.breedable-item", polarBearBreedableItemString); Item item = IRegistry.ITEM.get(new MinecraftKey(polarBearBreedableItemString)); if (item != Items.AIR) polarBearBreedableItem = item; -@@ -418,13 +562,84 @@ public class PurpurWorldConfig { + } + ++ public boolean pufferfishRidable = false; ++ private void pufferfishSettings() { ++ pufferfishRidable = getBoolean("mobs.pufferfish.ridable", pufferfishRidable); ++ } ++ ++ public boolean rabbitRidable = false; ++ public boolean rabbitRidableInWater = false; + public double rabbitNaturalToast = 0.0D; + public double rabbitNaturalKiller = 0.0D; + private void rabbitSettings() { ++ rabbitRidable = getBoolean("mobs.rabbit.ridable", rabbitRidable); ++ rabbitRidableInWater = getBoolean("mobs.rabbit.ridable-in-water", rabbitRidableInWater); + rabbitNaturalToast = getDouble("mobs.rabbit.spawn-toast-chance", rabbitNaturalToast); rabbitNaturalKiller = getDouble("mobs.rabbit.spawn-killer-rabbit-chance", rabbitNaturalKiller); } @@ -2782,6 +4901,11 @@ index 4e8a6992ab..87b8630315 100644 + ravagerRidableInWater = getBoolean("mobs.ravager.ridable-in-water", ravagerRidableInWater); + } + ++ public boolean salmonRidable = false; ++ private void salmonSettings() { ++ salmonRidable = getBoolean("mobs.salmon.ridable", salmonRidable); ++ } ++ + public boolean sheepRidable = false; + public boolean sheepRidableInWater = false; + private void sheepSettings() { @@ -2817,6 +4941,13 @@ index 4e8a6992ab..87b8630315 100644 + skeletonHorseRidableInWater = getBoolean("mobs.skeleton_horse.ridable-in-water", skeletonHorseRidableInWater); + } + ++ public boolean slimeRidable = false; ++ public boolean slimeRidableInWater = false; ++ private void slimeSettings() { ++ slimeRidable = getBoolean("mobs.slime.ridable", slimeRidable); ++ slimeRidableInWater = getBoolean("mobs.slime.ridable-in-water", slimeRidableInWater); ++ } ++ + public boolean snowGolemRidable = false; + public boolean snowGolemRidableInWater = false; + public boolean snowGolemLeaveTrailWhenRidden = false; @@ -2830,6 +4961,15 @@ index 4e8a6992ab..87b8630315 100644 snowGolemPutPumpkinBack = getBoolean("mobs.snow_golem.pumpkin-can-be-added-back", snowGolemPutPumpkinBack); } ++ public boolean squidRidable = false; + public boolean squidImmuneToEAR = true; + public double squidOffsetWaterCheck = 0.0D; + private void squidSettings() { ++ squidRidable = getBoolean("mobs.squid.ridable", squidRidable); + squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR); + squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck); + } + + public boolean spiderRidable = false; + public boolean spiderRidableInWater = false; + private void spiderSettings() { @@ -2851,22 +4991,43 @@ index 4e8a6992ab..87b8630315 100644 + striderRidableInWater = getBoolean("mobs.strider.ridable-in-water", striderRidableInWater); + } + ++ public boolean tropicalFishRidable = false; ++ private void tropicalFishSettings() { ++ tropicalFishRidable = getBoolean("mobs.tropical_fish.ridable", tropicalFishRidable); ++ } ++ ++ public boolean turtleRidable = false; ++ public boolean turtleRidableInWater = false; ++ private void turtleSettings() { ++ turtleRidable = getBoolean("mobs.turtle.ridable", turtleRidable); ++ turtleRidableInWater = getBoolean("mobs.turtle.ridable-in-water", turtleRidableInWater); ++ } ++ ++ public boolean vexRidable = false; ++ public boolean vexRidableInWater = false; ++ public double vexMaxY = 256D; ++ private void vexSettings() { ++ vexRidable = getBoolean("mobs.vex.ridable", vexRidable); ++ vexRidableInWater = getBoolean("mobs.vex.ridable-in-water", vexRidableInWater); ++ vexMaxY = getDouble("mobs.vex.ridable-max-y", vexMaxY); ++ } ++ + public boolean villagerRidable = false; + public boolean villagerRidableInWater = false; public int villagerBrainTicks = 1; public boolean villagerUseBrainTicksOnlyWhenLagging = true; public boolean villagerCanBeLeashed = false; -@@ -433,6 +648,8 @@ public class PurpurWorldConfig { - public int villagerSpawnIronGolemRadius = 0; +@@ -491,6 +837,8 @@ public class PurpurWorldConfig { public int villagerSpawnIronGolemLimit = 0; + public boolean villagerCanBreed = true; private void villagerSettings() { + villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable); + villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater); villagerBrainTicks = getInt("mobs.villager.brain-ticks", villagerBrainTicks); villagerUseBrainTicksOnlyWhenLagging = getBoolean("mobs.villager.use-brain-ticks-only-when-lagging", villagerUseBrainTicksOnlyWhenLagging); villagerCanBeLeashed = getBoolean("mobs.villager.can-be-leashed", villagerCanBeLeashed); -@@ -442,47 +659,99 @@ public class PurpurWorldConfig { - villagerSpawnIronGolemLimit = getInt("mobs.villager.spawn-iron-golem.limit", villagerSpawnIronGolemLimit); +@@ -501,48 +849,102 @@ public class PurpurWorldConfig { + villagerCanBreed = getBoolean("mobs.villager.can-breed", villagerCanBreed); } + public boolean villagerTraderRidable = false; @@ -2882,9 +5043,11 @@ index 4e8a6992ab..87b8630315 100644 + public boolean vindicatorRidable = false; + public boolean vindicatorRidableInWater = false; ++ public double vindicatorJohnnySpawnChance = 0D; + private void vindicatorSettings() { + vindicatorRidable = getBoolean("mobs.vindicator.ridable", vindicatorRidable); + vindicatorRidableInWater = getBoolean("mobs.vindicator.ridable-in-water", vindicatorRidableInWater); ++ vindicatorJohnnySpawnChance = getDouble("mobs.vindicator.johnny.spawn-chance", vindicatorJohnnySpawnChance); + } + + public boolean witchRidable = false; @@ -2959,6 +5122,7 @@ index 4e8a6992ab..87b8630315 100644 public boolean zombieVillagerJockeyOnlyBaby = true; public double zombieVillagerJockeyChance = 0.05D; public boolean zombieVillagerJockeyTryExistingChickens = true; + public boolean zombieVillagerResetReputationsWhenCured = false; private void zombieVillagerSettings() { + zombieVillagerRidable = getBoolean("mobs.zombie_villager.ridable", zombieVillagerRidable); + zombieVillagerRidableInWater = getBoolean("mobs.zombie_villager.ridable-in-water", zombieVillagerRidableInWater); @@ -2967,7 +5131,7 @@ index 4e8a6992ab..87b8630315 100644 zombieVillagerJockeyTryExistingChickens = getBoolean("mobs.zombie_villager.jockey.try-existing-chickens", zombieVillagerJockeyTryExistingChickens); diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java b/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java new file mode 100644 -index 0000000000..828e1b8730 +index 000000000..828e1b873 --- /dev/null +++ b/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java @@ -0,0 +1,75 @@ @@ -3048,10 +5212,10 @@ index 0000000000..828e1b8730 +} diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java new file mode 100644 -index 0000000000..6086f63119 +index 000000000..426688b3a --- /dev/null +++ b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java -@@ -0,0 +1,86 @@ +@@ -0,0 +1,92 @@ +package net.pl3x.purpur.controller; + +import net.minecraft.server.ControllerMove; @@ -3063,10 +5227,16 @@ index 0000000000..6086f63119 + +public class ControllerMoveWASD extends ControllerMove { + protected final EntityInsentient entity; ++ private final double speedModifier; + + public ControllerMoveWASD(EntityInsentient entity) { ++ this(entity, 1.0D); ++ } ++ ++ public ControllerMoveWASD(EntityInsentient entity, double speedModifier) { + super(entity); + this.entity = entity; ++ this.speedModifier = speedModifier; + } + + // isUpdating @@ -3085,11 +5255,11 @@ index 0000000000..6086f63119 + } + } + -+ protected void tick() { ++ public void tick() { + super.a(); // tick + } + -+ protected void tick(EntityHuman rider) { ++ public void tick(EntityHuman rider) { + float forward = rider.getForward() * 0.5F; + float strafe = rider.getStrafe() * 0.25F; + @@ -3121,7 +5291,7 @@ index 0000000000..6086f63119 + entity.jump(); + } + -+ setSpeed(entity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()); ++ setSpeed(entity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue() * speedModifier); + + entity.setSpeed((float) getSpeed()); + entity.setForward(forward); @@ -3138,9 +5308,446 @@ index 0000000000..6086f63119 + } + } +} +diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java +new file mode 100644 +index 000000000..33c51460a +--- /dev/null ++++ b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java +@@ -0,0 +1,61 @@ ++package net.pl3x.purpur.controller; ++ ++import net.minecraft.server.EntityHuman; ++import net.minecraft.server.EntityInsentient; ++import net.minecraft.server.GenericAttributes; ++ ++public class ControllerMoveWASDFlying extends ControllerMoveWASD { ++ protected final float groundSpeedModifier; ++ protected int tooHighCooldown = 0; ++ protected boolean setGravityFlag = true; ++ ++ public ControllerMoveWASDFlying(EntityInsentient entity) { ++ this(entity, 1.0F); ++ } ++ ++ public ControllerMoveWASDFlying(EntityInsentient entity, float groundSpeedModifier) { ++ this(entity, groundSpeedModifier, true); ++ } ++ ++ public ControllerMoveWASDFlying(EntityInsentient entity, float groundSpeedModifier, boolean setGravityFlag) { ++ super(entity); ++ this.groundSpeedModifier = groundSpeedModifier; ++ this.setGravityFlag = setGravityFlag; ++ } ++ ++ @Override ++ public void tick(EntityHuman rider) { ++ float forward = Math.max(0.0F, rider.getForward()); ++ float vertical = forward == 0.0F ? 0.0F : -(rider.pitch / 45.0F); ++ float strafe = rider.getStrafe(); ++ ++ if (rider.jumping && spacebarEvent(entity)) { ++ entity.onSpacebar(); ++ } ++ ++ if (entity.locY() >= entity.getMaxY() || --tooHighCooldown > 0) { ++ tooHighCooldown = 60; ++ entity.setMot(entity.getMot().add(0.0D, -0.05D, 0.0D)); ++ vertical = 0.0F; ++ } ++ ++ setSpeed(entity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()); ++ float speed = (float) getSpeed(); ++ ++ if (entity.onGround) { ++ speed *= groundSpeedModifier; // TODO = fix this! ++ } ++ ++ if (setGravityFlag) { ++ entity.setNoGravity(forward > 0); ++ } ++ ++ entity.setSpeed(speed); ++ entity.setVertical(vertical); ++ entity.setStrafe(strafe); ++ entity.setForward(forward); ++ ++ setForward(entity.getForward()); ++ setStrafe(entity.getStrafe()); ++ } ++} +diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlyingWithSpacebar.java b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlyingWithSpacebar.java +new file mode 100644 +index 000000000..f75375936 +--- /dev/null ++++ b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlyingWithSpacebar.java +@@ -0,0 +1,61 @@ ++package net.pl3x.purpur.controller; ++ ++import net.minecraft.server.EntityHuman; ++import net.minecraft.server.EntityInsentient; ++import net.minecraft.server.GenericAttributes; ++import net.minecraft.server.Vec3D; ++ ++public class ControllerMoveWASDFlyingWithSpacebar extends ControllerMoveWASDFlying { ++ public ControllerMoveWASDFlyingWithSpacebar(EntityInsentient entity) { ++ super(entity); ++ } ++ ++ public ControllerMoveWASDFlyingWithSpacebar(EntityInsentient entity, float groundSpeedModifier) { ++ super(entity, groundSpeedModifier); ++ } ++ ++ @Override ++ public void tick(EntityHuman rider) { ++ float forward = rider.getForward(); ++ float strafe = rider.getStrafe() * 0.5F; ++ float vertical = 0; ++ ++ if (forward < 0.0F) { ++ forward *= 0.5F; ++ strafe *= 0.5F; ++ } ++ ++ float speed = (float) entity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue(); ++ ++ if (entity.onGround) { ++ speed *= groundSpeedModifier; ++ } ++ ++ if (rider.jumping && spacebarEvent(entity) && !entity.onSpacebar()) { ++ entity.setNoGravity(true); ++ vertical = 1.0F; ++ } else { ++ entity.setNoGravity(false); ++ } ++ ++ if (entity.locY() >= entity.getMaxY() || --tooHighCooldown > 0) { ++ tooHighCooldown = 60; ++ entity.setMot(entity.getMot().add(0.0D, -0.2D, 0.0D)); ++ vertical = 0.0F; ++ } ++ ++ setSpeed(speed); ++ entity.setSpeed((float) getSpeed()); ++ entity.setVertical(vertical); ++ entity.setStrafe(strafe); ++ entity.setForward(forward); ++ ++ setForward(entity.getForward()); ++ setStrafe(entity.getStrafe()); ++ ++ Vec3D mot = entity.getMot(); ++ if (mot.y > 0.2D) { ++ entity.setMot(mot.x, 0.2D, mot.z); ++ } ++ } ++} +diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDWater.java b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDWater.java +new file mode 100644 +index 000000000..1b08a0905 +--- /dev/null ++++ b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDWater.java +@@ -0,0 +1,50 @@ ++package net.pl3x.purpur.controller; ++ ++import net.minecraft.server.EntityHuman; ++import net.minecraft.server.EntityInsentient; ++import net.minecraft.server.GenericAttributes; ++ ++public class ControllerMoveWASDWater extends ControllerMoveWASD { ++ private final double speedModifier; ++ ++ public ControllerMoveWASDWater(EntityInsentient entity) { ++ this(entity, 1.0D); ++ } ++ ++ public ControllerMoveWASDWater(EntityInsentient entity, double speedModifier) { ++ super(entity); ++ this.speedModifier = speedModifier; ++ } ++ ++ @Override ++ public void tick(EntityHuman rider) { ++ float forward = rider.getForward(); ++ float strafe = rider.getStrafe() * 0.5F; // strafe slower by default ++ float vertical = -(rider.pitch / 90); ++ ++ if (forward == 0.0F) { ++ // strafe slower if not moving forward ++ strafe *= 0.5F; ++ // do not move vertically if not moving forward ++ vertical = 0.0F; ++ } else if (forward < 0.0F) { ++ // water animals can't swim backwards ++ forward = 0.0F; ++ vertical = 0.0F; ++ } ++ ++ if (rider.jumping && spacebarEvent(entity)) { ++ entity.onSpacebar(); ++ } ++ ++ setSpeed(entity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue() * speedModifier); ++ entity.setSpeed((float) getSpeed() * 0.1F); ++ ++ entity.setForward(forward * (float) speedModifier); ++ entity.setStrafe(strafe * (float) speedModifier); ++ entity.setVertical(vertical * (float) speedModifier); ++ ++ setForward(entity.getForward()); ++ setStrafe(entity.getStrafe()); ++ } ++} +diff --git a/src/main/java/net/pl3x/purpur/entity/DolphinSpit.java b/src/main/java/net/pl3x/purpur/entity/DolphinSpit.java +new file mode 100644 +index 000000000..3b777c54f +--- /dev/null ++++ b/src/main/java/net/pl3x/purpur/entity/DolphinSpit.java +@@ -0,0 +1,115 @@ ++package net.pl3x.purpur.entity; ++ ++import net.minecraft.server.BlockBase; ++import net.minecraft.server.DamageSource; ++import net.minecraft.server.Entity; ++import net.minecraft.server.EntityDolphin; ++import net.minecraft.server.EntityLiving; ++import net.minecraft.server.EntityLlamaSpit; ++import net.minecraft.server.EntityTypes; ++import net.minecraft.server.IBlockData; ++import net.minecraft.server.MovingObjectPosition; ++import net.minecraft.server.MovingObjectPositionBlock; ++import net.minecraft.server.MovingObjectPositionEntity; ++import net.minecraft.server.Particles; ++import net.minecraft.server.ProjectileHelper; ++import net.minecraft.server.Vec3D; ++import net.minecraft.server.World; ++import net.minecraft.server.WorldServer; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++ ++public class DolphinSpit extends EntityLlamaSpit { ++ public EntityLiving dolphin; ++ public int ticksLived; ++ ++ public DolphinSpit(EntityTypes entitytypes, World world) { ++ super(entitytypes, world); ++ } ++ ++ public DolphinSpit(World world, EntityDolphin dolphin) { ++ this(EntityTypes.LLAMA_SPIT, world); ++ setShooter(dolphin); ++ this.dolphin = dolphin; ++ } ++ ++ @Override ++ public boolean canSaveToDisk() { ++ return false; ++ } ++ ++ public void tick() { ++ if (dead || !valid) { ++ return; ++ } ++ ++ if (!leftOwner()) { ++ setLeftOwner(checkIfLeftOwner()); ++ } ++ ++ setFlag(6, isGlowing()); ++ entityBaseTick(); ++ ++ Vec3D mot = getMot(); ++ ++ MovingObjectPosition hitResult = ProjectileHelper.getHitResult(this, this::hitPredicate); ++ if (hitResult != null) { ++ onHit(hitResult); ++ } ++ ++ double x = this.locX() + mot.x; ++ double y = this.locY() + mot.y; ++ double z = this.locZ() + mot.z; ++ setMot(mot.scale(0.99D)); ++ ++ Vec3D motDouble = mot.scale(2.0); ++ for (int i = 0; i < 5; i++) { ++ ((WorldServer) world).sendParticles(null, Particles.BUBBLE, ++ locX() + random.nextFloat() / 2 - 0.25F, ++ locY() + random.nextFloat() / 2 - 0.25F, ++ locZ() + random.nextFloat() / 2 - 0.25F, ++ 0, motDouble.getX(), motDouble.getY(), motDouble.getZ(), 0.1, true); ++ } ++ ++ if (++ticksLived > 20) { ++ die(); ++ } else { ++ setMot(mot.scale(0.99D)); ++ if (!isNoGravity()) { ++ setMot(getMot().add(0.0D, -0.06D, 0.0D)); ++ } ++ setPosition(x, y, z); ++ } ++ } ++ ++ @Override ++ public void shoot(double x, double y, double z, float speed, float inaccuracy) { ++ setMot(new Vec3D(x, y, z).normalize().add( ++ random.nextGaussian() * (double) 0.0075F * (double) inaccuracy, ++ random.nextGaussian() * (double) 0.0075F * (double) inaccuracy, ++ random.nextGaussian() * (double) 0.0075F * (double) inaccuracy) ++ .scale(speed)); ++ } ++ ++ public void onHit(MovingObjectPosition rayTrace) { ++ CraftEventFactory.callProjectileHitEvent(this, rayTrace); ++ MovingObjectPosition.EnumMovingObjectType type = rayTrace.getType(); ++ if (type == MovingObjectPosition.EnumMovingObjectType.ENTITY) { ++ onHit((MovingObjectPositionEntity) rayTrace); ++ } else if (type == MovingObjectPosition.EnumMovingObjectType.BLOCK) { ++ onHit((MovingObjectPositionBlock) rayTrace); ++ } ++ } ++ ++ protected void onHit(MovingObjectPositionEntity rayTrace) { ++ Entity shooter = getShooter(); ++ if (shooter instanceof EntityLiving) { ++ rayTrace.getEntity().damageEntity(DamageSource.indirectMobAttack(this, (EntityLiving) shooter).setProjectile(), world.purpurConfig.dolphinSpitDamage); ++ } ++ } ++ ++ protected void onHit(MovingObjectPositionBlock rayTrace) { ++ IBlockData iblockdata = world.getType(rayTrace.getBlockPosition()); ++ iblockdata.a(world, iblockdata, rayTrace, this); ++ die(); ++ } ++} +diff --git a/src/main/java/net/pl3x/purpur/entity/PhantomFlames.java b/src/main/java/net/pl3x/purpur/entity/PhantomFlames.java +new file mode 100644 +index 000000000..f5da00b10 +--- /dev/null ++++ b/src/main/java/net/pl3x/purpur/entity/PhantomFlames.java +@@ -0,0 +1,120 @@ ++package net.pl3x.purpur.entity; ++ ++import net.minecraft.server.BlockBase; ++import net.minecraft.server.DamageSource; ++import net.minecraft.server.Entity; ++import net.minecraft.server.EntityLiving; ++import net.minecraft.server.EntityLlamaSpit; ++import net.minecraft.server.EntityPhantom; ++import net.minecraft.server.EntityTypes; ++import net.minecraft.server.IBlockData; ++import net.minecraft.server.MovingObjectPosition; ++import net.minecraft.server.MovingObjectPositionBlock; ++import net.minecraft.server.MovingObjectPositionEntity; ++import net.minecraft.server.Particles; ++import net.minecraft.server.ProjectileHelper; ++import net.minecraft.server.Vec3D; ++import net.minecraft.server.World; ++import net.minecraft.server.WorldServer; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++ ++public class PhantomFlames extends EntityLlamaSpit { ++ public EntityPhantom phantom; ++ public int ticksLived; ++ ++ public PhantomFlames(EntityTypes entitytypes, World world) { ++ super(entitytypes, world); ++ } ++ ++ public PhantomFlames(World world, EntityPhantom phantom) { ++ this(EntityTypes.LLAMA_SPIT, world); ++ setShooter(phantom); ++ this.phantom = phantom; ++ } ++ ++ @Override ++ public boolean canSaveToDisk() { ++ return false; ++ } ++ ++ @Override ++ public void tick() { ++ if (dead || !valid) { ++ return; ++ } ++ ++ if (!leftOwner()) { ++ setLeftOwner(checkIfLeftOwner()); ++ } ++ ++ setFlag(6, isGlowing()); ++ entityBaseTick(); ++ ++ Vec3D mot = getMot(); ++ ++ MovingObjectPosition hitResult = ProjectileHelper.getHitResult(this, this::hitPredicate); ++ if (hitResult != null) { ++ onHit(hitResult); ++ } ++ ++ double x = this.locX() + mot.x; ++ double y = this.locY() + mot.y; ++ double z = this.locZ() + mot.z; ++ setMot(mot.scale(0.99D)); ++ ++ Vec3D motDouble = mot.scale(2.0); ++ for (int i = 0; i < 5; i++) { ++ ((WorldServer) world).sendParticles(null, Particles.FLAME, ++ locX() + random.nextFloat() / 2 - 0.25F, ++ locY() + random.nextFloat() / 2 - 0.25F, ++ locZ() + random.nextFloat() / 2 - 0.25F, ++ 0, motDouble.getX(), motDouble.getY(), motDouble.getZ(), 0.1, true); ++ } ++ ++ if (world.a(getBoundingBox()).noneMatch(BlockBase.BlockData::isAir)) { ++ die(); ++ } else if (isInWaterOrBubbleColumn()) { ++ die(); ++ } else if (++ticksLived > 20) { ++ die(); ++ } else { ++ setMot(mot.scale(0.99D)); ++ if (!isNoGravity()) { ++ setMot(getMot().add(0.0D, -0.06D, 0.0D)); ++ } ++ setPosition(x, y, z); ++ } ++ } ++ ++ @Override ++ public void shoot(double x, double y, double z, float speed, float inaccuracy) { ++ setMot(new Vec3D(x, y, z).normalize().add( ++ random.nextGaussian() * (double) 0.0075F * (double) inaccuracy, ++ random.nextGaussian() * (double) 0.0075F * (double) inaccuracy, ++ random.nextGaussian() * (double) 0.0075F * (double) inaccuracy) ++ .scale(speed)); ++ } ++ ++ public void onHit(MovingObjectPosition rayTrace) { ++ CraftEventFactory.callProjectileHitEvent(this, rayTrace); ++ MovingObjectPosition.EnumMovingObjectType type = rayTrace.getType(); ++ if (type == MovingObjectPosition.EnumMovingObjectType.ENTITY) { ++ onHit((MovingObjectPositionEntity) rayTrace); ++ } else if (type == MovingObjectPosition.EnumMovingObjectType.BLOCK) { ++ onHit((MovingObjectPositionBlock) rayTrace); ++ } ++ } ++ ++ protected void onHit(MovingObjectPositionEntity rayTrace) { ++ Entity shooter = getShooter(); ++ if (shooter instanceof EntityLiving) { ++ rayTrace.getEntity().damageEntity(DamageSource.indirectMobAttack(this, (EntityLiving) shooter).setProjectile(), world.purpurConfig.phantomFlameDamage); ++ } ++ } ++ ++ protected void onHit(MovingObjectPositionBlock rayTrace) { ++ IBlockData iblockdata = world.getType(rayTrace.getBlockPosition()); ++ iblockdata.a(world, iblockdata, rayTrace, this); ++ die(); ++ } ++} diff --git a/src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHasRider.java b/src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHasRider.java new file mode 100644 -index 0000000000..68acd09a6e +index 000000000..68acd09a6 --- /dev/null +++ b/src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHasRider.java @@ -0,0 +1,21 @@ @@ -3167,7 +5774,7 @@ index 0000000000..68acd09a6e +} diff --git a/src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHorseHasRider.java b/src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHorseHasRider.java new file mode 100644 -index 0000000000..c0ead608ed +index 000000000..c0ead608e --- /dev/null +++ b/src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHorseHasRider.java @@ -0,0 +1,18 @@ @@ -3190,10 +5797,10 @@ index 0000000000..c0ead608ed + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 6f18a78980..8c300692fa 100644 +index f1710a53f..ecba7b02f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1127,4 +1127,26 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1133,4 +1133,26 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return getHandle().isInLava(); } // Paper end diff --git a/scripts/apatch.sh b/scripts/apatch.sh new file mode 100755 index 000000000..38a204691 --- /dev/null +++ b/scripts/apatch.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +gitcmd="git -c commit.gpgsign=false" + +noapply=1 +isreject=0 +if [[ $1 == "--noapplied" ]]; then + noapply=1 + shift +fi + +if [ ! -z "$1" ]; then + file="$1" +elif [ -z "$1" ] && [ -f .git/rebase-apply/patch ]; then + file=".git/rebase-apply/patch" + noapply=1 + isreject=1 +else + echo "Please specify a file" + exit 1 +fi +applied=$(echo $file | sed 's/.patch$/-applied\.patch/g') +if [ "$1" == "--reset" ]; then + $gitcmd am --abort + $gitcmd reset --hard + $gitcmd clean -f + exit 0 +fi + + +(test "$isreject" != "1" && $gitcmd am -3 $file) || ( + echo "Failures - Wiggling" + $gitcmd reset --hard + $gitcmd clean -f + errors=$($gitcmd apply --rej $file 2>&1) + echo "$errors" >> ~/patch.log + export missingfiles="" + export summaryfail="" + export summarygood="" + for i in $(find . -name \*.rej); do + base=$(echo "$i" | sed 's/.rej//g') + if [ -f "$i" ]; then + sed -e 's/^diff a\/\(.*\) b\/\(.*\)[[:space:]].*rejected.*$/--- \1\n+++ \2/' -i $i && wiggle -v -l --replace "$base" "$i" + rm "$base.porig" "$i" + else + echo "No such file: $base" + missingfiles="$missingfiles\n$base" + fi + done + for i in $($gitcmd status --porcelain | awk '{print $2}'); do + filedata=$(cat "$i") + if [ -f "$file" ] && [[ "$filedata" == *"<<<<<"* ]]; then + export summaryfail="$summaryfail\nFAILED TO APPLY: $i" + else + $gitcmd add "$i" + export summarygood="$summarygood\nAPPLIED CLEAN: $i" + fi + done + echo -e "$summarygood" + echo -e "$summaryfail" + if [[ "$errors" == *"No such file"* ]]; then + echo "==========================="; + echo " " + echo " MISSING FILES" + echo $(echo "$errors" | grep "No such file") + echo -e "$missingfiles" + echo " " + echo "==========================="; + fi + $gitcmd status + $gitcmd diff +) +if [[ "$noapply" != "1" ]] && [[ "$file" != *-applied.patch ]]; then + mv "$file" "$applied" +fi diff --git a/scripts/upstream.sh b/scripts/upstream.sh index 31196c9b5..1250720e5 100755 --- a/scripts/upstream.sh +++ b/scripts/upstream.sh @@ -11,7 +11,7 @@ done if [[ "$1" == up* ]]; then ( cd "$basedir/Paper/" || exit - git fetch && git reset --hard origin/master + git fetch && git reset --hard progress/1.16.2 cd ../ git add Paper )