diff --git a/patches/server/0299-Prevent-bees-loading-chunks-checking-hive-position.patch b/patches/server/0299-Prevent-bees-loading-chunks-checking-hive-position.patch new file mode 100644 index 0000000000..ce7ab4dd4d --- /dev/null +++ b/patches/server/0299-Prevent-bees-loading-chunks-checking-hive-position.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sun, 5 Jan 2020 17:24:34 -0600 +Subject: [PATCH] Prevent bees loading chunks checking hive position + + +diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java +index b1a72ed404f4bc31f32dd771dd320b7c783c9651..310a2aa23365f9a8a8b7b6fa2323aed792f95adb 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java +@@ -514,7 +514,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + + @Nullable + BeehiveBlockEntity getBeehiveBlockEntity() { +- return this.hivePos == null ? null : (this.isTooFarAway(this.hivePos) ? null : (BeehiveBlockEntity) this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null)); // CraftBukkit - decompile error ++ // Paper start - move over logic to accommodate isTooFarAway with chunk load check ++ if (this.hivePos != null && !this.isTooFarAway(this.hivePos) && this.level().getChunkIfLoadedImmediately(this.hivePos.getX() >> 4, this.hivePos.getZ() >> 4) != null) { ++ return (BeehiveBlockEntity) this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null); ++ } ++ return null; ++ // Paper end + } + + boolean isHiveValid() { diff --git a/patches/unapplied/server/0303-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/patches/server/0300-Don-t-load-Chunks-from-Hoppers-and-other-things.patch similarity index 95% rename from patches/unapplied/server/0303-Don-t-load-Chunks-from-Hoppers-and-other-things.patch rename to patches/server/0300-Don-t-load-Chunks-from-Hoppers-and-other-things.patch index 3b189be4e4..cf3afd7040 100644 --- a/patches/unapplied/server/0303-Don-t-load-Chunks-from-Hoppers-and-other-things.patch +++ b/patches/server/0300-Don-t-load-Chunks-from-Hoppers-and-other-things.patch @@ -13,7 +13,7 @@ This of course is undesirable, so just return the loaded side as "primary" and treat it as a single chest if the other sides are unloaded diff --git a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java -index 963092cd5a4e756ad6a471379a81d8996cc2b091..20c9921339ec6b5127fbadcedc19577f3906074d 100644 +index cccdaa29ea97ec1d9e79f5a4811884d54e641677..b5025914678484cc615dc1982762d5d7f55a4557 100644 --- a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java +++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java @@ -34,7 +34,12 @@ public class DoubleBlockCombiner { diff --git a/patches/unapplied/server/0304-Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/0301-Optimise-EntityGetter-getPlayerByUUID.patch similarity index 66% rename from patches/unapplied/server/0304-Optimise-EntityGetter-getPlayerByUUID.patch rename to patches/server/0301-Optimise-EntityGetter-getPlayerByUUID.patch index 6ffcd9f3c3..e0992abebb 100644 --- a/patches/unapplied/server/0304-Optimise-EntityGetter-getPlayerByUUID.patch +++ b/patches/server/0301-Optimise-EntityGetter-getPlayerByUUID.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID Use the PlayerList map instead of iterating over all players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a6a21def1ae0d35fa106da6242c49a0928e4eda5..c85d5b941b5cb1c37cd2619d419006c5956f6eaf 100644 +index 64c1fd62a865adb1e11edd326a1a5ccdc98f13ed..c7a1328e6642ad6c76179bddec117c4281577e86 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -330,6 +330,15 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -333,6 +333,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // Paper end @@ -24,4 +24,4 @@ index a6a21def1ae0d35fa106da6242c49a0928e4eda5..c85d5b941b5cb1c37cd2619d419006c5 + // Add env and gen to constructor, IWorldDataServer -> WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { - // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error + super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules()))); // Paper - create paper world configs diff --git a/patches/unapplied/server/0305-Fix-items-not-falling-correctly.patch b/patches/server/0302-Fix-items-not-falling-correctly.patch similarity index 90% rename from patches/unapplied/server/0305-Fix-items-not-falling-correctly.patch rename to patches/server/0302-Fix-items-not-falling-correctly.patch index 5be02c3b7b..d7e28fecdf 100644 --- a/patches/unapplied/server/0305-Fix-items-not-falling-correctly.patch +++ b/patches/server/0302-Fix-items-not-falling-correctly.patch @@ -15,7 +15,7 @@ This patch resolves the conflict by offsetting checking Spigot's entity activation range check from an item's move method. diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index f9dfd6e7b610cfee75524a525ab0e72bed5522da..e110296a95441a13ec431d897796326b0277edb1 100644 +index 75ebf09777e19645eee296a9edabac39c858ffb9..c390d8b3a706d0177b9f3105a7b9a84265688ece 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -175,7 +175,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -25,10 +25,10 @@ index f9dfd6e7b610cfee75524a525ab0e72bed5522da..e110296a95441a13ec431d897796326b - if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { + if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { // Paper - Diff on change this.move(MoverType.SELF, this.getDeltaMovement()); + this.applyEffectsFromBlocks(); float f = 0.98F; - diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 6d51464f6368151e8acc532414ee223714584e96..9fb9fa62c32445ac3c3883a6433759c86dcfc428 100644 +index 5dac9bdb23de3d143cd678e583eaf6e8095bb209..ad15c7db36bdeadaa8f2ec8f15f41d6f3395bd55 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -256,7 +256,7 @@ public class ActivationRange diff --git a/patches/unapplied/server/0306-Optimize-call-to-getFluid-for-explosions.patch b/patches/server/0303-Optimize-call-to-getFluid-for-explosions.patch similarity index 64% rename from patches/unapplied/server/0306-Optimize-call-to-getFluid-for-explosions.patch rename to patches/server/0303-Optimize-call-to-getFluid-for-explosions.patch index 7a9152c9ec..b6eb87bb5e 100644 --- a/patches/unapplied/server/0306-Optimize-call-to-getFluid-for-explosions.patch +++ b/patches/server/0303-Optimize-call-to-getFluid-for-explosions.patch @@ -4,11 +4,11 @@ Date: Tue, 14 Jan 2020 17:49:03 -0500 Subject: [PATCH] Optimize call to getFluid for explosions -diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index ce8ac06b47e81161ad5ff6cc865ad6d3d59807c1..d4fe425954d36f0baddb256e3c83009a84084b72 100644 ---- a/src/main/java/net/minecraft/world/level/Explosion.java -+++ b/src/main/java/net/minecraft/world/level/Explosion.java -@@ -194,7 +194,7 @@ public class Explosion { +diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java +index d1878f597c3d8119e9b248f4fe8af435ce8c9710..d3d74a7f306d88b0d5cd83893b3ee5e750fd4caf 100644 +--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java ++++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java +@@ -150,7 +150,7 @@ public class ServerExplosion implements Explosion { for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { BlockPos blockposition = BlockPos.containing(d4, d5, d6); BlockState iblockdata = this.level.getBlockState(blockposition); diff --git a/patches/server/0304-Guard-against-serializing-mismatching-chunk-coordina.patch b/patches/server/0304-Guard-against-serializing-mismatching-chunk-coordina.patch new file mode 100644 index 0000000000..26436c7223 --- /dev/null +++ b/patches/server/0304-Guard-against-serializing-mismatching-chunk-coordina.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Fri, 27 Dec 2019 09:42:26 -0800 +Subject: [PATCH] Guard against serializing mismatching chunk coordinate + +Should help if something dumb happens + +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java +index 329e7eb1c3e92445b3fae9e1e79d0497b7e3e3f2..909acbf5b8c6edcb4529647c11464d911d6f8c15 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java +@@ -172,8 +172,19 @@ public class ChunkStorage implements AutoCloseable { + } + + public CompletableFuture write(ChunkPos chunkPos, Supplier nbtSupplier) { ++ // Paper start - guard against possible chunk pos desync ++ final Supplier guardedPosCheck = () -> { ++ CompoundTag nbt = nbtSupplier.get(); ++ if (nbt != null && !chunkPos.equals(SerializableChunkData.getChunkCoordinate(nbt))) { ++ final String world = (ChunkStorage.this instanceof net.minecraft.server.level.ChunkMap) ? ((net.minecraft.server.level.ChunkMap) ChunkStorage.this).level.getWorld().getName() : null; ++ throw new IllegalArgumentException("Chunk coordinate and serialized data do not have matching coordinates, trying to serialize coordinate " + chunkPos ++ + " but compound says coordinate is " + SerializableChunkData.getChunkCoordinate(nbt) + (world == null ? " for an unknown world" : (" for world: " + world))); ++ } ++ return nbt; ++ }; ++ // Paper end - guard against possible chunk pos desync + this.handleLegacyStructureIndex(chunkPos); +- return this.worker.store(chunkPos, nbtSupplier); ++ return this.worker.store(chunkPos, guardedPosCheck); // Paper - guard against possible chunk pos desync + } + + protected void handleLegacyStructureIndex(ChunkPos chunkPos) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +index 4367ccc628bb4f404d6a081083002518442f462b..92ad7704a77c024afe090488764eaf59a4f7505f 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +@@ -91,13 +91,25 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun + public static final String SECTIONS_TAG = "sections"; + public static final String BLOCK_LIGHT_TAG = "BlockLight"; + public static final String SKY_LIGHT_TAG = "SkyLight"; ++ // Paper start - guard against serializing mismatching coordinates ++ // TODO Note: This needs to be re-checked each update ++ public static ChunkPos getChunkCoordinate(final CompoundTag chunkData) { ++ final int dataVersion = ChunkStorage.getVersion(chunkData); ++ if (dataVersion < 2842) { // Level tag is removed after this version ++ final CompoundTag levelData = chunkData.getCompound("Level"); ++ return new ChunkPos(levelData.getInt("xPos"), levelData.getInt("zPos")); ++ } else { ++ return new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos")); ++ } ++ } ++ // Paper end - guard against serializing mismatching coordinates + + @Nullable + public static SerializableChunkData parse(LevelHeightAccessor world, RegistryAccess registryManager, CompoundTag nbt) { + if (!nbt.contains("Status", 8)) { + return null; + } else { +- ChunkPos chunkcoordintpair = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); ++ ChunkPos chunkcoordintpair = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate + long i = nbt.getLong("LastUpdate"); + long j = nbt.getLong("InhabitedTime"); + ChunkStatus chunkstatus = ChunkStatus.byName(nbt.getString("Status")); diff --git a/patches/unapplied/server/0308-Alternative-item-despawn-rate.patch b/patches/server/0305-Alternative-item-despawn-rate.patch similarity index 87% rename from patches/unapplied/server/0308-Alternative-item-despawn-rate.patch rename to patches/server/0305-Alternative-item-despawn-rate.patch index d4e1a80c7c..d9614e183d 100644 --- a/patches/unapplied/server/0308-Alternative-item-despawn-rate.patch +++ b/patches/server/0305-Alternative-item-despawn-rate.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Alternative item-despawn-rate Co-authored-by: Noah van der Aa diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e4382a46ddd 100644 +index c390d8b3a706d0177b9f3105a7b9a84265688ece..65deb4568a80577f67f39de3af9fb568975a649d 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -62,6 +62,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -17,7 +17,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43 public ItemEntity(EntityType type, Level world) { super(type, world); -@@ -215,7 +216,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -216,7 +217,7 @@ public class ItemEntity extends Entity implements TraceableEntity { } } @@ -26,7 +26,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43 // CraftBukkit start - fire ItemDespawnEvent if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; -@@ -238,7 +239,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -239,7 +240,7 @@ public class ItemEntity extends Entity implements TraceableEntity { this.lastTick = MinecraftServer.currentTick; // CraftBukkit end @@ -35,7 +35,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43 // CraftBukkit start - fire ItemDespawnEvent if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; -@@ -294,7 +295,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -297,7 +298,7 @@ public class ItemEntity extends Entity implements TraceableEntity { private boolean isMergable() { ItemStack itemstack = this.getItem(); @@ -44,7 +44,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43 } private void tryToMerge(ItemEntity other) { -@@ -542,6 +543,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -558,6 +559,7 @@ public class ItemEntity extends Entity implements TraceableEntity { public void setItem(ItemStack stack) { this.getEntityData().set(ItemEntity.DATA_ITEM, stack); @@ -52,7 +52,7 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43 } @Override -@@ -596,7 +598,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -612,7 +614,7 @@ public class ItemEntity extends Entity implements TraceableEntity { public void makeFakeItem() { this.setNeverPickUp(); @@ -60,4 +60,4 @@ index e110296a95441a13ec431d897796326b0277edb1..c724359995d65c88e7f365eea55f3e43 + this.age = this.despawnRate - 1; // Spigot // Paper - Alternative item-despawn-rate } - public float getSpin(float tickDelta) { + public static float getSpin(float f, float f1) { diff --git a/patches/unapplied/server/0309-Tracking-Range-Improvements.patch b/patches/server/0306-Tracking-Range-Improvements.patch similarity index 95% rename from patches/unapplied/server/0309-Tracking-Range-Improvements.patch rename to patches/server/0306-Tracking-Range-Improvements.patch index 845b77df2e..45bbbb2ad5 100644 --- a/patches/unapplied/server/0309-Tracking-Range-Improvements.patch +++ b/patches/server/0306-Tracking-Range-Improvements.patch @@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 5573a5d0d0e10e3c584e821d3e8e7ba64a41a627..ee54706b36bd227edacea2a1b6099009bd652039 100644 +index aa3155bb57c09895d13914b46c77de78a90f250a..b849d24144dc9f7d24484398cec3b2b90befb507 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1545,6 +1545,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1604,6 +1604,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); int j = entity.getType().clientTrackingRange() * 16; diff --git a/patches/unapplied/server/0310-Bees-get-gravity-in-void.-Fixes-MC-167279.patch b/patches/server/0307-Bees-get-gravity-in-void.-Fixes-MC-167279.patch similarity index 90% rename from patches/unapplied/server/0310-Bees-get-gravity-in-void.-Fixes-MC-167279.patch rename to patches/server/0307-Bees-get-gravity-in-void.-Fixes-MC-167279.patch index 9ea731b674..f91f8b0422 100644 --- a/patches/unapplied/server/0310-Bees-get-gravity-in-void.-Fixes-MC-167279.patch +++ b/patches/server/0307-Bees-get-gravity-in-void.-Fixes-MC-167279.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Bees get gravity in void. Fixes MC-167279 diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 58536ee8707c5ad0625cae2f26a58cf03b3f85d7..4134ee48909110f8c338f5d553d4cc1e9e31aaba 100644 +index 310a2aa23365f9a8a8b7b6fa2323aed792f95adb..8c7943fdb56cd75c362e47e6c934bde5a714adaa 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -144,7 +144,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -150,7 +150,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { public Bee(EntityType type, Level world) { super(type, world); this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60); diff --git a/patches/unapplied/server/0311-Improve-Block-breakNaturally-API.patch b/patches/server/0308-Improve-Block-breakNaturally-API.patch similarity index 95% rename from patches/unapplied/server/0311-Improve-Block-breakNaturally-API.patch rename to patches/server/0308-Improve-Block-breakNaturally-API.patch index b478ee5bb4..55dcdabf64 100644 --- a/patches/unapplied/server/0311-Improve-Block-breakNaturally-API.patch +++ b/patches/server/0308-Improve-Block-breakNaturally-API.patch @@ -18,10 +18,10 @@ public net.minecraft.world.level.block.TurtleEggBlock decreaseEggs(Lnet/minecraf Co-authored-by: William Blake Galbreath diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java -index 363dd6ab9c7b650913795ef350374d5c4e7e4925..e862814c1e54776f11050623b52476accc2f1f79 100644 +index 6a4cc64068f67ee18a9e505888edb3874597b98a..067a2d969ca0979ae67b600e303deec93eda0251 100644 --- a/src/main/java/net/minecraft/world/level/block/IceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java -@@ -35,6 +35,11 @@ public class IceBlock extends HalfTransparentBlock { +@@ -36,6 +36,11 @@ public class IceBlock extends HalfTransparentBlock { @Override public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) { super.playerDestroy(world, player, pos, state, blockEntity, tool); @@ -34,7 +34,7 @@ index 363dd6ab9c7b650913795ef350374d5c4e7e4925..e862814c1e54776f11050623b52476ac if (world.dimensionType().ultraWarm()) { world.removeBlock(pos, false); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index d4e14ac1514e2d8b87b4667a91c90eded3ba6636..f041b5d80bff9c022b007e04ef1558e9116acc6b 100644 +index e5ac2d79b21db4e9a92b739e39d41a22deee175b..aae00320ab8003420bae5de7df47f553b62c5aab 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -452,6 +452,18 @@ public class CraftBlock implements Block { diff --git a/patches/unapplied/server/0312-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/patches/server/0309-Optimise-getChunkAt-calls-for-loaded-chunks.patch similarity index 86% rename from patches/unapplied/server/0312-Optimise-getChunkAt-calls-for-loaded-chunks.patch rename to patches/server/0309-Optimise-getChunkAt-calls-for-loaded-chunks.patch index d1fed5285f..8a7a310666 100644 --- a/patches/unapplied/server/0312-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/patches/server/0309-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either, then unwrap it... diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index a939bad7da9c852827a2d67d9ace5d0df4911a31..1049452baaf0381ffbf15b30da956c2a1994da35 100644 +index 3bbc7aa52a2ee797d6033684e73d6b307c2fadcc..4302d5119c43eb8de0c026162fc62ddeb5ab87cb 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -179,6 +179,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -191,6 +191,12 @@ public class ServerChunkCache extends ChunkSource { return this.getChunk(x, z, leastStatus, create); }, this.mainThreadProcessor).join(); } else { @@ -20,14 +20,14 @@ index a939bad7da9c852827a2d67d9ace5d0df4911a31..1049452baaf0381ffbf15b30da956c2a + return ifLoaded; + } + // Paper end - Perf: Optimise getChunkAt calls for loaded chunks - ProfilerFiller gameprofilerfiller = this.level.getProfiler(); + ProfilerFiller gameprofilerfiller = Profiler.get(); gameprofilerfiller.incrementCounter("getChunk"); -@@ -222,33 +228,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -234,33 +240,7 @@ public class ServerChunkCache extends ChunkSource { if (Thread.currentThread() != this.mainThread) { return null; } else { -- this.level.getProfiler().incrementCounter("getChunkNow"); +- Profiler.get().incrementCounter("getChunkNow"); - long k = ChunkPos.asLong(chunkX, chunkZ); - - ChunkAccess ichunkaccess; diff --git a/patches/unapplied/server/0313-Add-debug-for-sync-chunk-loads.patch b/patches/server/0310-Add-debug-for-sync-chunk-loads.patch similarity index 97% rename from patches/unapplied/server/0313-Add-debug-for-sync-chunk-loads.patch rename to patches/server/0310-Add-debug-for-sync-chunk-loads.patch index bf5532d58e..73dc4103eb 100644 --- a/patches/unapplied/server/0313-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0310-Add-debug-for-sync-chunk-loads.patch @@ -302,10 +302,10 @@ index 0000000000000000000000000000000000000000..95d6022c9cfb2e36ec5a71be6e343540 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 1049452baaf0381ffbf15b30da956c2a1994da35..60f678c26fb5144386d8697ddfd5b6d841563b6f 100644 +index 4302d5119c43eb8de0c026162fc62ddeb5ab87cb..7e5714fea4cda68b9ae21031c0e0d39061b07e2f 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -206,6 +206,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -218,6 +218,7 @@ public class ServerChunkCache extends ChunkSource { Objects.requireNonNull(completablefuture); if (!completablefuture.isDone()) { // Paper @@ -314,10 +314,10 @@ index 1049452baaf0381ffbf15b30da956c2a1994da35..60f678c26fb5144386d8697ddfd5b6d8 chunkproviderserver_b.managedBlock(completablefuture::isDone); this.level.timings.syncChunkLoad.stopTiming(); // Paper diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c85d5b941b5cb1c37cd2619d419006c5956f6eaf..f1fa4cb11f69e248dd55b8aa69f5d07268f182a1 100644 +index c7a1328e6642ad6c76179bddec117c4281577e86..e2984ccee4e01b260109d038969f9ff3ea21b87f 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -422,6 +422,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -412,6 +412,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit } diff --git a/patches/unapplied/server/0314-Improve-java-version-check.patch b/patches/server/0311-Improve-java-version-check.patch similarity index 95% rename from patches/unapplied/server/0314-Improve-java-version-check.patch rename to patches/server/0311-Improve-java-version-check.patch index 7814ffea5a..90af2b3b15 100644 --- a/patches/unapplied/server/0314-Improve-java-version-check.patch +++ b/patches/server/0311-Improve-java-version-check.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Improve java version check Co-Authored-By: MiniDigger diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index bcc9d3b1503b1be1841c9ab40e879a1cbb0549f2..224b7f5394a568a3982f1e9a554e72af969fbe43 100644 +index 1efb42f7ad357f9b4185dea79106ccd38c9f5325..c618934b5cf66d9625c7be2ac114f1a1ca629d33 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -203,11 +203,20 @@ public class Main { diff --git a/patches/unapplied/server/0315-Add-ThrownEggHatchEvent.patch b/patches/server/0312-Add-ThrownEggHatchEvent.patch similarity index 90% rename from patches/unapplied/server/0315-Add-ThrownEggHatchEvent.patch rename to patches/server/0312-Add-ThrownEggHatchEvent.patch index 21fd12f380..4f5c62f3e6 100644 --- a/patches/unapplied/server/0315-Add-ThrownEggHatchEvent.patch +++ b/patches/server/0312-Add-ThrownEggHatchEvent.patch @@ -7,10 +7,10 @@ Adds a new event similar to PlayerEggThrowEvent, but without the Player requirem (dispensers can throw eggs to hatch them, too). diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java -index 62850e899955732afdd255ea1e55fc84b7c6c96b..dbd60cc8c39f5d2d4c77e2de4f2567e7fa456cd2 100644 +index eb197a719177dcc1605ee0ff3c471ba91783f040..155c2bbd35adacb7c3668fbe81a7c454e5102c8b 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java -@@ -86,6 +86,13 @@ public class ThrownEgg extends ThrowableItemProjectile { +@@ -88,6 +88,13 @@ public class ThrownEgg extends ThrowableItemProjectile { } } // CraftBukkit end diff --git a/patches/unapplied/server/0316-Entity-Jump-API.patch b/patches/server/0313-Entity-Jump-API.patch similarity index 75% rename from patches/unapplied/server/0316-Entity-Jump-API.patch rename to patches/server/0313-Entity-Jump-API.patch index 9e2cba6a0a..290c2cea30 100644 --- a/patches/unapplied/server/0316-Entity-Jump-API.patch +++ b/patches/server/0313-Entity-Jump-API.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Entity Jump API public net.minecraft.world.entity.LivingEntity jumping diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8ee6d25c3860fe7f2e5039c74c736d82eefda237..4c32b26e29ca3db0a2f62052e14bcc3e4c1cdea5 100644 +index f720d4d93ed13b1b9287a1ee7dc8bc4794834e1a..304a401fb1f378ff2cbfd888acf56a8516f79310 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3433,8 +3433,10 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3539,8 +3539,10 @@ public abstract class LivingEntity extends Entity implements Attackable { } else if (this.isInLava() && (!this.onGround() || d3 > d4)) { this.jumpInLiquid(FluidTags.LAVA); } else if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) { @@ -22,10 +22,10 @@ index 8ee6d25c3860fe7f2e5039c74c736d82eefda237..4c32b26e29ca3db0a2f62052e14bcc3e } else { this.noJumpDelay = 0; diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java -index 228cfb77e12ed5979e422dc5dbb5e8dcf363b509..8df42121aa22ec9f95a1b8627b64b0ff71e36314 100644 +index 0b0887b7d2c69138617bee6ec3145f0a83b8734d..705c26ceff9371b09311bd7fa796c0efde7ebfee 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java +++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java -@@ -541,7 +541,9 @@ public class Panda extends Animal { +@@ -530,7 +530,9 @@ public class Panda extends Animal { Panda entitypanda = (Panda) iterator.next(); if (!entitypanda.isBaby() && entitypanda.onGround() && !entitypanda.isInWater() && entitypanda.canPerformAction()) { @@ -36,24 +36,24 @@ index 228cfb77e12ed5979e422dc5dbb5e8dcf363b509..8df42121aa22ec9f95a1b8627b64b0ff } diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java -index 4d91bc4b90a208fec789325dbcec8cc56d1a2a8b..aa4111eef22546f8aa630228c51ef5761c9b373b 100644 +index 32973d9c7bf4c4105d7bd82d3723e0b70cd79644..c661ae4e5c07494c7de852cc8d01f0f9839c1590 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java +++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java -@@ -160,7 +160,9 @@ public class Ravager extends Raider { - } +@@ -174,7 +174,9 @@ public class Ravager extends Raider { + } - if (!flag && this.onGround()) { -+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API - this.jumpFromGround(); -+ } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop + if (!flag && this.onGround()) { ++ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API + this.jumpFromGround(); ++ } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop + } } } - diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index c0684f1864ece26b4f337ac615db04f615957c13..05ba1654ec02ff2b518251c128661e3d8dfa4c6d 100644 +index c4c83b4e17aac23794fdb51acfba4e7ef8451e2c..81034513faa3bd4f306430bc48532ba671a7b94b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -974,4 +974,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -993,4 +993,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(this.getHandle().getUsedItemHand()); } // Paper end - active item API diff --git a/patches/unapplied/server/0317-Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/0314-Add-option-to-nerf-pigmen-from-nether-portals.patch similarity index 73% rename from patches/unapplied/server/0317-Add-option-to-nerf-pigmen-from-nether-portals.patch rename to patches/server/0314-Add-option-to-nerf-pigmen-from-nether-portals.patch index 18fff797e7..81ec1db92d 100644 --- a/patches/unapplied/server/0317-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/0314-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9d56aff2766b684f0fb20e93d504de1a7a564b11..94242c19740ae6ab2c86e3949bab6cee631b938f 100644 +index 463d34e7b54efd503c4879d1386b2439474863dd..fa80b6220aba144521dc0a2a35914c10046c1963 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -403,6 +403,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -406,6 +406,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void inactiveTick() { } // Spigot end protected int numCollisions = 0; // Paper - Cap entity collisions @@ -16,7 +16,7 @@ index 9d56aff2766b684f0fb20e93d504de1a7a564b11..94242c19740ae6ab2c86e3949bab6cee public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one // Paper start - Entity origin API @javax.annotation.Nullable -@@ -2282,6 +2283,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2398,6 +2399,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (spawnedViaMobSpawner) { nbttagcompound.putBoolean("Paper.FromMobSpawner", true); } @@ -26,7 +26,7 @@ index 9d56aff2766b684f0fb20e93d504de1a7a564b11..94242c19740ae6ab2c86e3949bab6cee // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -2424,6 +2428,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2541,6 +2545,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -35,15 +35,17 @@ index 9d56aff2766b684f0fb20e93d504de1a7a564b11..94242c19740ae6ab2c86e3949bab6cee String spawnReasonName = nbt.getString("Paper.SpawnReason"); try { diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -index 8072e67f7b2f5944670159d3de1b01090bd1019d..a4e1c878dc7677e8ccc7c568ab455e85513d86cb 100644 +index 5d4c0d7fec42bf843b11875f7a09bcb9279b3b54..dea13596eb8a3b7bc69c19545b2227b4c45ed241 100644 --- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -@@ -88,6 +88,8 @@ public class NetherPortalBlock extends Block implements Portal { +@@ -89,6 +89,10 @@ public class NetherPortalBlock extends Block implements Portal { if (entity != null) { entity.setPortalCooldown(); -+ entity.fromNetherPortal = true; // Paper - Add option to nerf pigmen from nether portals -+ if (world.paperConfig().entities.behavior.nerfPigmenFromNetherPortals) ((net.minecraft.world.entity.Mob) entity).aware = false; // Paper - Add option to nerf pigmen from nether portals - } - } - } ++ // Paper start - Add option to nerf pigmen from nether portals ++ entity.fromNetherPortal = true; ++ if (world.paperConfig().entities.behavior.nerfPigmenFromNetherPortals) ((net.minecraft.world.entity.Mob) entity).aware = false; ++ // Paper end - Add option to nerf pigmen from nether portals + Entity entity1 = entity.getVehicle(); + + if (entity1 != null) { diff --git a/patches/unapplied/server/0318-Make-the-GUI-graph-fancier.patch b/patches/server/0315-Make-the-GUI-graph-fancier.patch similarity index 100% rename from patches/unapplied/server/0318-Make-the-GUI-graph-fancier.patch rename to patches/server/0315-Make-the-GUI-graph-fancier.patch diff --git a/patches/unapplied/server/0319-add-hand-to-BlockMultiPlaceEvent.patch b/patches/server/0316-add-hand-to-BlockMultiPlaceEvent.patch similarity index 89% rename from patches/unapplied/server/0319-add-hand-to-BlockMultiPlaceEvent.patch rename to patches/server/0316-add-hand-to-BlockMultiPlaceEvent.patch index 078a0ba255..d0fe787da6 100644 --- a/patches/unapplied/server/0319-add-hand-to-BlockMultiPlaceEvent.patch +++ b/patches/server/0316-add-hand-to-BlockMultiPlaceEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] add hand to BlockMultiPlaceEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 8172a75aef7c3dcdd92817f148466a4cad4c78ed..235ac5c12dab593da3a40e348a010ff626ce74a3 100644 +index 834516cac1f3ac5f078dd4e4dfa449f39462658c..41f23ce732b6e90828b1bbda7f4b3470cd462c4a 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -412,13 +412,18 @@ public class CraftEventFactory { +@@ -411,13 +411,18 @@ public class CraftEventFactory { } org.bukkit.inventory.ItemStack item; diff --git a/patches/unapplied/server/0320-Validate-tripwire-hook-placement-before-update.patch b/patches/server/0317-Validate-tripwire-hook-placement-before-update.patch similarity index 86% rename from patches/unapplied/server/0320-Validate-tripwire-hook-placement-before-update.patch rename to patches/server/0317-Validate-tripwire-hook-placement-before-update.patch index bc1125b169..b607c1afe9 100644 --- a/patches/unapplied/server/0320-Validate-tripwire-hook-placement-before-update.patch +++ b/patches/server/0317-Validate-tripwire-hook-placement-before-update.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Validate tripwire hook placement before update diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java -index bc4d324f086d815c139408629a561ea4d94c839b..8614fad5b3df7a6030384b108b1689bf6b9f1209 100644 +index 1240f18b3d40f8bde2346c893304ae340a727e24..c2589f42c467ca672417c24076313da51bb2dcbb 100644 --- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java -@@ -189,6 +189,7 @@ public class TripWireHookBlock extends Block { +@@ -191,6 +191,7 @@ public class TripWireHookBlock extends Block { TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3); if (!flag) { diff --git a/patches/unapplied/server/0321-Add-option-to-allow-iron-golems-to-spawn-in-air.patch b/patches/server/0318-Add-option-to-allow-iron-golems-to-spawn-in-air.patch similarity index 86% rename from patches/unapplied/server/0321-Add-option-to-allow-iron-golems-to-spawn-in-air.patch rename to patches/server/0318-Add-option-to-allow-iron-golems-to-spawn-in-air.patch index 75d1d9c02b..8991de1b70 100644 --- a/patches/unapplied/server/0321-Add-option-to-allow-iron-golems-to-spawn-in-air.patch +++ b/patches/server/0318-Add-option-to-allow-iron-golems-to-spawn-in-air.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to allow iron golems to spawn in air diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java -index 615be0b85fb3d28a044c6bae6a0fe93ec4fca061..1807da10d07d1f6e4ddbc0fa1b8da34a688d67c3 100644 +index dac63f51fc23cc7f35ee299d1e04c96c210db52b..e07b79ef172095c1800c88342b3ac8dc7703aea2 100644 --- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java +++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java -@@ -325,7 +325,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob { +@@ -319,7 +319,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob { BlockPos blockposition1 = blockposition.below(); BlockState iblockdata = world.getBlockState(blockposition1); diff --git a/patches/unapplied/server/0322-Configurable-chance-of-villager-zombie-infection.patch b/patches/server/0319-Configurable-chance-of-villager-zombie-infection.patch similarity index 81% rename from patches/unapplied/server/0322-Configurable-chance-of-villager-zombie-infection.patch rename to patches/server/0319-Configurable-chance-of-villager-zombie-infection.patch index 217787cdc9..d71db6d824 100644 --- a/patches/unapplied/server/0322-Configurable-chance-of-villager-zombie-infection.patch +++ b/patches/server/0319-Configurable-chance-of-villager-zombie-infection.patch @@ -8,10 +8,10 @@ This allows you to solve an issue in vanilla behavior where: * On normal difficulty they will have a 50% of getting infected or dying. diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index d981f8679149669f6ca4ea950d744149974532b2..e2a3978899497b6622829d6577cfaa723092da9d 100644 +index 81d27114bd081096612e50a8cb93cae772cf46eb..2ed71c9a091bedea276f9043fb0c082dd250cdae 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -454,10 +454,8 @@ public class Zombie extends Monster { +@@ -484,10 +484,8 @@ public class Zombie extends Monster { public boolean killedEntity(ServerLevel world, LivingEntity other) { boolean flag = super.killedEntity(world, other); @@ -21,6 +21,6 @@ index d981f8679149669f6ca4ea950d744149974532b2..e2a3978899497b6622829d6577cfaa72 - } + final double fallbackChance = world.getDifficulty() == Difficulty.HARD ? 100d : world.getDifficulty() == Difficulty.NORMAL ? 50d : 0d; // Paper - Configurable chance of villager zombie infection + if (this.random.nextDouble() * 100 < world.paperConfig().entities.behavior.zombieVillagerInfectionChance.or(fallbackChance) && other instanceof Villager entityvillager) { // Paper - Configurable chance of villager zombie infection - // CraftBukkit start - flag = Zombie.zombifyVillager(world, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null; - } + + if (this.convertVillagerToZombieVillager(world, entityvillager)) { + flag = false; diff --git a/patches/unapplied/server/0323-Optimise-Chunk-getFluid.patch b/patches/server/0320-Optimise-Chunk-getFluid.patch similarity index 88% rename from patches/unapplied/server/0323-Optimise-Chunk-getFluid.patch rename to patches/server/0320-Optimise-Chunk-getFluid.patch index 8142952ce6..1126b881da 100644 --- a/patches/unapplied/server/0323-Optimise-Chunk-getFluid.patch +++ b/patches/server/0320-Optimise-Chunk-getFluid.patch @@ -8,10 +8,10 @@ faster on its own, however removing the try catch makes it easier to inline due to code size diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 6775217c065026aa61fce56a17c93010209b6941..59f9ff720e92c69e11afe7f6ccecd81b0e54a74d 100644 +index add5ec0f8e8bd0b89511dcb656e1d4cda702a86b..7181acfafad91aa5f6ab7ce663d9be4a1b65b02a 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -270,18 +270,20 @@ public class LevelChunk extends ChunkAccess { +@@ -293,18 +293,20 @@ public class LevelChunk extends ChunkAccess { } public FluidState getFluidState(int x, int y, int z) { @@ -38,7 +38,7 @@ index 6775217c065026aa61fce56a17c93010209b6941..59f9ff720e92c69e11afe7f6ccecd81b } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Getting fluid state"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block being got"); -@@ -291,6 +293,7 @@ public class LevelChunk extends ChunkAccess { +@@ -314,6 +316,7 @@ public class LevelChunk extends ChunkAccess { }); throw new ReportedException(crashreport); } @@ -47,10 +47,10 @@ index 6775217c065026aa61fce56a17c93010209b6941..59f9ff720e92c69e11afe7f6ccecd81b // CraftBukkit start diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index 2c153af611399e884752f8256bee4fe32de5c572..90d1c3e23e753c29660f7d993b3c90ac022941c3 100644 +index 771529ba28a16664ad19ed9c0f4bf95eeb7da76b..52f44f14bbda60fe771c351e01e6ff470d7371e6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -43,7 +43,7 @@ public class LevelChunkSection { +@@ -49,7 +49,7 @@ public class LevelChunkSection { } public FluidState getFluidState(int x, int y, int z) { diff --git a/patches/unapplied/server/0324-Set-spigots-verbose-world-setting-to-false-by-def.patch b/patches/server/0321-Set-spigots-verbose-world-setting-to-false-by-def.patch similarity index 100% rename from patches/unapplied/server/0324-Set-spigots-verbose-world-setting-to-false-by-def.patch rename to patches/server/0321-Set-spigots-verbose-world-setting-to-false-by-def.patch diff --git a/patches/unapplied/server/0325-Add-tick-times-API-and-mspt-command.patch b/patches/server/0322-Add-tick-times-API-and-mspt-command.patch similarity index 91% rename from patches/unapplied/server/0325-Add-tick-times-API-and-mspt-command.patch rename to patches/server/0322-Add-tick-times-API-and-mspt-command.patch index b8fd4a8f65..d0480d54b7 100644 --- a/patches/unapplied/server/0325-Add-tick-times-API-and-mspt-command.patch +++ b/patches/server/0322-Add-tick-times-API-and-mspt-command.patch @@ -125,10 +125,10 @@ index 72f2e81b9905a0d57ed8e2a88578f62d5235c456..7b58b2d6297800c2dcdbf7539e5ab8e7 public static void registerCommands(final MinecraftServer server) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ddc3da84c5a55d2cd977fcdb18121351606a6b3c..53bb62c1dcb487be915759d22e06aea80be54f36 100644 +index 5f84618775d66d50557fa71f77fa322c2d1da791..708552756a33339ce9eefe48c9999a2ec08f7e1c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -258,6 +258,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop +Date: Tue, 17 Mar 2020 14:18:50 -0500 +Subject: [PATCH] Do not allow Vexes to load chunks + + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java +index 1a5a61f3c6587992acadc83d5dff97ae2fe53235..183a33b7d666d652b455baa7e8339e9c4a870a58 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Vex.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java +@@ -354,7 +354,10 @@ public class Vex extends Monster implements TraceableEntity { + for (int i = 0; i < 3; ++i) { + BlockPos blockposition1 = blockposition.offset(Vex.this.random.nextInt(15) - 7, Vex.this.random.nextInt(11) - 5, Vex.this.random.nextInt(15) - 7); + +- if (Vex.this.level().isEmptyBlock(blockposition1)) { ++ // Paper start - Don't load chunks ++ final net.minecraft.world.level.block.state.BlockState blockState = Vex.this.level().getBlockStateIfLoaded(blockposition1); ++ if (blockState != null && blockState.isAir()) { ++ // Paper end - Don't load chunks + Vex.this.moveControl.setWantedPosition((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 0.25D); + if (Vex.this.getTarget() == null) { + Vex.this.getLookControl().setLookAt((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 180.0F, 20.0F); diff --git a/patches/unapplied/server/0302-Prevent-bees-loading-chunks-checking-hive-position.patch b/patches/unapplied/server/0302-Prevent-bees-loading-chunks-checking-hive-position.patch deleted file mode 100644 index e933516d42..0000000000 --- a/patches/unapplied/server/0302-Prevent-bees-loading-chunks-checking-hive-position.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 5 Jan 2020 17:24:34 -0600 -Subject: [PATCH] Prevent bees loading chunks checking hive position - - -diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 048d03c8ef3ef865641b2276477cf84e8d4397a1..58536ee8707c5ad0625cae2f26a58cf03b3f85d7 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Bee.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -510,6 +510,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } else if (this.isTooFarAway(this.hivePos)) { - return false; - } else { -+ if (this.level().getChunkIfLoadedImmediately(this.hivePos.getX() >> 4, this.hivePos.getZ() >> 4) == null) return true; // Paper - just assume the hive is still there, no need to load the chunk(s) - BlockEntity tileentity = this.level().getBlockEntity(this.hivePos); - - return tileentity != null && tileentity.getType() == BlockEntityType.BEEHIVE; diff --git a/patches/unapplied/server/0307-Guard-against-serializing-mismatching-chunk-coordina.patch b/patches/unapplied/server/0307-Guard-against-serializing-mismatching-chunk-coordina.patch deleted file mode 100644 index 6752b44617..0000000000 --- a/patches/unapplied/server/0307-Guard-against-serializing-mismatching-chunk-coordina.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Fri, 27 Dec 2019 09:42:26 -0800 -Subject: [PATCH] Guard against serializing mismatching chunk coordinate - -Should help if something dumb happens - -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 47f5f3d58bb3bf85cf35f9baae77df7fab5c844f..0dd6f1bce4913cb84ba21a20df5573bab3a64645 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -88,8 +88,21 @@ public class ChunkSerializer { - - public ChunkSerializer() {} - -+ // Paper start - guard against serializing mismatching coordinates -+ // TODO Note: This needs to be re-checked each update -+ public static ChunkPos getChunkCoordinate(final CompoundTag chunkData) { -+ final int dataVersion = ChunkStorage.getVersion(chunkData); -+ if (dataVersion < 2842) { // Level tag is removed after this version -+ final CompoundTag levelData = chunkData.getCompound("Level"); -+ return new ChunkPos(levelData.getInt("xPos"), levelData.getInt("zPos")); -+ } else { -+ return new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos")); -+ } -+ } -+ // Paper end - guard against serializing mismatching coordinates -+ - public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, RegionStorageInfo key, ChunkPos chunkPos, CompoundTag nbt) { -- ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); -+ ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate - - if (!Objects.equals(chunkPos, chunkcoordintpair1)) { - ChunkSerializer.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", new Object[]{chunkPos, chunkPos, chunkcoordintpair1}); -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -index 3e194944e50f8395074d68d4abe4c084c3fadcc1..9aa9ab894080a5819fc45698771afd034906d36a 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -@@ -172,6 +172,13 @@ public class ChunkStorage implements AutoCloseable { - } - - public CompletableFuture write(ChunkPos chunkPos, CompoundTag nbt) { -+ // Paper start - guard against serializing mismatching coordinates -+ if (nbt != null && !chunkPos.equals(ChunkSerializer.getChunkCoordinate(nbt))) { -+ final String world = (this instanceof net.minecraft.server.level.ChunkMap) ? ((net.minecraft.server.level.ChunkMap) this).level.getWorld().getName() : null; -+ throw new IllegalArgumentException("Chunk coordinate and serialized data do not have matching coordinates, trying to serialize coordinate " + chunkPos -+ + " but compound says coordinate is " + ChunkSerializer.getChunkCoordinate(nbt) + (world == null ? " for an unknown world" : (" for world: " + world))); -+ } -+ // Paper end - guard against serializing mismatching coordinates - this.handleLegacyStructureIndex(chunkPos); - return this.worker.store(chunkPos, nbt); - } diff --git a/patches/unapplied/server/0330-Do-not-allow-bees-to-load-chunks-for-beehives.patch b/patches/unapplied/server/0330-Do-not-allow-bees-to-load-chunks-for-beehives.patch deleted file mode 100644 index f361af6e50..0000000000 --- a/patches/unapplied/server/0330-Do-not-allow-bees-to-load-chunks-for-beehives.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: chickeneer -Date: Tue, 17 Mar 2020 14:18:50 -0500 -Subject: [PATCH] Do not allow bees to load chunks for beehives - - -diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 4134ee48909110f8c338f5d553d4cc1e9e31aaba..615b57fac9def18d9dcaefcfe397c74c11cac627 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Bee.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -421,6 +421,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - if (this.hivePos == null) { - return false; - } else { -+ if (!this.level().isLoadedAndInBounds(this.hivePos)) return false; // Paper - Do not allow bees to load chunks for beehives - BlockEntity tileentity = this.level().getBlockEntity(this.hivePos); - - return tileentity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity) tileentity).isFireNearby(); -@@ -454,6 +455,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } - - private boolean doesHiveHaveSpace(BlockPos pos) { -+ if (!this.level().isLoadedAndInBounds(pos)) return false; // Paper - Do not allow bees to load chunks for beehives - BlockEntity tileentity = this.level().getBlockEntity(pos); - - return tileentity instanceof BeehiveBlockEntity ? !((BeehiveBlockEntity) tileentity).isFull() : false; -@@ -924,6 +926,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - @Override - public boolean canBeeUse() { - if (Bee.this.hasHive() && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerToCenterThan(Bee.this.position(), 2.0D)) { -+ if (!Bee.this.level().isLoadedAndInBounds(Bee.this.hivePos)) return false; // Paper - Do not allow bees to load chunks for beehives - BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos); - - if (tileentity instanceof BeehiveBlockEntity) { -@@ -947,6 +950,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - - @Override - public void start() { -+ if (!Bee.this.level().isLoadedAndInBounds(Bee.this.hivePos)) return; // Paper - Do not allow bees to load chunks for beehives - BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos); - - if (tileentity instanceof BeehiveBlockEntity tileentitybeehive) { -diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java -index d6f73c719d58970c6d13340f78c3303916b46546..2985296a9a034e535157f55e322fc8c107827752 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Vex.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java -@@ -356,7 +356,10 @@ public class Vex extends Monster implements TraceableEntity { - for (int i = 0; i < 3; ++i) { - BlockPos blockposition1 = blockposition.offset(Vex.this.random.nextInt(15) - 7, Vex.this.random.nextInt(11) - 5, Vex.this.random.nextInt(15) - 7); - -- if (Vex.this.level().isEmptyBlock(blockposition1)) { -+ // Paper start - Don't load chunks -+ final net.minecraft.world.level.block.state.BlockState blockState = Vex.this.level().getBlockStateIfLoaded(blockposition1); -+ if (blockState != null && blockState.isAir()) { -+ // Paper end - Don't load chunks - Vex.this.moveControl.setWantedPosition((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 0.25D); - if (Vex.this.getTarget() == null) { - Vex.this.getLookControl().setLookAt((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 180.0F, 20.0F);