From c9cdc05ff1687f84f9486b79ea16a47b342803c6 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 17 Jun 2021 14:39:36 -0700 Subject: [PATCH] remove more obfhelpers --- build-data/paper.at | 18 +- patches/server/0006-MC-Utils.patch | 240 ++---------------- patches/server/0009-Timings-v2.patch | 23 +- patches/server/0010-Adventure.patch | 6 +- ...d-mobs-to-jump-and-take-water-damage.patch | 13 +- .../0021-Player-affects-spawning-API.patch | 18 +- patches/server/0025-Entity-Origin-API.patch | 8 +- ...event-tile-entity-and-entity-crashes.patch | 8 +- .../0041-Disable-spigot-tick-limiters.patch | 4 +- .../0048-Player-Tab-List-and-Title-APIs.patch | 6 +- ...dd-configurable-portal-search-radius.patch | 4 +- .../0053-Add-exception-reporting-event.patch | 16 +- ...oreboards-for-non-players-by-default.patch | 4 +- .../server/0058-Chunk-Save-Reattempt.patch | 4 +- .../server/0064-Add-World-Util-Methods.patch | 18 +- ...Location-getType-and-getBlockData-fo.patch | 14 +- ...ckPhysicsEvent-if-a-plugin-has-a-lis.patch | 8 +- patches/server/0073-EntityPathfindEvent.patch | 15 +- ...5-Do-not-load-chunks-for-Pathfinding.patch | 26 -- ...g-BlockPlaceEvent-triggering-physics.patch | 4 +- ...-API-Replenishable-Lootables-Feature.patch | 6 +- ...vent-Pathfinding-out-of-World-Border.patch | 8 +- ...imize-World.isLoaded-BlockPosition-Z.patch | 4 +- ...-Bound-Treasure-Maps-to-World-Border.patch | 12 +- patches/server/0124-Firework-API-s.patch | 4 +- ...llow-entities-to-ride-themselves-572.patch | 4 +- ...PI-for-Reason-Source-Triggering-play.patch | 21 +- .../server/0143-Basic-PlayerProfile-API.patch | 12 +- .../server/0147-Entity-fromMobSpawner.patch | 8 +- ...66-Fix-MC-117075-TE-Unload-Lag-Spike.patch | 8 +- ...e-implementations-for-captured-block.patch | 4 +- ...-more-information-to-Entity.toString.patch | 4 +- ...t-armor-stands-from-doing-entity-loo.patch | 4 +- .../server/0235-SkeletonHorse-Additions.patch | 4 +- patches/server/0240-Add-TNTPrimeEvent.patch | 4 +- ...ient-rendering-skulls-from-same-user.patch | 14 +- .../0256-Add-PhantomPreSpawnEvent.patch | 4 +- ...60-Asynchronous-chunk-IO-and-loading.patch | 24 +- patches/server/0265-Mob-Pathfinding-API.patch | 151 ++--------- ...276-Add-LivingEntity-getTargetEntity.patch | 16 +- patches/server/0281-Add-more-Witch-API.patch | 17 +- ...entity-dismount-during-teleportation.patch | 12 +- .../0300-Add-PlayerConnectionCloseEvent.patch | 14 +- patches/server/0306-BlockDestroyEvent.patch | 4 +- .../0316-Entity-getEntitySpawnReason.patch | 10 +- ...0322-PlayerDeathEvent-getItemsToKeep.patch | 4 +- ...-Optimize-Captured-TileEntity-Lookup.patch | 4 +- patches/server/0333-Chunk-debug-command.patch | 8 +- ...334-Allow-Saving-of-Oversized-Chunks.patch | 8 +- ...336-Fix-World-isChunkGenerated-calls.patch | 28 +- patches/server/0367-Anti-Xray.patch | 90 ++++--- ...No-Tick-view-distance-implementation.patch | 18 +- ...x-items-vanishing-through-end-portal.patch | 4 +- ...opper-searches-if-there-are-no-items.patch | 4 +- ...n-to-nerf-pigmen-from-nether-portals.patch | 6 +- ...imise-TickListServer-by-rewriting-it.patch | 6 +- ...ptimize-Collision-to-not-load-chunks.patch | 10 +- .../0404-Improved-Watchdog-Support.patch | 10 +- .../server/0405-Optimize-Pathfinding.patch | 4 +- ...e-memory-footprint-of-NBTTagCompound.patch | 4 +- ...Load-Chunks-for-Login-Asynchronously.patch | 10 +- ...pawn-point-if-spawn-in-unloaded-worl.patch | 4 +- ...m-duplication-issues-and-teleport-is.patch | 12 +- .../0429-Optimize-Voxel-Shape-Merging.patch | 6 +- ...and-End-Portal-Frames-from-being-des.patch | 8 +- .../0455-incremental-chunk-saving.patch | 14 +- ...sure-Entity-AABB-s-are-never-invalid.patch | 4 +- ...WorldBorder-collision-checks-and-air.patch | 8 +- ...0473-Support-old-UUID-format-for-NBT.patch | 8 +- ...k-Priority-Urgency-System-for-Chunks.patch | 42 +-- .../server/0513-Buffer-joins-to-world.patch | 4 +- .../0514-Optimize-redstone-algorithm.patch | 4 +- ...rty-in-invalid-locations-SPIGOT-6086.patch | 4 +- ...y-Counter-to-allow-plugins-to-use-va.patch | 6 +- patches/server/0529-Entity-isTicking.patch | 6 +- ...ng-a-passenger-in-CreatureSpawnEvent.patch | 4 +- ...-should-not-bypass-cramming-gamerule.patch | 6 +- .../0568-MC-4-Fix-item-position-desync.patch | 4 +- ...n-for-requiring-a-player-participant.patch | 4 +- .../server/0634-Add-worldborder-events.patch | 8 +- ...-block-falling-causing-client-desync.patch | 4 +- ...n-in-sunlight-API-for-Phantoms-and-S.patch | 4 +- ...ttedContainer-instead-of-ReentrantLo.patch | 14 +- .../0705-Fix-dangerous-end-portal-logic.patch | 4 +- 84 files changed, 405 insertions(+), 825 deletions(-) diff --git a/build-data/paper.at b/build-data/paper.at index 2779d00d8c..16a94f7cf6 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -49,7 +49,7 @@ public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V # LivingEntity setkiller public net.minecraft.world.entity.LivingEntity lastHurtByPlayerTime -# SkeletonHore Addittions +# SkeletonHorse Addittions public net.minecraft.world.entity.animal.horse.SkeletonHorse trapTime # Fix client rendering skulls @@ -64,6 +64,7 @@ public net.minecraft.server.level.ServerChunkCache mainThreadProcessor public-f net.minecraft.world.level.chunk.storage.RegionFileStorage public net.minecraft.world.level.chunk.storage.RegionFileStorage getFile(Lnet/minecraft/world/level/ChunkPos;Z)Lnet/minecraft/world/level/chunk/storage/RegionFile; public net.minecraft.world.level.chunk.storage.SectionStorage dirty +public net.minecraft.util.thread.BlockableEventLoop runAllTasks()V # Improve death events public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sounds/SoundEvent; @@ -96,6 +97,7 @@ public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z # Add PlayerConnectionCloseEvent public net.minecraft.server.network.ServerLoginPacketListenerImpl$State +public net.minecraft.server.network.ServerLoginPacketListenerImpl state # Entity Activation Range 2.0 public net.minecraft.world.entity.Entity isInsidePortal @@ -175,9 +177,6 @@ public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.m # Implement Expanded ArmorStand API public net.minecraft.world.entity.decoration.ArmorStand isDisabled(Lnet/minecraft/world/entity/EquipmentSlot;)Z -# Asynchronous chunk IO and loading -public net.minecraft.util.thread.BlockableEventLoop runAllTasks()V - # Chunk debug command public net.minecraft.server.level.ChunkMap entitiesInLevel public net.minecraft.server.level.ServerLevel players @@ -205,3 +204,14 @@ public net.minecraft.commands.arguments.blocks.BlockStateParser id # Villager Restock API public net.minecraft.world.entity.npc.Villager numberOfRestocksToday + +# Mob Pathfinding API +public net.minecraft.world.entity.ai.navigation.PathNavigation pathFinder +public net.minecraft.world.level.pathfinder.PathFinder nodeEvaluator +public net.minecraft.world.level.pathfinder.Path nodes + +# Add more Witch API +public net.minecraft.world.entity.monster.Witch usingTime + +# PlayerDeathEvent#getItemsToKeep +public net.minecraft.world.entity.player.Inventory compartments diff --git a/patches/server/0006-MC-Utils.patch b/patches/server/0006-MC-Utils.patch index fa1809e9ab..9f0bc3af89 100644 --- a/patches/server/0006-MC-Utils.patch +++ b/patches/server/0006-MC-Utils.patch @@ -724,7 +724,7 @@ index 0000000000000000000000000000000000000000..0133ea6feb1ab88f021f66855669f583 +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java new file mode 100644 -index 0000000000000000000000000000000000000000..abe7f2f13ab713bf1cb0343059377ab7e1b48b6e +index 0000000000000000000000000000000000000000..4a21ec2397f57c7c2ac3659f7de96cda9182fea0 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java @@ -0,0 +1,128 @@ @@ -760,7 +760,7 @@ index 0000000000000000000000000000000000000000..abe7f2f13ab713bf1cb0343059377ab7 + } + + public static BlockState getBlockDataFromRaw(final long raw) { -+ return GLOBAL_PALETTE.getObject((int)(raw >>> 32)); ++ return GLOBAL_PALETTE.valueFor((int)(raw >>> 32)); + } + + public static int getIndexFromRaw(final long raw) { @@ -772,7 +772,7 @@ index 0000000000000000000000000000000000000000..abe7f2f13ab713bf1cb0343059377ab7 + } + + public static long getRawFromValues(final int index, final int location, final BlockState data) { -+ return (long)index | ((long)location << 16) | (((long)GLOBAL_PALETTE.getOrCreateIdFor(data)) << 32); ++ return (long)index | ((long)location << 16) | (((long)GLOBAL_PALETTE.idFor(data)) << 32); + } + + public static long setIndexRawValues(final long value, final int index) { @@ -2271,26 +2271,10 @@ index 771e4b72589d7117a154ab6917bd4a56d55f19db..65e0ca442980f273d2fe5f131e174cd9 public static long getEpochMillis() { diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 59240bb0ce088a14f8ccb62de8b69bc7bf313975..cfc2a5145e47de86a5a738d86abf333ff3db7796 100644 +index 59240bb0ce088a14f8ccb62de8b69bc7bf313975..ed52d042f41942ae512148fbba310093358ead68 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -461,6 +461,7 @@ public class BlockPos extends Vec3i { - return super.rotate(rotation).immutable(); - } - -+ @Deprecated public final BlockPos.MutableBlockPos setValues(int i, int j, int k) { return set(i, j, k);} // Paper - OBFHELPER - public BlockPos.MutableBlockPos set(int x, int y, int z) { - this.setX(x); - this.setY(y); -@@ -468,6 +469,7 @@ public class BlockPos extends Vec3i { - return this; - } - -+ @Deprecated public final BlockPos.MutableBlockPos setValues(double d0, double d1, double d2) { return set(d0, d1, d2);} // Paper - OBFHELPER - public BlockPos.MutableBlockPos set(double x, double y, double z) { - return this.set(Mth.floor(x), Mth.floor(y), Mth.floor(z)); - } -@@ -525,6 +527,7 @@ public class BlockPos extends Vec3i { +@@ -525,6 +525,7 @@ public class BlockPos extends Vec3i { } } @@ -2298,7 +2282,7 @@ index 59240bb0ce088a14f8ccb62de8b69bc7bf313975..cfc2a5145e47de86a5a738d86abf333f @Override public BlockPos.MutableBlockPos setX(int i) { super.setX(i); -@@ -542,6 +545,7 @@ public class BlockPos extends Vec3i { +@@ -542,6 +543,7 @@ public class BlockPos extends Vec3i { super.setZ(i); return this; } @@ -2307,7 +2291,7 @@ index 59240bb0ce088a14f8ccb62de8b69bc7bf313975..cfc2a5145e47de86a5a738d86abf333f @Override public BlockPos immutable() { diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index 3d374000cd61d4a29dae21035c5ee9a93a1ff0f9..a16fa7c0effdd192e873eb1afdee79103bb8308e 100644 +index 3d374000cd61d4a29dae21035c5ee9a93a1ff0f9..e59475b7bb3e000afece0033c5d3f112d643c4f2 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java @@ -60,7 +60,7 @@ public class CompoundTag implements Tag { @@ -2319,12 +2303,7 @@ index 3d374000cd61d4a29dae21035c5ee9a93a1ff0f9..a16fa7c0effdd192e873eb1afdee7910 protected CompoundTag(Map entries) { this.tags = entries; -@@ -119,10 +119,15 @@ public class CompoundTag implements Tag { - this.tags.put(key, LongTag.valueOf(value)); - } - -+ @Deprecated public void setUUID(String prefix, UUID uuid) { putUUID(prefix, uuid); } // Paper - OBFHELPER - public void putUUID(String key, UUID value) { +@@ -123,6 +123,10 @@ public class CompoundTag implements Tag { this.tags.put(key, NbtUtils.createUUID(value)); } @@ -2335,18 +2314,6 @@ index 3d374000cd61d4a29dae21035c5ee9a93a1ff0f9..a16fa7c0effdd192e873eb1afdee7910 public UUID getUUID(String key) { return NbtUtils.loadUUID(this.get(key)); } -diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index 0ae24c8080391410756f101a1e40c2eef887c739..3b8207046d38d3d14719ff6761a22e60a93628b7 100644 ---- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java -+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -68,6 +68,7 @@ public class FriendlyByteBuf extends ByteBuf { - this.source = parent; - } - -+ @Deprecated public static int countBytes(int i) { return FriendlyByteBuf.getVarIntSize(i); } // Paper - OBFHELPER - public static int getVarIntSize(int value) { - for (int j = 1; j < 5; ++j) { - if ((value & -1 << j * 7) == 0) { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java index f189a72bd101a99d9350072a06953665fc5d6fee..83e99af925c87433b59f9bed30dfbf4e490c1b84 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java @@ -2877,7 +2844,7 @@ index 75801343b14a5555e974168170af95f8513926f5..1b76d1b929b85b130639e7937a118342 MinecraftServer.LOGGER.info("Saving usercache.json"); this.getProfileCache().save(); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..9a8fc112dd19964c848127a8dd2f100f5db63075 100644 +index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..24f72050229031898fd9da585ad2ceec835f83f9 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -52,9 +52,9 @@ public class ChunkHolder { @@ -2902,7 +2869,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..9a8fc112dd19964c848127a8dd2f100f public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; -@@ -93,14 +95,16 @@ public class ChunkHolder { +@@ -93,10 +95,11 @@ public class ChunkHolder { this.queueLevel = this.oldTicketLevel; this.setTicketLevel(level); this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()]; @@ -2915,23 +2882,16 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..9a8fc112dd19964c848127a8dd2f100f if (!ChunkHolder.getFullChunkStatus(this.oldTicketLevel).isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks return this.getFullChunkUnchecked(); } - -+ @Deprecated public final LevelChunk getFullChunkIfCached() { return this.getFullChunkUnchecked(); } // Paper - OBFHELPER - public LevelChunk getFullChunkUnchecked() { - CompletableFuture> statusFuture = this.getFutureIfPresentUnchecked(ChunkStatus.FULL); - Either either = (Either) statusFuture.getNow(null); -@@ -118,20 +122,22 @@ public class ChunkHolder { +@@ -118,20 +121,20 @@ public class ChunkHolder { return ChunkHolder.getStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE; } - public CompletableFuture> getTickingChunkFuture() { -+ @Deprecated public final CompletableFuture> getTickingFuture() { return this.getTickingChunkFuture(); } // Paper - OBFHELPER + public final CompletableFuture> getTickingChunkFuture() { // Paper - final for inline return this.tickingChunkFuture; } - public CompletableFuture> getEntityTickingChunkFuture() { -+ @Deprecated public final CompletableFuture> getEntityTickingFuture() { return this.getEntityTickingChunkFuture(); } // Paper - OBFHELPER + public final CompletableFuture> getEntityTickingChunkFuture() { // Paper - final for inline return this.entityTickingChunkFuture; } @@ -2947,7 +2907,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..9a8fc112dd19964c848127a8dd2f100f CompletableFuture> completablefuture = this.getTickingChunkFuture(); Either either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error -@@ -170,7 +176,7 @@ public class ChunkHolder { +@@ -170,7 +173,7 @@ public class ChunkHolder { return null; } @@ -2956,7 +2916,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..9a8fc112dd19964c848127a8dd2f100f return this.chunkToSave; } -@@ -328,11 +334,11 @@ public class ChunkHolder { +@@ -328,11 +331,11 @@ public class ChunkHolder { return ChunkHolder.getFullChunkStatus(this.ticketLevel); } @@ -2970,7 +2930,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..9a8fc112dd19964c848127a8dd2f100f return this.ticketLevel; } -@@ -421,14 +427,27 @@ public class ChunkHolder { +@@ -421,14 +424,27 @@ public class ChunkHolder { this.wasAccessibleSinceLastSave |= flag3; if (!flag2 && flag3) { @@ -2998,7 +2958,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..9a8fc112dd19964c848127a8dd2f100f this.updateChunkToSave(((CompletableFuture>) completablefuture).thenApply((either1) -> { // CraftBukkit - decompile error Objects.requireNonNull(chunkStorage); return either1.ifLeft(chunkStorage::packTicks); -@@ -441,11 +460,19 @@ public class ChunkHolder { +@@ -441,11 +457,19 @@ public class ChunkHolder { if (!flag4 && flag5) { this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this); this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING); @@ -3019,7 +2979,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..9a8fc112dd19964c848127a8dd2f100f this.tickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; } -@@ -459,11 +486,18 @@ public class ChunkHolder { +@@ -459,11 +483,18 @@ public class ChunkHolder { this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this.pos); this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING); @@ -3119,7 +3079,7 @@ index a45d5c1156e84ab6e56c95e392fd52ea9ecebcb0..33d17e69fac035c421345e1a8c6eb214 @Override diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index cfe9930490489d506c91d174b5aad199314ffd17..db2bcc20d50f1833347f6edde67c366501d29c0f 100644 +index cfe9930490489d506c91d174b5aad199314ffd17..508adf5df266365992f9ee64f6592465e879deaa 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -45,6 +45,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana @@ -3214,7 +3174,7 @@ index cfe9930490489d506c91d174b5aad199314ffd17..db2bcc20d50f1833347f6edde67c3665 + }); + return; + } -+ this.getChunkFutureAsynchronously(x, z, 31, ChunkHolder::getEntityTickingFuture, onLoad); ++ this.getChunkFutureAsynchronously(x, z, 31, ChunkHolder::getEntityTickingChunkFuture, onLoad); + } + + public void getTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { @@ -3224,7 +3184,7 @@ index cfe9930490489d506c91d174b5aad199314ffd17..db2bcc20d50f1833347f6edde67c3665 + }); + return; + } -+ this.getChunkFutureAsynchronously(x, z, 32, ChunkHolder::getTickingFuture, onLoad); ++ this.getChunkFutureAsynchronously(x, z, 32, ChunkHolder::getTickingChunkFuture, onLoad); + } + + public void getFullChunkAsync(int x, int z, java.util.function.Consumer onLoad) { @@ -3306,7 +3266,7 @@ index cfe9930490489d506c91d174b5aad199314ffd17..db2bcc20d50f1833347f6edde67c3665 + return null; + } + -+ return playerChunk.getFullChunkIfCached(); ++ return playerChunk.getFullChunkUnchecked(); + } + + @Nullable @@ -3514,21 +3474,8 @@ index d31c62b612a5a8016ffbfbb9dc85d9a941c08cf4..fc34cfa8bfb3b82a8e1b28d261f0e901 protected Monster(EntityType type, Level world) { super(type, world); this.xpReward = 5; -diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java -index 6d0b9f8834e86a465cae3fa2af830b797c65a4fb..911cecb3c1d0cd682dcff37636e1fefd979456ae 100644 ---- a/src/main/java/net/minecraft/world/entity/player/Inventory.java -+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java -@@ -44,7 +44,7 @@ public class Inventory implements Container, Nameable { - public final NonNullList items; - public final NonNullList armor; - public final NonNullList offhand; -- private final List> compartments; -+ private final List> compartments; @Deprecated public final List> getComponents() { return compartments; } // Paper - OBFHELPER - public int selected; - public final Player player; - private int timesChanged; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 48902f822ccb6e231201f888a2a92923a946e8cf..680c4eb99b650c8ec7fe50022ba36070feb0a0e5 100644 +index 48902f822ccb6e231201f888a2a92923a946e8cf..280519717d32385a74d6e942a6f42fc12ad8c57e 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -725,6 +725,24 @@ public final class ItemStack { @@ -3556,15 +3503,7 @@ index 48902f822ccb6e231201f888a2a92923a946e8cf..680c4eb99b650c8ec7fe50022ba36070 public void setTag(@Nullable CompoundTag tag) { this.tag = tag; if (this.getItem().canBeDepleted()) { -@@ -1043,6 +1061,7 @@ public final class ItemStack { - return this.tag != null && this.tag.contains("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false; - } - -+ @Deprecated public void getOrCreateTagAndSet(String s, net.minecraft.nbt.Tag nbtbase) { addTagElement(s, nbtbase);} // Paper - OBFHELPER - public void addTagElement(String key, net.minecraft.nbt.Tag tag) { - this.getOrCreateTag().put(key, tag); - } -@@ -1128,6 +1147,7 @@ public final class ItemStack { +@@ -1128,6 +1146,7 @@ public final class ItemStack { // CraftBukkit start @Deprecated public void setItem(Item item) { @@ -3572,18 +3511,6 @@ index 48902f822ccb6e231201f888a2a92923a946e8cf..680c4eb99b650c8ec7fe50022ba36070 this.item = item; } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java b/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java -index 3d9fffa3f07264743b9323557a0b2ac360e01fb9..eca0f3b95b3af4dade992889a5e310a467c2e9fc 100644 ---- a/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java -+++ b/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java -@@ -126,6 +126,7 @@ public class PotionUtils { - return compound == null ? Potions.EMPTY : Potion.byName(compound.getString("Potion")); - } - -+ @Deprecated public static ItemStack addPotionToItemStack(ItemStack itemstack, Potion potionregistry) { return setPotion(itemstack, potionregistry); } // Paper - OBFHELPER - public static ItemStack setPotion(ItemStack stack, Potion potion) { - ResourceLocation resourceLocation = Registry.POTION.getKey(potion); - if (potion == Potions.EMPTY) { diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java index 083122a2e051b23b2cb9bdb8eb70af01af9df400..e85e4a2dfceb0aa40e73b43a5e122a5906cac585 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java @@ -3686,7 +3613,7 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..c7d499bfc22152e0a49f50a2a8133f31 public BlockState getBlockState(BlockPos pos) { return Blocks.AIR.defaultBlockState(); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 90854842fda0f91ac68c70efbcf8ad9e3297ceb4..20fafb95e98ac2e656999ea2208db166d841db9f 100644 +index 90854842fda0f91ac68c70efbcf8ad9e3297ceb4..e9dc71fb74698b2f11220e4eb379f21610899d97 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -84,6 +84,7 @@ import org.bukkit.craftbukkit.CraftServer; @@ -3775,19 +3702,7 @@ index 90854842fda0f91ac68c70efbcf8ad9e3297ceb4..20fafb95e98ac2e656999ea2208db166 return this.setBlock(pos, state, flags, 512); } -@@ -433,8 +468,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - - public void onBlockStateChange(BlockPos pos, BlockState oldBlock, BlockState newBlock) {} - -- @Override -- public boolean removeBlock(BlockPos pos, boolean move) { -+ @Deprecated public boolean setAir(BlockPos blockposition) { return this.removeBlock(blockposition, false); } // Paper - OBFHELPER -+ @Deprecated public boolean setAir(BlockPos blockposition, boolean moved) { return this.removeBlock(blockposition, moved); } // Paper - OBFHELPER -+ @Override public boolean removeBlock(BlockPos pos, boolean move) { // Paper - OBFHELPER - FluidState fluid = this.getFluidState(pos); - - return this.setBlock(pos, fluid.createLegacyBlock(), 3 | (move ? 64 : 0)); -@@ -588,7 +624,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -588,7 +623,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (this.isOutsideBuildHeight(pos)) { return Blocks.VOID_AIR.defaultBlockState(); } else { @@ -3851,7 +3766,7 @@ index 00118cc80ebc31e5fac95c31c07634f0e2904263..138b6792bc6ee26e0b9aaaef7bf58fb2 @Override public BlockEntity getBlockEntity(BlockPos pos) { 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 62417156dd3e7e68e657f322c089fb6f30a11c0e..34d108a3177b31d0094d6d81c180081cc728bcd4 100644 +index 62417156dd3e7e68e657f322c089fb6f30a11c0e..0d0f721fe80c52d92d91843ae9970c5fd55ca143 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -33,6 +33,7 @@ import net.minecraft.core.SectionPos; @@ -3862,15 +3777,6 @@ index 62417156dd3e7e68e657f322c089fb6f30a11c0e..34d108a3177b31d0094d6d81c180081c import net.minecraft.server.level.ServerLevel; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; -@@ -86,7 +87,7 @@ public class LevelChunk implements ChunkAccess { - } - }; - @Nullable -- public static final LevelChunkSection EMPTY_SECTION = null; -+ public static final LevelChunkSection EMPTY_SECTION = null; @Deprecated public static final LevelChunkSection EMPTY_CHUNK_SECTION = EMPTY_SECTION; // Paper - OBFHELPER - private final LevelChunkSection[] sections; - private ChunkBiomeContainer biomes; - private final Map pendingBlockEntities; @@ -107,7 +108,7 @@ public class LevelChunk implements ChunkAccess { private Supplier fullStatus; @Nullable @@ -4099,65 +4005,6 @@ index 62417156dd3e7e68e657f322c089fb6f30a11c0e..34d108a3177b31d0094d6d81c180081c this.setUnsaved(true); } -diff --git a/src/main/java/net/minecraft/world/level/chunk/Palette.java b/src/main/java/net/minecraft/world/level/chunk/Palette.java -index 967cc874eacdb8f589e548b0ee3d60efff72392e..b5c67a9733ef2f738d00174bb4f4251a6c2f24ea 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/Palette.java -+++ b/src/main/java/net/minecraft/world/level/chunk/Palette.java -@@ -6,10 +6,12 @@ import net.minecraft.nbt.ListTag; - import net.minecraft.network.FriendlyByteBuf; - - public interface Palette { -+ @Deprecated default int getOrCreateIdFor(T object) { return this.idFor(object); } // Paper - OBFHELPER - int idFor(T object); - - boolean maybeHas(Predicate predicate); - -+ @Deprecated @Nullable default T getObject(int dataBits) { return this.valueFor(dataBits); } // Paper - OBFHELPER - @Nullable - T valueFor(int index); - -diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 527238373b944a1e4a6e3a408534c72dd4c84035..c874515f1f460bd66baa47c9b8984ef875e735fb 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -20,7 +20,7 @@ public class PalettedContainer implements PaletteResize { - private static final int SIZE = 4096; - public static final int GLOBAL_PALETTE_BITS = 9; - public static final int MIN_PALETTE_SIZE = 4; -- private final Palette globalPalette; -+ private final Palette globalPalette; @Deprecated private final Palette getDataPaletteGlobal() { return this.globalPalette; } // Paper - OBFHELPER - private final PaletteResize dummyPaletteResize = (newSize, added) -> { - return 0; - }; -@@ -28,9 +28,9 @@ public class PalettedContainer implements PaletteResize { - private final Function reader; - private final Function writer; - private final T defaultValue; -- protected BitStorage storage; -- private Palette palette; -- private int bits; -+ protected BitStorage storage; @Deprecated public final BitStorage getDataBits() { return this.storage; } // Paper - OBFHELPER -+ private Palette palette; @Deprecated private Palette getDataPalette() { return this.palette; } // Paper - OBFHELPER -+ private int bits; @Deprecated private int getBitsPerObject() { return this.bits; } // Paper - OBFHELPER - private final Semaphore lock = new Semaphore(1); - @Nullable - private final DebugBuffer> traces = null; -@@ -61,6 +61,7 @@ public class PalettedContainer implements PaletteResize { - return y << 8 | z << 4 | x; - } - -+ @Deprecated private void initialize(int bitsPerObject) { this.setBits(bitsPerObject); } // Paper - OBFHELPER - private void setBits(int size) { - if (size != this.bits) { - this.bits = size; -@@ -159,6 +160,7 @@ public class PalettedContainer implements PaletteResize { - - } - -+ @Deprecated public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // Paper - OBFHELPER - public void write(FriendlyByteBuf buf) { - try { - this.acquire(); diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java index c0b68bd470d245121e14b75e2c97f6616b83c92a..39fe8f64528ad08594aaaa88e5c989c82e4e29d3 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java @@ -4181,43 +4028,6 @@ index c0b68bd470d245121e14b75e2c97f6616b83c92a..39fe8f64528ad08594aaaa88e5c989c8 @Override public BlockState getBlockState(BlockPos pos) { int i = pos.getY(); -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java -index ed4539f25dbd5b1c5c48b70a8d1e9f63fff5d964..79c8315e145befac4cab7d42d006e8f42105b6d9 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java -@@ -26,7 +26,7 @@ public class IOWorker implements AutoCloseable { - private static final Logger LOGGER = LogManager.getLogger(); - private final AtomicBoolean shutdownRequested = new AtomicBoolean(); - private final ProcessorMailbox mailbox; -- private final RegionFileStorage storage; -+ private final RegionFileStorage storage;@Deprecated public RegionFileStorage getRegionFileCache() { return storage; } // Paper - OBFHELPER - private final Map pendingWrites = Maps.newLinkedHashMap(); - - protected IOWorker(File directory, boolean dsync, String name) { -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 1441888430687b9de2a67f21ed426f16d5b30538..289c82bc490201eff896534261e6a2edef2ea8dc 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -121,6 +121,7 @@ public class RegionFile implements AutoCloseable { - return this.externalFileDir.resolve(s); - } - -+ @Deprecated @Nullable public synchronized DataInputStream getReadStream(ChunkPos chunkCoordIntPair) throws IOException { return getChunkDataInputStream(chunkCoordIntPair);} // Paper - OBFHELPER - @Nullable - public synchronized DataInputStream getChunkDataInputStream(ChunkPos pos) throws IOException { - int i = this.getOffset(pos); -diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 5af90e0f7222356cb0e905a9b6e0c4eac5617a41..eaf5b5794061d034cc5e1f80f5acd7f5b6688a30 100644 ---- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -34,6 +34,7 @@ public final class Shapes { - return EMPTY; - } - -+ @Deprecated public static final VoxelShape fullCube() {return block();} // Paper - OBFHELPER - public static VoxelShape block() { - return BLOCK; - } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index 836ee63b7ea73165257acbcdf5c7336a2a2e36f3..2b4a922b84eeb2b1b64e43a2ca8bf16dcf58218e 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java diff --git a/patches/server/0009-Timings-v2.patch b/patches/server/0009-Timings-v2.patch index 8a7ac0d979..709c439fc2 100644 --- a/patches/server/0009-Timings-v2.patch +++ b/patches/server/0009-Timings-v2.patch @@ -767,7 +767,7 @@ index b3a6aeba2363d283f03982cf749f25cfa11a5052..449f1b2f5dca350dc0912e14c8c2bf3e PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1b76d1b929b85b130639e7937a118342b568e795..46bd0b6f8b13c64993ed1deeb8cfa7c105ee3cd9 100644 +index 1b76d1b929b85b130639e7937a118342b568e795..bf26abaf0d3567026da3e95712583b403ef2dff6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -183,7 +183,7 @@ import org.bukkit.craftbukkit.Main; @@ -779,17 +779,6 @@ index 1b76d1b929b85b130639e7937a118342b568e795..46bd0b6f8b13c64993ed1deeb8cfa7c1 import org.spigotmc.SlackActivityAccountant; // Spigot public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements SnooperPopulator, CommandSource, AutoCloseable { -@@ -259,8 +259,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop packet) { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index db2bcc20d50f1833347f6edde67c366501d29c0f..e3abeb839c36b5238ec115329ce05b58e3383a55 100644 +index 508adf5df266365992f9ee64f6592465e879deaa..eeb43a243bfab978e17fd4f2f052029eefdbb090 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -349,13 +349,15 @@ public class ServerChunkCache extends ChunkSource { @@ -1627,7 +1616,7 @@ index 9f68aa235949520b445b368782ccde6b0e26859d..67bc396d880771a135b1b95ffad79952 if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { this.hurt(DamageSource.DROWN, 1.0F); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 20fafb95e98ac2e656999ea2208db166d841db9f..e967d612ffb2e4d2834e2057e9953f82c7a3d50b 100644 +index e9dc71fb74698b2f11220e4eb379f21610899d97..b73b40e8f55a6f9e671878b81ef513b9416c9c8c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -82,7 +82,6 @@ import org.bukkit.Bukkit; @@ -1656,7 +1645,7 @@ index 20fafb95e98ac2e656999ea2208db166d841db9f..e967d612ffb2e4d2834e2057e9953f82 this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } -@@ -721,15 +720,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -720,15 +719,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { timings.tileEntityTick.stopTiming(); // Spigot this.tickingBlockEntities = false; @@ -1765,7 +1754,7 @@ index 92b042080f06fb95958ff5e824830a84f2d1f2a6..7b333e2d6884b272abefbc820bcce802 private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); public CraftPersistentDataContainer persistentDataContainer; 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 34d108a3177b31d0094d6d81c180081cc728bcd4..f8873d76b675e062619d849ffe78376668c8289f 100644 +index 0d0f721fe80c52d92d91843ae9970c5fd55ca143..3e2bc640a06667f0d4f3c2367ac794514a1be35c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -725,6 +725,7 @@ public class LevelChunk implements ChunkAccess { diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index c4f238fb98..ef688869e1 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -966,7 +966,7 @@ index b82b218be1bd849fa280ea1fe0336e279bebfc18..2fb444653118816f1250841cb4c6c486 public static ChatFormatting getById(int colorIndex) { if (colorIndex < 0) { diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index 3b8207046d38d3d14719ff6761a22e60a93628b7..c15860c77c7c24b1946c22f140f1b5c12b052ade 100644 +index 0ae24c8080391410756f101a1e40c2eef887c739..cbc968d0d514f01b26888f3ff8264d8689d9381a 100644 --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java @@ -14,6 +14,7 @@ import io.netty.handler.codec.EncoderException; @@ -985,7 +985,7 @@ index 3b8207046d38d3d14719ff6761a22e60a93628b7..c15860c77c7c24b1946c22f140f1b5c1 public static final short MAX_STRING_LENGTH = 32767; public static final int MAX_COMPONENT_STRING_LENGTH = 262144; -@@ -327,8 +329,15 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -326,8 +328,15 @@ public class FriendlyByteBuf extends ByteBuf { return Component.Serializer.fromJson(this.readUtf(262144)); } @@ -1251,7 +1251,7 @@ index 2b0d989119c9f69a68a6c1c69fb09dbbedd16716..172536147305f283bd14d356ff4f3953 // CraftBukkit end this.chatVisibility = packet.getChatVisibility(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f4f6f3e388a39efd2b076616350c49a0e8e65908..cfe2361b0af12e6333f65487f27b50e2cbc16168 100644 +index 8a77e28c9b12a110c721943aca545270ef8bbaef..8b082713c1bd41ff9d26ce45c949514ae8aec6ef 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -162,6 +162,8 @@ import org.apache.logging.log4j.LogManager; diff --git a/patches/server/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index be41892170..8e8fefb750 100644 --- a/patches/server/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/patches/server/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -31,7 +31,7 @@ index 0b63d81ecbcb56bf3dc25661cc2b219cd8c25592..018792503e5d18470ad17b9f4b4524d5 return this.isInWater() || this.isInRain() || this.isInBubbleColumn(); } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index e91932d25e7b5d4a95e485bfa8b70632e0641b0a..1456dd2ef7ff28701555f4ac4b7645794ccee640 100644 +index e91932d25e7b5d4a95e485bfa8b70632e0641b0a..1dde3e92725883c277f9a8e78cb6a56238af3254 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -103,6 +103,7 @@ public abstract class Mob extends LivingEntity { @@ -49,7 +49,7 @@ index e91932d25e7b5d4a95e485bfa8b70632e0641b0a..1456dd2ef7ff28701555f4ac4b764579 - if (!this.aware) return; // CraftBukkit + if (!this.aware) { // Paper start - Allow nerfed mobs to jump, float and take water damage + if (goalFloat != null) { -+ if (goalFloat.validConditions()) goalFloat.tick(); ++ if (goalFloat.canUse()) goalFloat.tick(); + this.getJumpControl().tick(); + } + if ((this instanceof net.minecraft.world.entity.monster.Blaze || this instanceof net.minecraft.world.entity.monster.EnderMan) && isInWaterRainOrBubble()) { @@ -62,10 +62,10 @@ index e91932d25e7b5d4a95e485bfa8b70632e0641b0a..1456dd2ef7ff28701555f4ac4b764579 this.sensing.tick(); this.level.getProfiler().pop(); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -index 54085b104547f2fe7c08ff8aa4839b1230877bca..730788a1ceba4390d2638e22c6409ab86f6351e6 100644 +index 54085b104547f2fe7c08ff8aa4839b1230877bca..08bb9a723dd11be66bec2e852dc345a22d926bea 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -@@ -9,10 +9,12 @@ public class FloatGoal extends Goal { +@@ -9,6 +9,7 @@ public class FloatGoal extends Goal { public FloatGoal(Mob mob) { this.mob = mob; @@ -73,8 +73,3 @@ index 54085b104547f2fe7c08ff8aa4839b1230877bca..730788a1ceba4390d2638e22c6409ab8 this.setFlags(EnumSet.of(Goal.Flag.JUMP)); mob.getNavigation().setCanFloat(true); } - -+ @Deprecated public final boolean validConditions() { return this.canUse(); } // Paper - OBFHELPER - @Override - public boolean canUse() { - return this.mob.isInWater() && this.mob.getFluidHeight(FluidTags.WATER) > this.mob.getFluidJumpThreshold() || this.mob.isInLava(); diff --git a/patches/server/0021-Player-affects-spawning-API.patch b/patches/server/0021-Player-affects-spawning-API.patch index 8a68681534..d3e3666507 100644 --- a/patches/server/0021-Player-affects-spawning-API.patch +++ b/patches/server/0021-Player-affects-spawning-API.patch @@ -4,18 +4,6 @@ Date: Tue, 1 Mar 2016 14:47:52 -0600 Subject: [PATCH] Player affects spawning API -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 018792503e5d18470ad17b9f4b4524d5dfba31e9..023396b4cb9eeeb345cde43a4d7bdf514575f350 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1498,6 +1498,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - return Mth.sqrt(f * f + f1 * f1 + f2 * f2); - } - -+ @Deprecated public double getDistanceSquared(double x, double y, double z) { return distanceToSqr(x, y, z); } // Paper - OBFHELPER - public double distanceToSqr(double x, double y, double z) { - double d3 = this.getX() - x; - double d4 = this.getY() - y; diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java index 195989667c7d844399a72787819f62a3fd0d9c78..d17b75ad13bbc8a38cdc2f2d77ee5d88438cec31 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java @@ -33,7 +21,7 @@ index 195989667c7d844399a72787819f62a3fd0d9c78..d17b75ad13bbc8a38cdc2f2d77ee5d88 public static Predicate withinDistance(double x, double y, double z, double max) { double d4 = max * max; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 2b34b4680afd2d0c22fbae798fe1efd5df33a14f..18ea26c8e17da03f35c3fd0788a385cc492ff544 100644 +index 26d5b58eb665da53eda30a19300df4c0928c41ef..1039c379b5f39178c568ff9c357a1cf948e0429a 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -766,7 +766,7 @@ public abstract class Mob extends LivingEntity { @@ -86,7 +74,7 @@ index 03bdbb832ff6a86f2dac9c008de45f3bb53aa688..a003e1c0d99a4d4c88269ea5bad250ba public void clientTick(Level world, BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index 389985e022b82c675fb21f363422471bd15b84b0..1a921a7e4ff5a1947559c30116ddb5e0596961e7 100644 +index 389985e022b82c675fb21f363422471bd15b84b0..849616d9ad140285f7aa4d2ffafd6371f3904bd5 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java @@ -71,8 +71,8 @@ public interface EntityGetter { @@ -118,7 +106,7 @@ index 389985e022b82c675fb21f363422471bd15b84b0..1a921a7e4ff5a1947559c30116ddb5e0 + entityhuman = (Player) iterator.next(); + } while (!EntitySelector.affectsSpawning.test(entityhuman)); + -+ d4 = entityhuman.getDistanceSquared(d0, d1, d2); ++ d4 = entityhuman.distanceToSqr(d0, d1, d2); + } while (d3 >= 0.0D && d4 >= d3 * d3); + + return true; diff --git a/patches/server/0025-Entity-Origin-API.patch b/patches/server/0025-Entity-Origin-API.patch index 39ebdd4c30..0a7694168a 100644 --- a/patches/server/0025-Entity-Origin-API.patch +++ b/patches/server/0025-Entity-Origin-API.patch @@ -21,7 +21,7 @@ index 5c5cfc31ced6695af7b1dd06cb867274fa38d85f..d5a12238317f1c85b9ad8cb63b936e50 } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a65646832867e62c758eae3ee1359bdd0d810835..110177551183d1ac33a22b5b8c2c5c39697c220b 100644 +index 018792503e5d18470ad17b9f4b4524d5dfba31e9..5d4d5628e5c0d82301f988691eac363758af6a4b 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -280,6 +280,27 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -52,20 +52,20 @@ index a65646832867e62c758eae3ee1359bdd0d810835..110177551183d1ac33a22b5b8c2c5c39 // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -1813,6 +1834,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1812,6 +1833,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n this.bukkitEntity.storeBukkitValues(nbt); } // CraftBukkit end + // Paper start - Save the entity's origin location + if (this.origin != null) { -+ nbt.setUUID("Paper.OriginWorld", originWorld); ++ nbt.putUUID("Paper.OriginWorld", originWorld); + nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); + } + // Paper end return nbt; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); -@@ -1939,6 +1966,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1938,6 +1965,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } // CraftBukkit end diff --git a/patches/server/0026-Prevent-tile-entity-and-entity-crashes.patch b/patches/server/0026-Prevent-tile-entity-and-entity-crashes.patch index ca201ec1e4..03ccde0b5f 100644 --- a/patches/server/0026-Prevent-tile-entity-and-entity-crashes.patch +++ b/patches/server/0026-Prevent-tile-entity-and-entity-crashes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity and entity crashes diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index d106ab5bbe0647aa2ad285baaabb62b79ced3c06..c427c105c653a0b0de6ad33d1d6f622a31a5a680 100644 +index d29334b5dee6fe3f292f774442304b7dc6b0e2f0..d6ed061e36668ea1cbaee44c06575534336008fc 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -730,11 +730,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -729,11 +729,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { try { tickConsumer.accept(entity); } catch (Throwable throwable) { @@ -26,7 +26,7 @@ index d106ab5bbe0647aa2ad285baaabb62b79ced3c06..c427c105c653a0b0de6ad33d1d6f622a } diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 0e70d9df226e0843a943b3a57d1319ce1bca2543..d6a4a2a59f1be0cc2e373dc326287b60db5559d2 100644 +index 7b333e2d6884b272abefbc820bcce8026a4cdf7e..66ab4deedd177f507d170a61ceca4c3ebbac9adc 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -196,7 +196,12 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { @@ -44,7 +44,7 @@ index 0e70d9df226e0843a943b3a57d1319ce1bca2543..d6a4a2a59f1be0cc2e373dc326287b60 } } 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 ee2df7de72c75e4fbf8a681ff254260554969b66..a6e8a8de17acc6c7c0bdeea01544a334797b69b6 100644 +index 743aafec1f1c819846813688355dd90534dddb3e..21f613b8d7785b996866b5059f3cb1bc87533d2e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -1241,11 +1241,11 @@ public class LevelChunk implements ChunkAccess { diff --git a/patches/server/0041-Disable-spigot-tick-limiters.patch b/patches/server/0041-Disable-spigot-tick-limiters.patch index 82542b3c23..0864065ae0 100644 --- a/patches/server/0041-Disable-spigot-tick-limiters.patch +++ b/patches/server/0041-Disable-spigot-tick-limiters.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable spigot tick limiters diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 794d43e6f1a2019f67daf7a93498225924c4394b..56362678e8de38c541fc851abf783f385a7903bf 100644 +index f599b1e7eb6fddb339294265fe635fa7b3bb5996..da8e6f5b48a83ca4178c0de439200b7952f409d9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -696,9 +696,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -695,9 +695,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Spigot start // Iterator iterator = this.blockEntityTickers.iterator(); int tilesThisCycle = 0; diff --git a/patches/server/0048-Player-Tab-List-and-Title-APIs.patch b/patches/server/0048-Player-Tab-List-and-Title-APIs.patch index 9486bc28a9..4fd67a8592 100644 --- a/patches/server/0048-Player-Tab-List-and-Title-APIs.patch +++ b/patches/server/0048-Player-Tab-List-and-Title-APIs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player Tab List and Title APIs diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index c15860c77c7c24b1946c22f140f1b5c12b052ade..c0966a873ea5e265936e17796bf6bbee62eea9b4 100644 +index cbc968d0d514f01b26888f3ff8264d8689d9381a..e38e53bd39c384bac4d7111e6a2c721744a122f1 100644 --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -333,6 +333,11 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -332,6 +332,11 @@ public class FriendlyByteBuf extends ByteBuf { public FriendlyByteBuf writeComponent(final net.kyori.adventure.text.Component component) { return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144); } @@ -63,7 +63,7 @@ index bd808eb312ade7122973a47f4b96505829511da5..bf0f9cab7c66c089f35b851e799ba4a4 // Paper end buf.writeComponent(this.text); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 184ef22ba2f58f38ac1cc81818fc75eb9fb82a59..dab62713b33cdb7b2324216f7ad229db06e524d6 100644 +index 4d73fa595ffdf04646f53f0e8ef7795d632ca4f2..8b2f018875d64de96abe99b587f113b256889a0e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0050-Add-configurable-portal-search-radius.patch b/patches/server/0050-Add-configurable-portal-search-radius.patch index d740128c2b..8f5c227f91 100644 --- a/patches/server/0050-Add-configurable-portal-search-radius.patch +++ b/patches/server/0050-Add-configurable-portal-search-radius.patch @@ -23,10 +23,10 @@ index 416a6760883cb40367535c7c5acd779742bb8af5..670efbe53241a0ae32d618c83da601cc + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index dbe30ad6a729c5a99f7ff977134738e509dcadad..881e295be6908d0e14147e2d57dd2974aa972725 100644 +index 43ebe01b6b19870cdc130292fe69e6943fc745df..c6f1ca72cd368925051fcfc46c524198c7693d67 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2896,7 +2896,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2895,7 +2895,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n double d4 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType()); BlockPos blockposition = new BlockPos(Mth.clamp(this.getX() * d4, d0, d2), this.getY(), Mth.clamp(this.getZ() * d4, d1, d3)); // CraftBukkit start diff --git a/patches/server/0053-Add-exception-reporting-event.patch b/patches/server/0053-Add-exception-reporting-event.patch index f65aaed3b2..76cc7b5857 100644 --- a/patches/server/0053-Add-exception-reporting-event.patch +++ b/patches/server/0053-Add-exception-reporting-event.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8 + } +} diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 39cfa8211f02acaa0851e0cfc1c2890475d609f4..da97afe93a98daac33f143c6da0b42f71db25dba 100644 +index 3b1565309165e10b147d08b8245ea0bce50dc3c2..4ebb839076a2d1f5e2acc6d5a8dfcf3545b37721 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -825,6 +825,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -61,7 +61,7 @@ index 39cfa8211f02acaa0851e0cfc1c2890475d609f4..da97afe93a98daac33f143c6da0b42f7 } } diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java -index 60a6d35e8467545e211aa1756cd1494f440f1d78..da515ac94aa3c294855f28e6deb9094cc7187dd9 100644 +index 741bc569617c66f90ded58a28dd3ad0e4e8b1e8c..8e27b43e2f6ce4d7f5007fe02db1722e73c30a58 100644 --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java @@ -1,5 +1,6 @@ @@ -108,7 +108,7 @@ index 08c5f6fd1a307c89cf8365f56314a0c6d3e89e4b..26e0f03f2e736ed6ba86e2510a7962de } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 56362678e8de38c541fc851abf783f385a7903bf..a6b1572a82fd22eea5b3d4124c510d94fea5917d 100644 +index da8e6f5b48a83ca4178c0de439200b7952f409d9..969a5ed2484036103834dc23b57b33c11896d72f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -1,5 +1,10 @@ @@ -122,7 +122,7 @@ index 56362678e8de38c541fc851abf783f385a7903bf..a6b1572a82fd22eea5b3d4124c510d94 import com.google.common.collect.Lists; import com.mojang.serialization.Codec; import java.io.IOException; -@@ -730,8 +735,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -729,8 +734,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { tickConsumer.accept(entity); } catch (Throwable throwable) { // Paper start - Prevent tile entity and entity crashes @@ -155,7 +155,7 @@ index b4a7776ba9486bbca42ffb596c8a8bcdf6471ce3..59fae60116167baf989e85596334824e } 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 cbc2a9a3e9943c20cae645fbb18f0aa29415bd63..b36a893ded952d1a5ed1a55eae9c3c406848e1f3 100644 +index 21f613b8d7785b996866b5059f3cb1bc87533d2e..249f39bc0c5820e313cad7813bd1087cb2e09ed6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -1,6 +1,7 @@ @@ -199,10 +199,10 @@ index cbc2a9a3e9943c20cae645fbb18f0aa29415bd63..b36a893ded952d1a5ed1a55eae9c3c40 // Paper end // Spigot start diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 2da42f1bc6922adae32d782aac780a7e0e94e352..659305865e9c6d9996fcf2596d086050508059cd 100644 +index 1441888430687b9de2a67f21ed426f16d5b30538..f514c29e64a9c7a66ff4edd5ba8c2a3dfbba2ad9 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -278,6 +278,7 @@ public class RegionFile implements AutoCloseable { +@@ -277,6 +277,7 @@ public class RegionFile implements AutoCloseable { return true; } } catch (IOException ioexception) { @@ -210,7 +210,7 @@ index 2da42f1bc6922adae32d782aac780a7e0e94e352..659305865e9c6d9996fcf2596d086050 return false; } } -@@ -359,6 +360,7 @@ public class RegionFile implements AutoCloseable { +@@ -358,6 +359,7 @@ public class RegionFile implements AutoCloseable { ((java.nio.Buffer) bytebuffer).position(5); // CraftBukkit - decompile error filechannel.write(bytebuffer); } catch (Throwable throwable) { diff --git a/patches/server/0055-Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/0055-Disable-Scoreboards-for-non-players-by-default.patch index a5d630a39d..e64081170d 100644 --- a/patches/server/0055-Disable-Scoreboards-for-non-players-by-default.patch +++ b/patches/server/0055-Disable-Scoreboards-for-non-players-by-default.patch @@ -25,10 +25,10 @@ index abbbe1786eb68af02f9d39650aad730ac44aac8a..3ac2ac3db9b1c271b3c21930bb137166 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 881e295be6908d0e14147e2d57dd2974aa972725..0d8590368ed35bd95f3b8abcd34eb172ef8ae43b 100644 +index c6f1ca72cd368925051fcfc46c524198c7693d67..4b2240329e86f190d396418cc7c585ee49247602 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2545,6 +2545,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2544,6 +2544,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @Nullable public Team getTeam() { diff --git a/patches/server/0058-Chunk-Save-Reattempt.patch b/patches/server/0058-Chunk-Save-Reattempt.patch index 6b1b711846..2c1044ed37 100644 --- a/patches/server/0058-Chunk-Save-Reattempt.patch +++ b/patches/server/0058-Chunk-Save-Reattempt.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Chunk Save Reattempt We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 659305865e9c6d9996fcf2596d086050508059cd..1a35ef48c487c92f55fcbbfc19a708ededc6a32d 100644 +index f514c29e64a9c7a66ff4edd5ba8c2a3dfbba2ad9..84327c8fe1dc62c7b99950261a344042b4456616 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -278,7 +278,7 @@ public class RegionFile implements AutoCloseable { +@@ -277,7 +277,7 @@ public class RegionFile implements AutoCloseable { return true; } } catch (IOException ioexception) { diff --git a/patches/server/0064-Add-World-Util-Methods.patch b/patches/server/0064-Add-World-Util-Methods.patch index bd14875e7f..e567029cd5 100644 --- a/patches/server/0064-Add-World-Util-Methods.patch +++ b/patches/server/0064-Add-World-Util-Methods.patch @@ -19,7 +19,7 @@ index 9b98eddb8238e36b17989d6f685ddc950151a7f8..b8a816a2f58c1ab51271f027f500d08b } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 76182fd83d6dcd2359dd8d8a75e7e15304dc5d0f..fc7896e22b31f6ca0bb4b249d327f3f3ef52caf6 100644 +index 76182fd83d6dcd2359dd8d8a75e7e15304dc5d0f..9f69dfcb5d9cbbcd01dd2e5e02437967da7a4a17 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -309,11 +309,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -34,7 +34,7 @@ index 76182fd83d6dcd2359dd8d8a75e7e15304dc5d0f..fc7896e22b31f6ca0bb4b249d327f3f3 } + + public final boolean isLoadedAndInBounds(BlockPos blockposition) { // Paper - final for inline -+ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; ++ return getWorldBorder().isWithinBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; + } + + public LevelChunk getChunkIfLoaded(int x, int z) { // Overridden in WorldServer for ABI compat which has final @@ -46,20 +46,8 @@ index 76182fd83d6dcd2359dd8d8a75e7e15304dc5d0f..fc7896e22b31f6ca0bb4b249d327f3f3 + + // reduces need to do isLoaded before getType + public final BlockState getTypeIfLoadedAndInBounds(BlockPos blockposition) { -+ return getWorldBorder().isInBounds(blockposition) ? getTypeIfLoaded(blockposition) : null; ++ return getWorldBorder().isWithinBounds(blockposition) ? getTypeIfLoaded(blockposition) : null; + } // Paper end @Override -diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -index a0c4bc4eb42a3d2de6f66510d88f92c06b535353..5c1a2e88f4f5e78a481b8845b77be9c38aa8497f 100644 ---- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java -+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -@@ -32,6 +32,7 @@ public class WorldBorder { - - public WorldBorder() {} - -+ @Deprecated public final boolean isInBounds(BlockPos blockposition) { return this.isWithinBounds(blockposition); } // Paper - OBFHELPER - public boolean isWithinBounds(BlockPos pos) { - return (double) (pos.getX() + 1) > this.getMinX() && (double) pos.getX() < this.getMaxX() && (double) (pos.getZ() + 1) > this.getMinZ() && (double) pos.getZ() < this.getMaxZ(); - } diff --git a/patches/server/0069-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/patches/server/0069-Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 19013eb221..d5ca410d66 100644 --- a/patches/server/0069-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/patches/server/0069-Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -13,7 +13,7 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index f4b5792e080d5181184eb661d005ce6cab649bf3..35b26f4a4554541affbf76df38fed0f7e555c9b9 100644 +index 964bec1d3fecfe43a43bd9968159fca069f00dfd..e188f130e47ef319477050981de53a7410452592 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java @@ -21,6 +21,15 @@ public class Vec3i implements Comparable { @@ -33,7 +33,7 @@ index f4b5792e080d5181184eb661d005ce6cab649bf3..35b26f4a4554541affbf76df38fed0f7 this.x = x; this.y = y; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index aee97243cc3e73f9e07ba8ed5d6dbe8c73ba016e..fdab998241a682bc3d75094e0893f98886e06266 100644 +index 8592de5a5541fbff8ec85bfce8635a780097c4d4..bbe2d5eab844880f2fde674aa1c78d60d6152231 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -259,7 +259,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -90,7 +90,7 @@ index c1beb6d5fc3cabfeacf0ffbf563e53ff7984c5d3..452b513e8b89d865a396066adaf4feb1 @Override public FluidState getFluidState(BlockPos pos) { 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 b36a893ded952d1a5ed1a55eae9c3c406848e1f3..092f2cd5806e8609b952e7678c0c38b235c52264 100644 +index 249f39bc0c5820e313cad7813bd1087cb2e09ed6..b737ffb8af88e7978c3bfc0b2e61639aca3376c0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -337,12 +337,28 @@ public class LevelChunk implements ChunkAccess { @@ -152,10 +152,10 @@ index 03fd5684aec8fa0d87963f2adcd8244e92840917..5fd66020a937b641e2a060cf38df731a public FluidState getFluidState(int x, int y, int z) { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 4a6781919eb78abc33f549693d88019b42ef6e95..5ea60bbb56450502f1ceb41959239ab579458ac2 100644 +index 527238373b944a1e4a6e3a408534c72dd4c84035..bb8fd88aebb550edec8c679622a02a595cbc6694 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -136,7 +136,7 @@ public class PalettedContainer implements PaletteResize { +@@ -135,7 +135,7 @@ public class PalettedContainer implements PaletteResize { } public T get(int x, int y, int z) { @@ -165,7 +165,7 @@ index 4a6781919eb78abc33f549693d88019b42ef6e95..5ea60bbb56450502f1ceb41959239ab5 protected T get(int index) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 39fe8f64528ad08594aaaa88e5c989c82e4e29d3..da36e6d40ad3e8b7cdbe09ef911d1e5b8c28670f 100644 +index 39fe8f64528ad08594aaaa88e5c989c82e4e29d3..873fea54aecca411b6dee1ed3566f93c4fb9670f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java @@ -104,14 +104,18 @@ public class ProtoChunk implements ChunkAccess { @@ -184,7 +184,7 @@ index 39fe8f64528ad08594aaaa88e5c989c82e4e29d3..da36e6d40ad3e8b7cdbe09ef911d1e5b - LevelChunkSection levelChunkSection = this.getSections()[this.getSectionIndex(i)]; - return LevelChunkSection.isEmpty(levelChunkSection) ? Blocks.AIR.defaultBlockState() : levelChunkSection.getBlockState(pos.getX() & 15, i & 15, pos.getZ() & 15); + LevelChunkSection chunksection = this.getSections()[this.getSectionIndex(y)]; -+ return chunksection == LevelChunk.EMPTY_CHUNK_SECTION || chunksection.isEmpty() ? Blocks.AIR.defaultBlockState() : chunksection.getBlockState(x & 15, y & 15, z & 15); ++ return chunksection == LevelChunk.EMPTY_SECTION || chunksection.isEmpty() ? Blocks.AIR.defaultBlockState() : chunksection.getBlockState(x & 15, y & 15, z & 15); } } + // Paper end diff --git a/patches/server/0070-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/patches/server/0070-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 0895772c6e..fe79c43e63 100644 --- a/patches/server/0070-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/patches/server/0070-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener Saves on some object allocation and processing when no plugin listens to this diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3b4e679cc3c711635e6e2f3906a0afd2142c7849..9e936078b388459bed7da3c6edfd0e65f3b1b1bf 100644 +index 6826d1e4b7f1595f17a118e8f146bb19f3ef9256..e250db8035b2d53e724a47da6dc6118d85ca148b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1363,6 +1363,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return worldserver + " " + worldserver.dimension().location(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 07c9a4438a940e85625e715ceb4e01821dc9cc4b..f97df3dcc1dac794591dceea0fe41bcd0843e2ce 100644 +index 0d6a67fdd83de0c62f6e2a90d0107cbebbac3a37..a846f7136d29bd1d8f8ed30d79fa8936fe386618 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -201,6 +201,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -30,7 +30,7 @@ index 07c9a4438a940e85625e715ceb4e01821dc9cc4b..f97df3dcc1dac794591dceea0fe41bcd @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI return this.chunkSource.getChunk(x, z, false); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index fdab998241a682bc3d75094e0893f98886e06266..81a8e314b5073a5888a3c04d53ff279c8142a7d4 100644 +index bbe2d5eab844880f2fde674aa1c78d60d6152231..285389edd01b1b36dfa8363e7ceea3903229a618 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -470,7 +470,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -42,7 +42,7 @@ index fdab998241a682bc3d75094e0893f98886e06266..81a8e314b5073a5888a3c04d53ff279c BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); this.getCraftServer().getPluginManager().callEvent(event); -@@ -580,7 +580,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -579,7 +579,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { try { // CraftBukkit start CraftWorld world = ((ServerLevel) this).getWorld(); diff --git a/patches/server/0073-EntityPathfindEvent.patch b/patches/server/0073-EntityPathfindEvent.patch index fef0f0b8c0..d97289bfe9 100644 --- a/patches/server/0073-EntityPathfindEvent.patch +++ b/patches/server/0073-EntityPathfindEvent.patch @@ -32,7 +32,7 @@ index d2e71f1e70a8b3360110f7e5e6c5ec278218ae27..0ac90b5fefa9720a9d0130f5438e5ef5 private int getSurfaceY() { diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 92e1c43b0b7d901636b7fee7136e573f440e0179..34ce42afc6e822d209d2facc130b32e76836f40a 100644 +index f4f2b7a1de7eb37c3d6331bd16f916cf4bbf1a03..989a0c44d6685b5824a055d077fb0f28c1ba4b17 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -10,6 +10,7 @@ import net.minecraft.core.BlockPos; @@ -43,15 +43,6 @@ index 92e1c43b0b7d901636b7fee7136e573f440e0179..34ce42afc6e822d209d2facc130b32e7 import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; -@@ -26,7 +27,7 @@ import net.minecraft.world.phys.Vec3; - - public abstract class PathNavigation { - private static final int MAX_TIME_RECOMPUTE = 20; -- protected final Mob mob; -+ protected final Mob mob; @Deprecated public Entity getEntity() { return mob; } // Paper - OBFHELPER - protected final Level level; - @Nullable - protected Path path; @@ -108,7 +109,12 @@ public abstract class PathNavigation { @Nullable @@ -99,8 +90,8 @@ index 92e1c43b0b7d901636b7fee7136e573f440e0179..34ce42afc6e822d209d2facc130b32e7 + // Paper start - Pathfind event + boolean copiedSet = false; + for (BlockPos possibleTarget : positions) { -+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), -+ MCUtil.toLocation(getEntity().level, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) { ++ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(), ++ MCUtil.toLocation(this.mob.level, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) { + if (!copiedSet) { + copiedSet = true; + positions = new java.util.HashSet<>(positions); diff --git a/patches/server/0075-Do-not-load-chunks-for-Pathfinding.patch b/patches/server/0075-Do-not-load-chunks-for-Pathfinding.patch index e363fcce7f..b00c5e68b8 100644 --- a/patches/server/0075-Do-not-load-chunks-for-Pathfinding.patch +++ b/patches/server/0075-Do-not-load-chunks-for-Pathfinding.patch @@ -4,32 +4,6 @@ Date: Thu, 31 Mar 2016 19:17:58 -0400 Subject: [PATCH] Do not load chunks for Pathfinding -diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 34ce42afc6e822d209d2facc130b32e76836f40a..8b3513e4e2881bc4ba59e50fda399ecb88540323 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -46,7 +46,7 @@ public abstract class PathNavigation { - private BlockPos targetPos; - private int reachRange; - private float maxVisitedNodesMultiplier = 1.0F; -- private final PathFinder pathFinder; -+ private final PathFinder pathFinder; @Deprecated public PathFinder getPathfinder() { return this.pathFinder; } // Paper - OBFHELPER - private boolean isStuck; - - public PathNavigation(Mob mob, Level world) { -diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index e855754bdb8431efc06c77b42d9a90b870abab8d..a9048cabf88b1309cc6dc90a9ba928564cbc18cf 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -21,7 +21,7 @@ public class PathFinder { - private static final float FUDGING = 1.5F; - private final Node[] neighbors = new Node[32]; - private final int maxVisitedNodes; -- private final NodeEvaluator nodeEvaluator; -+ private final NodeEvaluator nodeEvaluator; @Deprecated public NodeEvaluator getPathfinder() { return this.nodeEvaluator; } // Paper - OBFHELPER - private static final boolean DEBUG = false; - private final BinaryHeap openSet = new BinaryHeap(); - diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java index 204ed5665adf2df7252fe2d21872db6956415311..b37acb6e6e253529a38f44a518a02c7747d3145e 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java diff --git a/patches/server/0079-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/patches/server/0079-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 93acbbfe0a..2234667343 100644 --- a/patches/server/0079-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/patches/server/0079-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 81a8e314b5073a5888a3c04d53ff279c8142a7d4..fa567322ca3f09d81479826b0119ddc922c41d11 100644 +index 285389edd01b1b36dfa8363e7ceea3903229a618..ce86590b4060d9705831303ab23f0294129760b9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -538,6 +538,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -537,6 +537,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void setBlocksDirty(BlockPos pos, BlockState old, BlockState updated) {} public void updateNeighborsAt(BlockPos pos, Block block) { diff --git a/patches/server/0091-LootTable-API-Replenishable-Lootables-Feature.patch b/patches/server/0091-LootTable-API-Replenishable-Lootables-Feature.patch index 36d72f4cd7..fdd9b0a4c2 100644 --- a/patches/server/0091-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/patches/server/0091-LootTable-API-Replenishable-Lootables-Feature.patch @@ -192,7 +192,7 @@ index 0000000000000000000000000000000000000000..16b3527d7bc782c47e6f6c3ecd7165bd +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java new file mode 100644 -index 0000000000000000000000000000000000000000..115a6fad53655f356866032054db36777a791b4e +index 0000000000000000000000000000000000000000..20cfe7b9b7127ddeb97aa91d759fc17b4a548eaf --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java @@ -0,0 +1,179 @@ @@ -342,7 +342,7 @@ index 0000000000000000000000000000000000000000..115a6fad53655f356866032054db3677 + ListTag list = new ListTag(); + for (Map.Entry entry : this.lootedPlayers.entrySet()) { + CompoundTag cmp = new CompoundTag(); -+ cmp.setUUID("UUID", entry.getKey()); ++ cmp.putUUID("UUID", entry.getKey()); + cmp.putLong("Time", entry.getValue()); + list.add(cmp); + } @@ -515,7 +515,7 @@ index 0000000000000000000000000000000000000000..3377b86c337d0234bbb9b0349e4034a7 + } +} diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a5fa826f895fc8660521496ad1e9de5c55ffbdaa..c0ea34cacbc1b042f79b441f57a11fa646a5c872 100644 +index 4888c77c3bc415bc69d4aaf89899da7dcc81f402..27a6caea54ddd9efe3fc8da19877bee7fa7f4e3e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -168,6 +168,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0116-Prevent-Pathfinding-out-of-World-Border.patch b/patches/server/0116-Prevent-Pathfinding-out-of-World-Border.patch index 05d9a4a7be..cf8dfcf258 100644 --- a/patches/server/0116-Prevent-Pathfinding-out-of-World-Border.patch +++ b/patches/server/0116-Prevent-Pathfinding-out-of-World-Border.patch @@ -13,15 +13,15 @@ by adding code to all overrides in: to return BLOCKED if it is outside the world border. diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 6c063351c76e92a8a91142a12db846d1c1f11921..8212aab2884c2a894bc981850e483ce31814c708 100644 +index 989a0c44d6685b5824a055d077fb0f28c1ba4b17..98953769a4418385971651e43e2ff6f4ea1ec638 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -156,7 +156,7 @@ public abstract class PathNavigation { // Paper start - Pathfind event boolean copiedSet = false; for (BlockPos possibleTarget : positions) { -- if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), -+ if (!getEntity().getCommandSenderWorld().getWorldBorder().isInBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), // Paper - don't path out of world border - MCUtil.toLocation(getEntity().level, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) { +- if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(), ++ if (!this.mob.getCommandSenderWorld().getWorldBorder().isWithinBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(), // Paper - don't path out of world border + MCUtil.toLocation(this.mob.level, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) { if (!copiedSet) { copiedSet = true; diff --git a/patches/server/0117-Optimize-World.isLoaded-BlockPosition-Z.patch b/patches/server/0117-Optimize-World.isLoaded-BlockPosition-Z.patch index 7b2c7441b8..c7b7b83a1d 100644 --- a/patches/server/0117-Optimize-World.isLoaded-BlockPosition-Z.patch +++ b/patches/server/0117-Optimize-World.isLoaded-BlockPosition-Z.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e26cb05a91cf2b3ac059dcb55bc52f1e4f30b362..52d80086deff664fcfd8952b7cabbfa1f48ad131 100644 +index 69f74f6e9750b34e735c8fe68a90a3f1e0eed2fb..c85caffd2dcb47d127b508791f78aea8f3657c8d 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -316,6 +316,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -19,5 +19,5 @@ index e26cb05a91cf2b3ac059dcb55bc52f1e4f30b362..52d80086deff664fcfd8952b7cabbfa1 + } + public final boolean isLoadedAndInBounds(BlockPos blockposition) { // Paper - final for inline - return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; + return getWorldBorder().isWithinBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; } diff --git a/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch b/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch index 635c6e9001..d9bdb0eaf0 100644 --- a/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch +++ b/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch @@ -11,22 +11,22 @@ that is outside happens to be closer, but unreachable, yet another reachable one is in border that would of been missed. diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -index 02b10be4878b871742efb0f65980d9672f32b388..4a61153eaf9cf4c8aa532f770c0e449325448107 100644 +index a0c4bc4eb42a3d2de6f66510d88f92c06b535353..c2c54dc4bbfe469f2b8c751012b93d5e728936d6 100644 --- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java +++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -@@ -37,6 +37,18 @@ public class WorldBorder { +@@ -36,6 +36,18 @@ public class WorldBorder { return (double) (pos.getX() + 1) > this.getMinX() && (double) pos.getX() < this.getMaxX() && (double) (pos.getZ() + 1) > this.getMinZ() && (double) pos.getZ() < this.getMaxZ(); } + // Paper start + private final BlockPos.MutableBlockPos mutPos = new BlockPos.MutableBlockPos(); + public boolean isBlockInBounds(int chunkX, int chunkZ) { -+ this.mutPos.setValues(chunkX, 64, chunkZ); -+ return this.isInBounds(this.mutPos); ++ this.mutPos.set(chunkX, 64, chunkZ); ++ return this.isWithinBounds(this.mutPos); + } + public boolean isChunkInBounds(int chunkX, int chunkZ) { -+ this.mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15); -+ return this.isInBounds(this.mutPos); ++ this.mutPos.set(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15); ++ return this.isWithinBounds(this.mutPos); + } + // Paper end + diff --git a/patches/server/0124-Firework-API-s.patch b/patches/server/0124-Firework-API-s.patch index 0206ec70a0..38e7294cc8 100644 --- a/patches/server/0124-Firework-API-s.patch +++ b/patches/server/0124-Firework-API-s.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Firework API's diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index 28e32cdac5b8c51dfcef14b585860f3181e814f3..5bfebe072ec722e7d6f3161d5d6cc709a9b80032 100644 +index 28e32cdac5b8c51dfcef14b585860f3181e814f3..3ac0d0419cbdacabf647a530a82ddf67ddaa13b7 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -39,6 +39,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { @@ -22,7 +22,7 @@ index 28e32cdac5b8c51dfcef14b585860f3181e814f3..5bfebe072ec722e7d6f3161d5d6cc709 nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE)); + // Paper start + if (this.spawningEntity != null) { -+ nbt.setUUID("SpawningEntity", this.spawningEntity); ++ nbt.putUUID("SpawningEntity", this.spawningEntity); + } + // Paper end } diff --git a/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch b/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch index 29f31ca4b4..dca1f515d0 100644 --- a/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch +++ b/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3cc6b1afe465ca57df2f22d4d735a95439174e30..7f080d8aac9198dd935a8af090ee82f618551203 100644 +index 27a6caea54ddd9efe3fc8da19877bee7fa7f4e3e..c9bb5427d68b1a4717e3f8bf584c40820ef0a4f0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2240,6 +2240,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2239,6 +2239,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } protected boolean addPassenger(Entity entity) { // CraftBukkit diff --git a/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 8683fcbace..ee173face4 100644 --- a/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/0129-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -21,7 +21,7 @@ index f772924217c0531b09662a145d8ee5d22dd5ca51..ecfb88b4d9727ad20a2c33475cc6b1ec return true; diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 4000480a14d2ba52149f4fa47f824abfa2e0e5f8..cb0194d688ae176e0fba6c48cf59a51ceb1a5c4e 100644 +index 4000480a14d2ba52149f4fa47f824abfa2e0e5f8..ea01f84448693ca740b5f3381a9c500e5aa3914e 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java @@ -38,13 +38,63 @@ public class ExperienceOrb extends Entity { @@ -56,10 +56,10 @@ index 4000480a14d2ba52149f4fa47f824abfa2e0e5f8..cb0194d688ae176e0fba6c48cf59a51c + private void savePaperNBT(CompoundTag nbttagcompound) { + CompoundTag comp = new CompoundTag(); + if (this.sourceEntityId != null) { -+ comp.setUUID("source", this.sourceEntityId); ++ comp.putUUID("source", this.sourceEntityId); + } + if (this.triggerEntityId != null) { -+ comp.setUUID("trigger", triggerEntityId); ++ comp.putUUID("trigger", triggerEntityId); + } + if (this.spawnReason != null && this.spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) { + comp.putString("reason", this.spawnReason.name()); @@ -204,7 +204,7 @@ index 9d5b78880ea9d7efb8a6c5ffa26122e08b45f494..401a105a161c23a8d3fe45d0a7c84507 if (this.dragonFight != null) { diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index f7b3b11bd6b395d199e725bc0c0192c28cc3cd86..98085ea2b5baf99697f2992354918e15691c888f 100644 +index a8820e811be1adecf864541400dc6907d3c2f0bb..32132911f3431c7d1390edbc69bf4b98e123a713 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -616,7 +616,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -255,19 +255,6 @@ index 467f9814e0991d31bff7259f266262c81328f05f..11d1db5ef709dfb6fa596ebc4f5fff14 this.discard(); } -diff --git a/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java b/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java -index d486b8d7d80bc79c5af6106de56a3ba49021258e..97c76e7a6b3be6422d15744ce299deba48b1de02 100644 ---- a/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java -+++ b/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java -@@ -8,7 +8,7 @@ import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; - - public class FurnaceResultSlot extends Slot { - -- private final Player player; -+ private final Player player; @Deprecated public final Player getPlayer() { return this.player; } // Paper OBFHELPER - private int removeCount; - - public FurnaceResultSlot(Player player, Container inventory, int index, int x, int y) { diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java index 473e17d87637cd1a85880e2956f83de0b510b488..34574f3945d2a7b4ab6a71adb2408b9811a3cb0d 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java diff --git a/patches/server/0143-Basic-PlayerProfile-API.patch b/patches/server/0143-Basic-PlayerProfile-API.patch index 06f1a60c32..35a96feb58 100644 --- a/patches/server/0143-Basic-PlayerProfile-API.patch +++ b/patches/server/0143-Basic-PlayerProfile-API.patch @@ -474,18 +474,10 @@ index c8385460701395cb5c65fba41335469ffb2d9b9a..fb0b3c5770f66cc3590f5ac4e690a33c GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); GameProfileCache usercache = new GameProfileCache(gameprofilerepository, new File(file, MinecraftServer.USERID_CACHE_FILE.getName())); diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 3eb4bee81a8543cc06b9d5898f5f6c0e9dbbf554..8ea7d9a2070074a45d3276b8d2abac6285edbbdb 100644 +index 3eb4bee81a8543cc06b9d5898f5f6c0e9dbbf554..9a428e166561b4bc028732ec563d3b2e99f81a8e 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -118,6 +118,7 @@ public class GameProfileCache { - return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper - } - -+ @Deprecated public void saveProfile(GameProfile gameprofile) { add(gameprofile); } // Paper - OBFHELPER - public synchronized void add(GameProfile profile) { // Paper - synchronize - Calendar calendar = Calendar.getInstance(); - -@@ -190,6 +191,13 @@ public class GameProfileCache { +@@ -190,6 +190,13 @@ public class GameProfileCache { } } diff --git a/patches/server/0147-Entity-fromMobSpawner.patch b/patches/server/0147-Entity-fromMobSpawner.patch index 0a6a6fee72..09af43f113 100644 --- a/patches/server/0147-Entity-fromMobSpawner.patch +++ b/patches/server/0147-Entity-fromMobSpawner.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f858da07ca3d49ad338a4e77c986ddd5494d74f0..f3b5df4e693d923796929b79f9a43bfa4cbe03e7 100644 +index 267ecf9c5a6c9e696cb2a5c8be13bbc4ab14cd41..a6c26bd5a23799659db03fc2db55009391936f2a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -321,6 +321,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -16,8 +16,8 @@ index f858da07ca3d49ad338a4e77c986ddd5494d74f0..f3b5df4e693d923796929b79f9a43bfa protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1860,6 +1861,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - nbt.setUUID("Paper.OriginWorld", originWorld); +@@ -1859,6 +1860,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + nbt.putUUID("Paper.OriginWorld", originWorld); nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } + // Save entity's from mob spawner status @@ -27,7 +27,7 @@ index f858da07ca3d49ad338a4e77c986ddd5494d74f0..f3b5df4e693d923796929b79f9a43bfa // Paper end return nbt; } catch (Throwable throwable) { -@@ -1997,6 +2002,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1996,6 +2001,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n this.originWorld = originWorld; origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2)); } diff --git a/patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch index 87eae68d19..fc6d8ee42c 100644 --- a/patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/patches/server/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index a86b5272c0ac4dd64f796f7fd025c7a34a5d2f8d..f8554943783754618bc04cbbe7df61cebfc98b80 100644 +index 5b88064b42012f7480adcc9e77da7017347db5af..30347baabcace53bcad0b6ffddab9f1debf03ed5 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -724,6 +724,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -723,6 +723,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Spigot start // Iterator iterator = this.blockEntityTickers.iterator(); int tilesThisCycle = 0; @@ -17,7 +17,7 @@ index a86b5272c0ac4dd64f796f7fd025c7a34a5d2f8d..f8554943783754618bc04cbbe7df61ce for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(tileTickPosition); -@@ -731,7 +733,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -730,7 +732,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (tickingblockentity == null) { this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash"); tilesThisCycle--; @@ -25,7 +25,7 @@ index a86b5272c0ac4dd64f796f7fd025c7a34a5d2f8d..f8554943783754618bc04cbbe7df61ce continue; } // Spigot end -@@ -739,12 +740,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -738,12 +739,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (tickingblockentity.isRemoved()) { // Spigot start tilesThisCycle--; diff --git a/patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch b/patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch index 9c171ddcf5..c4b31f7212 100644 --- a/patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch +++ b/patches/server/0167-use-CB-BlockState-implementations-for-captured-block.patch @@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index f8554943783754618bc04cbbe7df61cebfc98b80..4e7644f875b8ed10cb402e5e1c8b71b4842e0e40 100644 +index 30347baabcace53bcad0b6ffddab9f1debf03ed5..08f612b7d2e861ef7e8b91e622c7a278542809f0 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -140,7 +140,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -49,7 +49,7 @@ index f8554943783754618bc04cbbe7df61cebfc98b80..4e7644f875b8ed10cb402e5e1c8b71b4 this.capturedBlockStates.put(pos.immutable(), blockstate); captured = true; } -@@ -644,7 +645,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -643,7 +644,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public BlockState getBlockState(BlockPos pos) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { diff --git a/patches/server/0225-add-more-information-to-Entity.toString.patch b/patches/server/0225-add-more-information-to-Entity.toString.patch index 899bad1dc0..fbb730edb0 100644 --- a/patches/server/0225-add-more-information-to-Entity.toString.patch +++ b/patches/server/0225-add-more-information-to-Entity.toString.patch @@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString() UUID, ticks lived, valid, dead diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f3b5df4e693d923796929b79f9a43bfa4cbe03e7..a6ba0c7fe05aae72b98072aaa008a1346bf2704e 100644 +index a6c26bd5a23799659db03fc2db55009391936f2a..8880ff82691bef78b85d226d133d216f80fff832 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2805,7 +2805,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2804,7 +2804,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } public String toString() { diff --git a/patches/server/0232-Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/patches/server/0232-Option-to-prevent-armor-stands-from-doing-entity-loo.patch index 801e720667..c6ce092ea4 100644 --- a/patches/server/0232-Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/patches/server/0232-Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -31,10 +31,10 @@ index 6d717d3852afb3a3a4bef30c68980c402bdfefff..b47b1215e685c453c3496439bb350a91 for (int i = 0; i < list.size(); ++i) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 4e7644f875b8ed10cb402e5e1c8b71b4842e0e40..2d13cbfb5e4ea359106fc008f203b104a179b9c0 100644 +index 08f612b7d2e861ef7e8b91e622c7a278542809f0..00e5672f4d302d5ccfe3942e61fe0c0beb782b82 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -769,6 +769,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -768,6 +768,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Paper end } } diff --git a/patches/server/0235-SkeletonHorse-Additions.patch b/patches/server/0235-SkeletonHorse-Additions.patch index 5cff96f9d1..764fb5eb4c 100644 --- a/patches/server/0235-SkeletonHorse-Additions.patch +++ b/patches/server/0235-SkeletonHorse-Additions.patch @@ -32,7 +32,7 @@ index 67afaab789041f49407233ca8a856a3b0131fcf6..1b874f8a72f5b1ac64dd66621b039295 this.horse.setTrap(false); diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index 1a921a7e4ff5a1947559c30116ddb5e0596961e7..35430db8efc0b5697921f8ef188c61beb628d535 100644 +index 849616d9ad140285f7aa4d2ffafd6371f3904bd5..325e244c46ec208a2e7e18d71ccbbfcc25fc1bce 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java @@ -89,6 +89,28 @@ public interface EntityGetter { @@ -49,7 +49,7 @@ index 1a921a7e4ff5a1947559c30116ddb5e0596961e7..35430db8efc0b5697921f8ef188c61be + + for (Player human : this.players()) { + if (predicate == null || predicate.test(human)) { -+ double distanceSquared = human.getDistanceSquared(x, y, z); ++ double distanceSquared = human.distanceToSqr(x, y, z); + + if (radius < 0.0D || distanceSquared < radius * radius) { + builder.add(human.getBukkitEntity()); diff --git a/patches/server/0240-Add-TNTPrimeEvent.patch b/patches/server/0240-Add-TNTPrimeEvent.patch index ce6d033997..547b686170 100644 --- a/patches/server/0240-Add-TNTPrimeEvent.patch +++ b/patches/server/0240-Add-TNTPrimeEvent.patch @@ -21,7 +21,7 @@ index 401a105a161c23a8d3fe45d0a7c845072afb8bd9..c98202092752a9015aaf95bd1471135b this.level.removeBlock(blockposition, false); diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java -index dd19c31360891245dbe465cf94a9f456cf71e23d..ad0b485dbc77717f16191d6950a2e91faaede94a 100644 +index dd19c31360891245dbe465cf94a9f456cf71e23d..becf80cdbbeb6327958758779cc42ea894127988 100644 --- a/src/main/java/net/minecraft/world/level/block/FireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java @@ -290,7 +290,7 @@ public class FireBlock extends BaseFireBlock { @@ -42,7 +42,7 @@ index dd19c31360891245dbe465cf94a9f456cf71e23d..ad0b485dbc77717f16191d6950a2e91f + if (!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.FIRE, null).callEvent()) { + return; + } -+ world.setAir(blockposition, false); ++ world.removeBlock(blockposition, false); + // Paper end TntBlock.explode(world, blockposition); } diff --git a/patches/server/0243-Fix-client-rendering-skulls-from-same-user.patch b/patches/server/0243-Fix-client-rendering-skulls-from-same-user.patch index f0e8883c79..760f7cabf8 100644 --- a/patches/server/0243-Fix-client-rendering-skulls-from-same-user.patch +++ b/patches/server/0243-Fix-client-rendering-skulls-from-same-user.patch @@ -12,10 +12,10 @@ This allows the client to render multiple skull textures from the same user, for when different skins were used when skull was made. diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index c0966a873ea5e265936e17796bf6bbee62eea9b4..813814a09ad4c8040d9bf7fff12c8c7b88f164c2 100644 +index e38e53bd39c384bac4d7111e6a2c721744a122f1..70fb9001b12b105fbf471bd0127d8414e03f9329 100644 --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -473,9 +473,18 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -472,9 +472,18 @@ public class FriendlyByteBuf extends ByteBuf { if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) { // Spigot start - filter stack = stack.copy(); @@ -27,7 +27,7 @@ index c0966a873ea5e265936e17796bf6bbee62eea9b4..813814a09ad4c8040d9bf7fff12c8c7b + if (nbttagcompound != null && nbttagcompound.contains("SkullOwner", 10)) { + CompoundTag owner = nbttagcompound.getCompound("SkullOwner"); + if (owner.hasUUID("Id")) { -+ nbttagcompound.setUUID("SkullOwnerOrig", owner.getUUID("Id")); ++ nbttagcompound.putUUID("SkullOwnerOrig", owner.getUUID("Id")); + net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeUUID(owner); + } + } @@ -35,7 +35,7 @@ index c0966a873ea5e265936e17796bf6bbee62eea9b4..813814a09ad4c8040d9bf7fff12c8c7b } this.writeNbt(nbttagcompound); -@@ -495,7 +504,16 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -494,7 +503,16 @@ public class FriendlyByteBuf extends ByteBuf { itemstack.setTag(this.readNbt()); // CraftBukkit start if (itemstack.getTag() != null) { @@ -66,7 +66,7 @@ index 3bdb09ab00ec05ed532a0c26b9fd321e1f05c1a0..1451a98d69b185dd15a2d1d7681bcecb } diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -index eaf586eb386e13e954bc593f6ddbc45929cec204..f0192a009f6a21d1781ce709624a9187048d9a08 100644 +index eaf586eb386e13e954bc593f6ddbc45929cec204..172413fc0f303d5e15bc2bc55c09ce4faf5298a0 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java @@ -10,6 +10,7 @@ import java.util.function.Consumer; @@ -105,11 +105,11 @@ index eaf586eb386e13e954bc593f6ddbc45929cec204..f0192a009f6a21d1781ce709624a9187 + String textures = ((CompoundTag)list.get(0)).getString("Value"); + if (textures != null && textures.length() > 3) { + UUID uuid = UUID.nameUUIDFromBytes(textures.getBytes()); -+ owner.setUUID("Id", uuid); ++ owner.putUUID("Id", uuid); + return; + } + } -+ owner.setUUID("Id", UUID.randomUUID()); ++ owner.putUUID("Id", UUID.randomUUID()); + } + // Paper end + diff --git a/patches/server/0256-Add-PhantomPreSpawnEvent.patch b/patches/server/0256-Add-PhantomPreSpawnEvent.patch index 4e4c442d51..417305d74a 100644 --- a/patches/server/0256-Add-PhantomPreSpawnEvent.patch +++ b/patches/server/0256-Add-PhantomPreSpawnEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PhantomPreSpawnEvent diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index 5df9ad398ba173bb0ff4770673f8eb5967325c5a..d2a3927a263c445e647a4bbc5fe12addaf290c0e 100644 +index 5df9ad398ba173bb0ff4770673f8eb5967325c5a..877095c93e944293dfb52471eda59a24fad2dbc9 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -172,6 +172,11 @@ public class Phantom extends FlyingMob implements Enemy { @@ -26,7 +26,7 @@ index 5df9ad398ba173bb0ff4770673f8eb5967325c5a..d2a3927a263c445e647a4bbc5fe12add nbt.putInt("Size", this.getPhantomSize()); + // Paper start + if (this.spawningEntity != null) { -+ nbt.setUUID("Paper.SpawningEntity", this.spawningEntity); ++ nbt.putUUID("Paper.SpawningEntity", this.spawningEntity); + } + // Paper end } diff --git a/patches/server/0260-Asynchronous-chunk-IO-and-loading.patch b/patches/server/0260-Asynchronous-chunk-IO-and-loading.patch index 7e693901d7..8e79b12657 100644 --- a/patches/server/0260-Asynchronous-chunk-IO-and-loading.patch +++ b/patches/server/0260-Asynchronous-chunk-IO-and-loading.patch @@ -2299,7 +2299,7 @@ index fb0b3c5770f66cc3590f5ac4e690a33cb6179be3..7ce854edba32ffcafaa5268d4bb2822a DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataFixers.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, LoggerChunkProgressListener::new); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9f7e89ccd716edac22d3bee907c39eedbffb05b5..8750199325adf72da10bf292bf56f75bafe10726 100644 +index a7244e66b7bbf2b474304ab41ad31a606ab6ba9c..bd892f477a04172aaae3925d81cb30cda74abfdc 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -976,7 +976,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop getPoints() { + List points = new ArrayList<>(); -+ for (Node point : path.getPoints()) { ++ for (Node point : path.nodes) { + points.add(toLoc(point)); + } + return points; @@ -133,7 +133,7 @@ index 0000000000000000000000000000000000000000..92d1bb8b9cdb9eb0c04574c0b6ba5acd + + @Override + public int getNextPointIndex() { -+ return path.getNextIndex(); ++ return path.getNextNodeIndex(); + } + + @Nullable @@ -142,135 +142,26 @@ index 0000000000000000000000000000000000000000..92d1bb8b9cdb9eb0c04574c0b6ba5acd + if (!path.hasNext()) { + return null; + } -+ return toLoc(path.getPoints().get(path.getNextIndex())); ++ return toLoc(path.nodes.get(path.getNextNodeIndex())); + } + } + + private Location toLoc(Node point) { -+ return new Location(entity.level.getWorld(), point.getX(), point.getY(), point.getZ()); ++ return new Location(entity.level.getWorld(), point.x, point.y, point.z); + } +} -diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 83243e1d35829a384f8680b18e96d82e630310ed..289494db53d368d56f1abd34abad8ce57e4694b1 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -93,7 +93,7 @@ public abstract class PathNavigation { - } - - @Nullable -- public final Path createPath(double x, double y, double z, int distance) { -+ @Deprecated public final Path calculateDestination(double d0, double d1, double d2) { return createPath(d0, d1, d2, 0); } public final Path createPath(double x, double y, double z, int distance) { // Paper - OBFHELPER - return this.createPath(new BlockPos(x, y, z), distance); - } - -@@ -123,7 +123,7 @@ public abstract class PathNavigation { - } - - @Nullable -- public Path createPath(Entity entity, int distance) { -+ public final Path calculateDestination(Entity entity) { return createPath(entity, 0); } public Path createPath(Entity entity, int distance) { - return this.createPath(ImmutableSet.of(entity.blockPosition()), entity, 16, true, distance); // Paper - } - -@@ -195,6 +195,7 @@ public abstract class PathNavigation { - return path != null && this.moveTo(path, speed); - } - -+ @Deprecated public boolean setDestination(@Nullable Path pathentity, double speed) { return moveTo(pathentity, speed); } // Paper - OBFHELPER - public boolean moveTo(@Nullable Path path, double speed) { - if (path == null) { - this.path = null; -@@ -221,7 +222,7 @@ public abstract class PathNavigation { - } - } - -- @Nullable -+ @Deprecated @Nullable public Path getPathEntity() { return getPath(); } @Nullable // Paper - OBFHELPER - public Path getPath() { - return this.path; - } -@@ -335,6 +336,7 @@ public abstract class PathNavigation { - return !this.isDone(); - } - -+ @Deprecated public void stopPathfinding() { stop(); } // Paper - OBFHELPER - public void stop() { - this.path = null; - } -diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Node.java b/src/main/java/net/minecraft/world/level/pathfinder/Node.java -index d7a86444d0e76154319c409317fc5ac9c54403a8..9f8ecc9eb5d5f8b45d03f333ca43295f3d3ce3d3 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/Node.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/Node.java -@@ -6,9 +6,9 @@ import net.minecraft.util.Mth; - import net.minecraft.world.phys.Vec3; - - public class Node { -- public final int x; -- public final int y; -- public final int z; -+ public final int x; @Deprecated public final int getX() { return x; } // Paper - OBFHELPER -+ public final int y; @Deprecated public final int getY() { return y; } // Paper - OBFHELPER -+ public final int z; @Deprecated public final int getZ() { return z; } // Paper - OBFHELPER - private final int hash; - public int heapIdx = -1; - public float g; -diff --git a/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java -index 72ca8adb9fa65588c6b1e19be2dc27a36c0146a6..a2126606fa727e24a524f74289d498ef2cb881c7 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java -@@ -15,9 +15,9 @@ public abstract class NodeEvaluator { - protected int entityWidth; - protected int entityHeight; - protected int entityDepth; -- protected boolean canPassDoors; -- protected boolean canOpenDoors; -- protected boolean canFloat; -+ protected boolean canPassDoors; @Deprecated public boolean shouldPassDoors() { return canPassDoors; } @Deprecated public void setShouldPassDoors(boolean b) { canPassDoors = b; } // Paper - obfhelper -+ protected boolean canOpenDoors; @Deprecated public boolean shouldOpenDoors() { return canOpenDoors; } @Deprecated public void setShouldOpenDoors(boolean b) { canOpenDoors = b; } // Paper - obfhelper -+ protected boolean canFloat; @Deprecated public boolean shouldFloat() { return canFloat; } @Deprecated public void setShouldFloat(boolean b) { canFloat = b; } // Paper - obfhelper - - public void prepare(PathNavigationRegion cachedWorld, Mob entity) { - this.level = cachedWorld; diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java -index 6928c415e328dd7cff2e9ec553bc4faa1ff8facf..c704c126ad1844110dcd8013b1cf0916857dd7ed 100644 +index 31d4431a60e742e2ca3b1a2abcce33954f599488..f4b6c2bf74884c0b53956788dcfcca784cfafca2 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/Path.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/Path.java -@@ -12,14 +12,15 @@ import net.minecraft.world.entity.Entity; - import net.minecraft.world.phys.Vec3; - - public class Path { -- private final List nodes; -+ private final List nodes; @Deprecated public List getPoints() { return nodes; } // Paper - OBFHELPER - private Node[] openSet = new Node[0]; - private Node[] closedSet = new Node[0]; - private Set targetNodes; -- private int nextNodeIndex; -+ private int nextNodeIndex; @Deprecated public int getNextIndex() { return this.nextNodeIndex; } // Paper - OBFHELPER +@@ -20,6 +20,7 @@ public class Path { private final BlockPos target; private final float distToTarget; private final boolean reached; -+ public boolean hasNext() { return getNextIndex() < getPoints().size(); } // Paper ++ public boolean hasNext() { return getNextNodeIndex() < this.nodes.size(); } // Paper public Path(List nodes, BlockPos target, boolean reachesTarget) { this.nodes = nodes; -@@ -41,7 +42,7 @@ public class Path { - } - - @Nullable -- public Node getEndNode() { -+ @Deprecated public Node getFinalPoint() { return getEndNode(); } @Nullable public Node getEndNode() { // Paper - OBFHELPER - return !this.nodes.isEmpty() ? this.nodes.get(this.nodes.size() - 1) : null; - } - -@@ -88,7 +89,7 @@ public class Path { - return this.getEntityPosAtNode(entity, this.nextNodeIndex); - } - -- public BlockPos getNextNodePos() { -+ @Deprecated public BlockPos getNext() { return getNextNodePos(); } public BlockPos getNextNodePos() { // Paper - OBFHELPER - return this.nodes.get(this.nextNodeIndex).asBlockPos(); - } - diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java index 71872fdfafca82cf745eecee4bf984726d49f5a4..9c9fa83615cd06539ce5e4e3d4feaa69f65b7931 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java diff --git a/patches/server/0276-Add-LivingEntity-getTargetEntity.patch b/patches/server/0276-Add-LivingEntity-getTargetEntity.patch index 427328bdd6..2cbe1f217c 100644 --- a/patches/server/0276-Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/0276-Add-LivingEntity-getTargetEntity.patch @@ -4,20 +4,8 @@ Date: Sat, 22 Sep 2018 00:33:08 -0500 Subject: [PATCH] Add LivingEntity#getTargetEntity -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 734559b4f36128afb4178fecbba99e8e4ac0aa7e..e62427c4dcd77eac147180349b95f76749d5ba56 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2362,6 +2362,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - this.setYHeadRot(yaw); - } - -+ @Deprecated public final float getCollisionBorderSize() { return getPickRadius(); } // Paper - OBFHELPER - public float getPickRadius() { - return 0.0F; - } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3e7a2e37108f07c6057d1cd0bf673b0ed162f16a..205c3cf4b9c602c6765060a669b41dcdec1a854a 100644 +index 3e7a2e37108f07c6057d1cd0bf673b0ed162f16a..5e781d0af08ba7faba84ee774e87f1c0d484ae9f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -116,6 +116,7 @@ import net.minecraft.world.level.storage.loot.LootTable; @@ -47,7 +35,7 @@ index 3e7a2e37108f07c6057d1cd0bf673b0ed162f16a..205c3cf4b9c602c6765060a669b41dcd + EntityHitResult result = null; + + for (Entity entity : entityList) { -+ final double inflationAmount = (double) entity.getCollisionBorderSize(); ++ final double inflationAmount = (double) entity.getPickRadius(); + AABB aabb = entity.getBoundingBox().inflate(inflationAmount, inflationAmount, inflationAmount); + Optional rayTraceResult = aabb.clip(start, end); + diff --git a/patches/server/0281-Add-more-Witch-API.patch b/patches/server/0281-Add-more-Witch-API.patch index 20aa726c7a..e6291b7c03 100644 --- a/patches/server/0281-Add-more-Witch-API.patch +++ b/patches/server/0281-Add-more-Witch-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add more Witch API diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java -index 5e2e8cb5eba4ba36065f07abed954b2aad022321..cc00bfd72cc106a170731f4dfdb3bebeb8bb0c21 100644 +index e26ce4d8b3a3af8d6347f8c8c36703aeb06da520..8c3e8c12d7405ad388342e304430834a5fad12a9 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Witch.java +++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java @@ -1,5 +1,8 @@ @@ -17,15 +17,6 @@ index 5e2e8cb5eba4ba36065f07abed954b2aad022321..cc00bfd72cc106a170731f4dfdb3bebe import java.util.Iterator; import java.util.List; import java.util.UUID; -@@ -49,7 +52,7 @@ public class Witch extends Raider implements RangedAttackMob { - private static final UUID SPEED_MODIFIER_DRINKING_UUID = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); - private static final AttributeModifier SPEED_MODIFIER_DRINKING = new AttributeModifier(Witch.SPEED_MODIFIER_DRINKING_UUID, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION); - private static final EntityDataAccessor DATA_USING_ITEM = SynchedEntityData.defineId(Witch.class, EntityDataSerializers.BOOLEAN); -- private int usingTime; -+ private int usingTime; @Deprecated public int getPotionUseTimeLeft() { return usingTime; } @Deprecated public void setPotionUseTimeLeft(int timeLeft) { usingTime = timeLeft; } // Paper - OBFHELPER - private NearestHealableRaiderTargetGoal healRaidersGoal; - private NearestAttackableWitchTargetGoal attackPlayersGoal; - @@ -157,21 +160,24 @@ public class Witch extends Raider implements RangedAttackMob { } @@ -89,7 +80,7 @@ index 5e2e8cb5eba4ba36065f07abed954b2aad022321..cc00bfd72cc106a170731f4dfdb3bebe public SoundEvent getCelebrateSound() { return SoundEvents.WITCH_CELEBRATE; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java -index d4eeb071dbbfca3ecea256228853bcb5c11f49ee..bb40b5af0f2a6a971f78350394099e3a48d5d04a 100644 +index d4eeb071dbbfca3ecea256228853bcb5c11f49ee..8625d8d7ac94dca2acc348a4c3c912d39cd22b47 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java @@ -3,6 +3,13 @@ package org.bukkit.craftbukkit.entity; @@ -117,12 +108,12 @@ index d4eeb071dbbfca3ecea256228853bcb5c11f49ee..bb40b5af0f2a6a971f78350394099e3a + } + + public int getPotionUseTimeLeft() { -+ return getHandle().getPotionUseTimeLeft(); ++ return getHandle().usingTime; + } + + @Override + public void setPotionUseTimeLeft(int ticks) { -+ getHandle().setPotionUseTimeLeft(ticks); ++ getHandle().usingTime = ticks; + } + + public ItemStack getDrinkingPotion() { diff --git a/patches/server/0297-force-entity-dismount-during-teleportation.patch b/patches/server/0297-force-entity-dismount-during-teleportation.patch index 00c2e9ef9e..ac0063eadd 100644 --- a/patches/server/0297-force-entity-dismount-during-teleportation.patch +++ b/patches/server/0297-force-entity-dismount-during-teleportation.patch @@ -41,10 +41,10 @@ index 085bdf17a0e844ff813bf1107b686b33943659ba..e9dc0288ea1bb7645622ac6d9fc7567b if (entity1 != entity && this.connection != null) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6b451733da0ccd5f300ccf1614ff301d641f0996..21aebe12db1544d0b8958c7db35a98cb92174630 100644 +index 6ec242804b8a52216cf4148eed7d33109021c4de..2f9e6781e501a76994edc208a7981030d8fb4ea2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2235,12 +2235,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2234,12 +2234,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } @@ -62,7 +62,7 @@ index 6b451733da0ccd5f300ccf1614ff301d641f0996..21aebe12db1544d0b8958c7db35a98cb } } -@@ -2303,7 +2306,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2302,7 +2305,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return true; // CraftBukkit } @@ -74,7 +74,7 @@ index 6b451733da0ccd5f300ccf1614ff301d641f0996..21aebe12db1544d0b8958c7db35a98cb if (entity.getVehicle() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { -@@ -2313,7 +2319,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2312,7 +2318,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { VehicleExitEvent event = new VehicleExitEvent( (Vehicle) this.getBukkitEntity(), @@ -83,7 +83,7 @@ index 6b451733da0ccd5f300ccf1614ff301d641f0996..21aebe12db1544d0b8958c7db35a98cb ); // Suppress during worldgen if (this.valid) { -@@ -2327,7 +2333,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2326,7 +2332,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } // CraftBukkit end // Spigot start @@ -93,7 +93,7 @@ index 6b451733da0ccd5f300ccf1614ff301d641f0996..21aebe12db1544d0b8958c7db35a98cb if (this.valid) { Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 77d816a5a98f3118abb91eb65e0bb316b8b0c549..32507c52d90393101ef5140de0d82518e5cbfbcc 100644 +index 5e781d0af08ba7faba84ee774e87f1c0d484ae9f..4e366fd032cf0ac37a7a851994625b905029cd4a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3329,11 +3329,13 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0300-Add-PlayerConnectionCloseEvent.patch b/patches/server/0300-Add-PlayerConnectionCloseEvent.patch index 4b385aaab0..b97ebff1cb 100644 --- a/patches/server/0300-Add-PlayerConnectionCloseEvent.patch +++ b/patches/server/0300-Add-PlayerConnectionCloseEvent.patch @@ -34,7 +34,7 @@ how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent is undefined. diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 8bbf13a7aea1142b3154a1c76837a98aa5ed431d..9f0537799a3cae43fb120056b8fe805a4883cc4d 100644 +index 8bbf13a7aea1142b3154a1c76837a98aa5ed431d..7387990152e512cb186d76b5aa9d51838312ac03 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -418,6 +418,26 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -51,7 +51,7 @@ index 8bbf13a7aea1142b3154a1c76837a98aa5ed431d..9f0537799a3cae43fb120056b8fe805a + } else if (packetListener instanceof ServerLoginPacketListenerImpl) { + /* Player is login stage */ + final ServerLoginPacketListenerImpl loginListener = (ServerLoginPacketListenerImpl) packetListener; -+ switch (loginListener.getLoginState()) { ++ switch (loginListener.state) { + case READY_TO_ACCEPT: + case DELAY_ACCEPT: + case ACCEPTED: @@ -65,15 +65,11 @@ index 8bbf13a7aea1142b3154a1c76837a98aa5ed431d..9f0537799a3cae43fb120056b8fe805a } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 3d97f76f14b8c22c78c46a34c2da2e6406ba28b6..2e272db2b03bd1bf93e9d2af62b4eb43ae1be75b 100644 +index bda4807f70806feb020eb73494079f23e6b0d90e..12f945e91827470a9a61951e45c062deee8cf281 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -56,10 +56,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener - private final byte[] nonce = new byte[4]; - final MinecraftServer server; - public final Connection connection; -- ServerLoginPacketListenerImpl.State state; -+ ServerLoginPacketListenerImpl.State state; @Deprecated public final ServerLoginPacketListenerImpl.State getLoginState() { return this.state; }; // Paper - OBFHELPER +@@ -59,7 +59,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener + public ServerLoginPacketListenerImpl.State state; private int tick; @Nullable - GameProfile gameProfile; diff --git a/patches/server/0306-BlockDestroyEvent.patch b/patches/server/0306-BlockDestroyEvent.patch index cc62f7afab..9768f9ae66 100644 --- a/patches/server/0306-BlockDestroyEvent.patch +++ b/patches/server/0306-BlockDestroyEvent.patch @@ -11,7 +11,7 @@ floating in the air. This can replace many uses of BlockPhysicsEvent diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 7bcb67df44a231d9b598a57c1b10bec18823bf74..9961b18178122cb44bf9bac6fceb1989d1a51b9a 100644 +index 81ca3bf1a8f43b7c31cdb8dbba5fd234c28373ad..c85f6fedfaf756f8b17b554bcb2d94d0f00f01f1 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -28,6 +28,7 @@ import net.minecraft.nbt.CompoundTag; @@ -22,7 +22,7 @@ index 7bcb67df44a231d9b598a57c1b10bec18823bf74..9961b18178122cb44bf9bac6fceb1989 import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ServerLevel; -@@ -568,8 +569,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -567,8 +568,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return false; } else { FluidState fluid = this.getFluidState(pos); diff --git a/patches/server/0316-Entity-getEntitySpawnReason.patch b/patches/server/0316-Entity-getEntitySpawnReason.patch index 61f34ee656..879e0e51b8 100644 --- a/patches/server/0316-Entity-getEntitySpawnReason.patch +++ b/patches/server/0316-Entity-getEntitySpawnReason.patch @@ -35,7 +35,7 @@ index ea336bdf2f15aabe74de82ef6c29b93573254e31..da3100d6577166e222164c174b280205 }); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 21aebe12db1544d0b8958c7db35a98cb92174630..88b9a6b7157c9e1b6d1acf80b95fb15004e9c4d3 100644 +index 2f9e6781e501a76994edc208a7981030d8fb4ea2..ec2cc6bcfe10896f0ae439f26659a7d14e050f0f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -67,6 +67,8 @@ import net.minecraft.world.InteractionHand; @@ -55,8 +55,8 @@ index 21aebe12db1544d0b8958c7db35a98cb92174630..88b9a6b7157c9e1b6d1acf80b95fb150 // Paper end public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -@@ -1863,6 +1866,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - nbt.setUUID("Paper.OriginWorld", originWorld); +@@ -1862,6 +1865,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + nbt.putUUID("Paper.OriginWorld", originWorld); nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } + if (spawnReason != null) { @@ -65,7 +65,7 @@ index 21aebe12db1544d0b8958c7db35a98cb92174630..88b9a6b7157c9e1b6d1acf80b95fb150 // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); -@@ -2006,6 +2012,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2005,6 +2011,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -105,7 +105,7 @@ index 7bf688057d684aa1b60f29294c9a7e81ab6742d1..66ae43c40d4bad373b3a5269e8c78d7a // Spigot Start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 7f1d9932e0e4e09c3727544d053ad61a365290af..5bf488e5ed1981ef121291867062c2c2efaed6fc 100644 +index bcb616ade47b445dd6faec0fd938ee4d728d6d16..a28afbe66363e69a502b66d4124bb8fccf07be37 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1173,5 +1173,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0322-PlayerDeathEvent-getItemsToKeep.patch b/patches/server/0322-PlayerDeathEvent-getItemsToKeep.patch index 5312610c9d..49d11fdda9 100644 --- a/patches/server/0322-PlayerDeathEvent-getItemsToKeep.patch +++ b/patches/server/0322-PlayerDeathEvent-getItemsToKeep.patch @@ -8,7 +8,7 @@ Exposes a mutable array on items a player should keep on death Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 401b8f203ac0147c250ffd999003d0a6f2fd90fd..943516cbf4829b16dfb2631d526a65ace78da10d 100644 +index 401b8f203ac0147c250ffd999003d0a6f2fd90fd..c295ca30fad607feb49d58cec664a7205a493e78 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -729,6 +729,46 @@ public class ServerPlayer extends Player { @@ -63,7 +63,7 @@ index 401b8f203ac0147c250ffd999003d0a6f2fd90fd..943516cbf4829b16dfb2631d526a65ac if (!event.getKeepInventory()) { this.getInventory().clearContent(); + // Paper start - replace logic -+ for (NonNullList inv : this.getInventory().getComponents()) { ++ for (NonNullList inv : this.getInventory().compartments) { + processKeep(event, inv); + } + processKeep(event, null); diff --git a/patches/server/0323-Optimize-Captured-TileEntity-Lookup.patch b/patches/server/0323-Optimize-Captured-TileEntity-Lookup.patch index 411c3a7931..06592ce2ff 100644 --- a/patches/server/0323-Optimize-Captured-TileEntity-Lookup.patch +++ b/patches/server/0323-Optimize-Captured-TileEntity-Lookup.patch @@ -10,10 +10,10 @@ Optimize to check if the captured list even has values in it, and also to just do a get call since the value can never be null. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 9961b18178122cb44bf9bac6fceb1989d1a51b9a..6acff46faa03842567d5fe81609bec6ea7922c21 100644 +index c85f6fedfaf756f8b17b554bcb2d94d0f00f01f1..5d021fbaeeb2655a775053225a9614d7881331c4 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -872,9 +872,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -871,9 +871,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @Nullable public BlockEntity getTileEntity(BlockPos blockposition, boolean validate) { diff --git a/patches/server/0333-Chunk-debug-command.patch b/patches/server/0333-Chunk-debug-command.patch index 4f0b12b3b8..7742d3f3a7 100644 --- a/patches/server/0333-Chunk-debug-command.patch +++ b/patches/server/0333-Chunk-debug-command.patch @@ -32,7 +32,7 @@ https://bugs.mojang.com/browse/MC-141484?focusedCommentId=528273&page=com.atlass https://bugs.mojang.com/browse/MC-141484?focusedCommentId=528577&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-528577 diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 1fa190e098079522e0fe3593fa261c1b7ad4e24b..71ffa66973d8994e2a480435ac1ada3fe61600a4 100644 +index 1fa190e098079522e0fe3593fa261c1b7ad4e24b..43067ef5733a29145b3e2ce386999ba518042dd7 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -6,13 +6,15 @@ import com.google.common.collect.ImmutableSet; @@ -132,7 +132,7 @@ index 1fa190e098079522e0fe3593fa261c1b7ad4e24b..71ffa66973d8994e2a480435ac1ada3f + int entityTicking = 0; + + for (ChunkHolder chunk : world.getChunkSource().chunkMap.updatingChunkMap.values()) { -+ if (chunk.getFullChunkIfCached() == null) { ++ if (chunk.getFullChunkUnchecked() == null) { + continue; + } + @@ -212,7 +212,7 @@ index 1fa190e098079522e0fe3593fa261c1b7ad4e24b..71ffa66973d8994e2a480435ac1ada3f * Ported from MinecraftForge - author: LexManos - License: LGPLv2.1 */ diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 2d0c10c72a9ddc5a26352fad6baae2f6c2678923..dcc8837d0c806a3755f1d20b6780b674edf09a11 100644 +index 2d0c10c72a9ddc5a26352fad6baae2f6c2678923..5c1421620e02b7d4ab4171ebff41076c7ee8cd55 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -8,13 +8,27 @@ import net.minecraft.core.BlockPos; @@ -334,7 +334,7 @@ index 2d0c10c72a9ddc5a26352fad6baae2f6c2678923..dcc8837d0c806a3755f1d20b6780b674 + int fullLoadedChunks = 0; + + for (ChunkHolder chunk : allChunks) { -+ if (chunk.getFullChunkIfCached() != null) { ++ if (chunk.getFullChunkUnchecked() != null) { + ++fullLoadedChunks; + } + } diff --git a/patches/server/0334-Allow-Saving-of-Oversized-Chunks.patch b/patches/server/0334-Allow-Saving-of-Oversized-Chunks.patch index 2b81e0e59b..bd5b4ebbee 100644 --- a/patches/server/0334-Allow-Saving-of-Oversized-Chunks.patch +++ b/patches/server/0334-Allow-Saving-of-Oversized-Chunks.patch @@ -33,7 +33,7 @@ this fix, as the data will remain in the oversized file. Once the server returns to a jar with this fix, the data will be restored. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 357da4846344d1182ab7149c4d352d5019384715..26ad58e7a73e63d2393eb277984be20472157539 100644 +index 298b5abbc792dd33be38acbd1c572c9778c4d2d2..46226dd2d16a9f4017661712fe2bfc0c46f63cb2 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -20,8 +20,12 @@ import java.nio.file.LinkOption; @@ -66,7 +66,7 @@ index 357da4846344d1182ab7149c4d352d5019384715..26ad58e7a73e63d2393eb277984be204 this.usedSectors = new RegionBitmap(); this.version = outputChunkStreamVersion; if (!Files.isDirectory(directory, new LinkOption[0])) { -@@ -434,6 +441,74 @@ public class RegionFile implements AutoCloseable { +@@ -433,6 +440,74 @@ public class RegionFile implements AutoCloseable { } @@ -142,7 +142,7 @@ index 357da4846344d1182ab7149c4d352d5019384715..26ad58e7a73e63d2393eb277984be204 private final ChunkPos pos; diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index ebb1a050beab9530942c4498335f084c89faef06..f53268f2d7d2d1909d64d06bb6a61086386830e1 100644 +index ebb1a050beab9530942c4498335f084c89faef06..24092d3d3d234b6f1f2b90e22d90f297532358cc 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -10,7 +10,9 @@ import java.io.File; @@ -182,7 +182,7 @@ index ebb1a050beab9530942c4498335f084c89faef06..f53268f2d7d2d1909d64d06bb6a61086 + + private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException { + synchronized (regionfile) { -+ try (DataInputStream datainputstream = regionfile.getReadStream(chunkCoordinate)) { ++ try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { + CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); + CompoundTag chunk = NbtIo.read((DataInput) datainputstream); + if (oversizedData == null) { diff --git a/patches/server/0336-Fix-World-isChunkGenerated-calls.patch b/patches/server/0336-Fix-World-isChunkGenerated-calls.patch index a417be52ec..f9db7a4cf4 100644 --- a/patches/server/0336-Fix-World-isChunkGenerated-calls.patch +++ b/patches/server/0336-Fix-World-isChunkGenerated-calls.patch @@ -8,17 +8,17 @@ This patch also adds a chunk status cache on region files (note that its only purpose is to cache the status on DISK) diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index ddaf9d682772d5dbbe6ee4891f9995a8ee365329..a3692debdf8c0df1f785794bff29235b95750809 100644 +index 0dbd72761bd605473d1643ac1ad16a373060ddae..a066ac00ad3274a7c70edbb9cc442dc9be78a3bb 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -111,6 +111,19 @@ public class ChunkHolder { +@@ -110,6 +110,19 @@ public class ChunkHolder { Either either = (Either) statusFuture.getNow(null); return (either == null) ? null : (LevelChunk) either.left().orElse(null); } + + public ChunkAccess getAvailableChunkNow() { + // TODO can we just getStatusFuture(EMPTY)? -+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getPreviousStatus(); curr != next; curr = next, next = next.getPreviousStatus()) { ++ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) { + CompletableFuture> future = this.getFutureIfPresentUnchecked(curr); + Either either = future.getNow(null); + if (either == null || !either.left().isPresent()) { @@ -108,7 +108,7 @@ index 36bc19cbb5242207ff019f62f59205e1a6336728..f271d7b32fef73401778682a1d4832bf // Spigot start return this.isOutsideOfRange(chunkPos, false); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 672f78d1560ccd45d1a0ca04d6daf8188105c3e9..734b204d53a4b9e9b1112efe3a50b53cf1aa9f47 100644 +index 1176dd8ebd59c5bda1b74c532ca21ae335078805..ddaa4dfa4611e8d659e9d0211873b6f503e3d230 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -324,6 +324,7 @@ public class ServerChunkCache extends ChunkSource { @@ -120,18 +120,10 @@ index 672f78d1560ccd45d1a0ca04d6daf8188105c3e9..734b204d53a4b9e9b1112efe3a50b53c ChunkHolder holder = this.chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); if (holder == null) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -index 6e0cf8ee76143301c939fc4af5eeb091abdcbc5c..11739e01ea7188a45a3824ade8342124780ce936 100644 +index 6e0cf8ee76143301c939fc4af5eeb091abdcbc5c..1c7b18db0053bca6e7750225a79f7d95843edabe 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -@@ -204,6 +204,7 @@ public class ChunkStatus { - return this.name; - } - -+ @Deprecated public ChunkStatus getPreviousStatus() { return this.getParent(); } // Paper - OBFHELPER - public ChunkStatus getParent() { - return this.parent; - } -@@ -224,6 +225,17 @@ public class ChunkStatus { +@@ -224,6 +224,17 @@ public class ChunkStatus { return this.chunkType; } @@ -172,7 +164,7 @@ index 21b3da831cd959e3fd85d437e1ba3c7a6c72502f..1c975b686c1e335d46e63ab12e0a97dd if (nbt != null) { ChunkStatus chunkstatus = ChunkStatus.byName(nbt.getCompound("Level").getString("Status")); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 2f1d53037ac00bf2570def599641263fdc3859a1..933acb9bd1c6dd2baedee4bddea83a9de7f1e3d1 100644 +index 46226dd2d16a9f4017661712fe2bfc0c46f63cb2..c22391a0d4b7db49bd3994b0887939a7d8019391 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -27,6 +27,7 @@ import net.minecraft.Util; @@ -214,7 +206,7 @@ index 2f1d53037ac00bf2570def599641263fdc3859a1..933acb9bd1c6dd2baedee4bddea83a9d public RegionFile(File file, File directory, boolean dsync) throws IOException { this(file.toPath(), directory.toPath(), RegionFileVersion.VERSION_DEFLATE, dsync); } -@@ -402,6 +427,7 @@ public class RegionFile implements AutoCloseable { +@@ -401,6 +426,7 @@ public class RegionFile implements AutoCloseable { return this.getOffset(pos) != 0; } @@ -222,7 +214,7 @@ index 2f1d53037ac00bf2570def599641263fdc3859a1..933acb9bd1c6dd2baedee4bddea83a9d private static int getOffsetIndex(ChunkPos pos) { return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32; } -@@ -412,6 +438,7 @@ public class RegionFile implements AutoCloseable { +@@ -411,6 +437,7 @@ public class RegionFile implements AutoCloseable { synchronized (this) { try { // Paper end @@ -231,7 +223,7 @@ index 2f1d53037ac00bf2570def599641263fdc3859a1..933acb9bd1c6dd2baedee4bddea83a9d this.padToFullSector(); } finally { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index f53268f2d7d2d1909d64d06bb6a61086386830e1..e1b9051f8537db6f023cfdeaca4fb89305ece363 100644 +index 24092d3d3d234b6f1f2b90e22d90f297532358cc..43510774d489bfdd30f10d521e424fa1363b8919 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -219,6 +219,7 @@ public class RegionFileStorage implements AutoCloseable { diff --git a/patches/server/0367-Anti-Xray.patch b/patches/server/0367-Anti-Xray.patch index a8bad7a2d4..b2296b3fac 100644 --- a/patches/server/0367-Anti-Xray.patch +++ b/patches/server/0367-Anti-Xray.patch @@ -112,10 +112,10 @@ index 0000000000000000000000000000000000000000..55e1c448999d79ddd9781d6f8ff28998 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ecb724f4e6 +index 0000000000000000000000000000000000000000..c69332299015d90345636cf0f4425db62068f978 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java -@@ -0,0 +1,646 @@ +@@ -0,0 +1,644 @@ +package com.destroystokyo.paper.antixray; + +import java.util.ArrayList; @@ -169,7 +169,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + private final int[] predefinedBlockDataBitsEndStoneGlobal; + private final boolean[] solidGlobal = new boolean[Block.BLOCK_STATE_REGISTRY.size()]; + private final boolean[] obfuscateGlobal = new boolean[Block.BLOCK_STATE_REGISTRY.size()]; -+ private final LevelChunkSection[] emptyNearbyChunkSections = {LevelChunk.EMPTY_CHUNK_SECTION, LevelChunk.EMPTY_CHUNK_SECTION, LevelChunk.EMPTY_CHUNK_SECTION, LevelChunk.EMPTY_CHUNK_SECTION}; ++ private final LevelChunkSection[] emptyNearbyChunkSections = {LevelChunk.EMPTY_SECTION, LevelChunk.EMPTY_SECTION, LevelChunk.EMPTY_SECTION, LevelChunk.EMPTY_SECTION}; + private final int maxBlockYUpdatePosition; + + public ChunkPacketBlockControllerAntiXray(Level world, Executor executor) { @@ -194,9 +194,9 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + predefinedBlockDataNetherrack = new BlockState[] {Blocks.NETHERRACK.defaultBlockState()}; + predefinedBlockDataEndStone = new BlockState[] {Blocks.END_STONE.defaultBlockState()}; + predefinedBlockDataBitsGlobal = null; -+ predefinedBlockDataBitsStoneGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(Blocks.STONE.defaultBlockState())}; -+ predefinedBlockDataBitsNetherrackGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(Blocks.NETHERRACK.defaultBlockState())}; -+ predefinedBlockDataBitsEndStoneGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(Blocks.END_STONE.defaultBlockState())}; ++ predefinedBlockDataBitsStoneGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(Blocks.STONE.defaultBlockState())}; ++ predefinedBlockDataBitsNetherrackGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(Blocks.NETHERRACK.defaultBlockState())}; ++ predefinedBlockDataBitsEndStoneGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(Blocks.END_STONE.defaultBlockState())}; + } else { + toObfuscate = new ArrayList<>(paperWorldConfig.replacementBlocks); + List predefinedBlockDataList = new LinkedList(); @@ -221,7 +221,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + predefinedBlockDataBitsGlobal = new int[predefinedBlockDataFull.length]; + + for (int i = 0; i < predefinedBlockDataFull.length; i++) { -+ predefinedBlockDataBitsGlobal[i] = LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(predefinedBlockDataFull[i]); ++ predefinedBlockDataBitsGlobal[i] = LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(predefinedBlockDataFull[i]); + } + + predefinedBlockDataBitsStoneGlobal = null; @@ -235,10 +235,8 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + // Don't obfuscate air because air causes unnecessary block updates and causes block updates to fail in the void + if (block != null && !block.defaultBlockState().isAir()) { + // Replace all block states of a specified block -+ // No OBFHELPER for nms.BlockStateList#a() due to too many decompile errors -+ // The OBFHELPER should be getBlockDataList() + for (BlockState blockData : block.getStateDefinition().getPossibleStates()) { -+ obfuscateGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(blockData)] = true; ++ obfuscateGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(blockData)] = true; + } + } + } @@ -247,7 +245,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + BlockPos zeroPos = new BlockPos(0, 0, 0); + + for (int i = 0; i < solidGlobal.length; i++) { -+ BlockState blockData = LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getObject(i); ++ BlockState blockData = LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.valueFor(i); + + if (blockData != null) { + solidGlobal[i] = blockData.isRedstoneConductor(emptyChunk, zeroPos) @@ -378,7 +376,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + predefinedBlockDataBitsTemp = predefinedBlockDataBits; + + for (int i = 0; i < predefinedBlockDataBitsTemp.length; i++) { -+ predefinedBlockDataBitsTemp[i] = chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex).getOrCreateIdFor(predefinedBlockDataFull[i]); ++ predefinedBlockDataBitsTemp[i] = chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex).idFor(predefinedBlockDataFull[i]); + } + } + @@ -393,12 +391,12 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + obfuscateTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex), obfuscate, obfuscateGlobal); + // Read the blocks of the upper layer of the chunk section below if it exists + LevelChunkSection belowChunkSection = null; -+ boolean skipFirstLayer = chunkSectionIndex == 0 || (belowChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex - 1]) == LevelChunk.EMPTY_CHUNK_SECTION; ++ boolean skipFirstLayer = chunkSectionIndex == 0 || (belowChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex - 1]) == LevelChunk.EMPTY_SECTION; + + for (int z = 0; z < 16; z++) { + for (int x = 0; x < 16; x++) { + current[z][x] = true; -+ next[z][x] = skipFirstLayer || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(belowChunkSection.getBlockState(x, 15, z))]; ++ next[z][x] = skipFirstLayer || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(belowChunkSection.getBlockState(x, 15, z))]; + } + } + @@ -408,10 +406,10 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + } + + dataBitsWriter.setBitsPerObject(chunkPacketInfoAntiXray.getBitsPerObject(chunkSectionIndex)); -+ nearbyChunkSections[0] = chunkPacketInfoAntiXray.getNearbyChunks()[0] == null ? LevelChunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[0].getSections()[chunkSectionIndex]; -+ nearbyChunkSections[1] = chunkPacketInfoAntiXray.getNearbyChunks()[1] == null ? LevelChunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[1].getSections()[chunkSectionIndex]; -+ nearbyChunkSections[2] = chunkPacketInfoAntiXray.getNearbyChunks()[2] == null ? LevelChunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[2].getSections()[chunkSectionIndex]; -+ nearbyChunkSections[3] = chunkPacketInfoAntiXray.getNearbyChunks()[3] == null ? LevelChunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[3].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[0] = chunkPacketInfoAntiXray.getNearbyChunks()[0] == null ? LevelChunk.EMPTY_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[0].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[1] = chunkPacketInfoAntiXray.getNearbyChunks()[1] == null ? LevelChunk.EMPTY_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[1].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[2] = chunkPacketInfoAntiXray.getNearbyChunks()[2] == null ? LevelChunk.EMPTY_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[2].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[3] = chunkPacketInfoAntiXray.getNearbyChunks()[3] == null ? LevelChunk.EMPTY_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[3].getSections()[chunkSectionIndex]; + + // Obfuscate all layers of the current chunk section except the upper one + for (int y = 0; y < 15; y++) { @@ -427,7 +425,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + // If so, obfuscate the upper layer of the current chunk section by reading blocks of the first layer from the chunk section above if it exists + LevelChunkSection aboveChunkSection; + -+ if (chunkSectionIndex != worldSectionHeight && (aboveChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex + 1]) != LevelChunk.EMPTY_CHUNK_SECTION) { ++ if (chunkSectionIndex != worldSectionHeight && (aboveChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex + 1]) != LevelChunk.EMPTY_SECTION) { + boolean[][] temp = current; + current = next; + next = nextNext; @@ -435,7 +433,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + + for (int z = 0; z < 16; z++) { + for (int x = 0; x < 16; x++) { -+ if (!solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(aboveChunkSection.getBlockState(x, 0, z))]) { ++ if (!solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(aboveChunkSection.getBlockState(x, 0, z))]) { + current[z][x] = true; + } + } @@ -475,7 +473,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + next[0][1] = true; + next[1][0] = true; + } else { -+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[2].getBlockState(0, y, 15))] || nearbyChunkSections[0] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[0].getBlockState(15, y, 0))] || current[0][0]) { ++ if (nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(0, y, 15))] || nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, 0))] || current[0][0]) { + dataBitsWriter.skip(); + } else { + dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]); @@ -496,7 +494,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + next[0][x + 1] = true; + next[1][x] = true; + } else { -+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[2].getBlockState(x, y, 15))] || current[0][x]) { ++ if (nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(x, y, 15))] || current[0][x]) { + dataBitsWriter.skip(); + } else { + dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]); @@ -516,7 +514,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + next[0][14] = true; + next[1][15] = true; + } else { -+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[2].getBlockState(15, y, 15))] || nearbyChunkSections[1] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[1].getBlockState(0, y, 0))] || current[0][15]) { ++ if (nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(15, y, 15))] || nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, 0))] || current[0][15]) { + dataBitsWriter.skip(); + } else { + dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]); @@ -538,7 +536,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + next[z - 1][0] = true; + next[z + 1][0] = true; + } else { -+ if (nearbyChunkSections[0] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[0].getBlockState(15, y, z))] || current[z][0]) { ++ if (nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, z))] || current[z][0]) { + dataBitsWriter.skip(); + } else { + dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]); @@ -581,7 +579,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + next[z - 1][15] = true; + next[z + 1][15] = true; + } else { -+ if (nearbyChunkSections[1] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[1].getBlockState(0, y, z))] || current[z][15]) { ++ if (nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, z))] || current[z][15]) { + dataBitsWriter.skip(); + } else { + dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]); @@ -601,7 +599,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + next[15][1] = true; + next[14][0] = true; + } else { -+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[3].getBlockState(0, y, 0))] || nearbyChunkSections[0] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[0].getBlockState(15, y, 15))] || current[15][0]) { ++ if (nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(0, y, 0))] || nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, 15))] || current[15][0]) { + dataBitsWriter.skip(); + } else { + dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]); @@ -622,7 +620,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + next[15][x + 1] = true; + next[14][x] = true; + } else { -+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[3].getBlockState(x, y, 0))] || current[15][x]) { ++ if (nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(x, y, 0))] || current[15][x]) { + dataBitsWriter.skip(); + } else { + dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]); @@ -642,7 +640,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + next[15][14] = true; + next[14][15] = true; + } else { -+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[3].getBlockState(15, y, 0))] || nearbyChunkSections[1] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[1].getBlockState(0, y, 15))] || current[15][15]) { ++ if (nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(15, y, 0))] || nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, 15))] || current[15][15]) { + dataBitsWriter.skip(); + } else { + dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]); @@ -661,8 +659,8 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + + BlockState blockData; + -+ for (int i = 0; (blockData = dataPalette.getObject(i)) != null; i++) { -+ temp[i] = global[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(blockData)]; ++ for (int i = 0; (blockData = dataPalette.valueFor(i)) != null; i++) { ++ temp[i] = global[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(blockData)]; + } + + return temp; @@ -670,7 +668,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + + @Override + public void onBlockChange(Level world, BlockPos blockPosition, BlockState newBlockData, BlockState oldBlockData, int flag) { -+ if (oldBlockData != null && solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(oldBlockData)] && !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(newBlockData)] && blockPosition.getY() <= maxBlockYUpdatePosition) { ++ if (oldBlockData != null && solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(oldBlockData)] && !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(newBlockData)] && blockPosition.getY() <= maxBlockYUpdatePosition) { + updateNearbyBlocks(world, blockPosition); + } + } @@ -724,7 +722,7 @@ index 0000000000000000000000000000000000000000..f13651f8ede36b3324d0bd87a51368ec + private void updateBlock(Level world, BlockPos blockPosition) { + BlockState blockData = world.getTypeIfLoaded(blockPosition); + -+ if (blockData != null && obfuscateGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(blockData)]) { ++ if (blockData != null && obfuscateGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(blockData)]) { + // world.notify(blockPosition, blockData, blockData, 3); + ((ServerLevel)world).getChunkSource().blockChanged(blockPosition); // We only need to re-send to client + } @@ -1155,7 +1153,7 @@ index f4a056185990181e486f452960159a5287947382..a695e5a0c2e8846333ccb9aea499b565 public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, String reason) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index fff1d38e07439ab1bc83aa9e7153b3666a351129..7e4949155914a8ea5612080bd4a13ce63c2b10d7 100644 +index 580b3d7d993751e7c04e6b7d5d4d8fa9d150d383..83673e66aab4988e912d78fb8d1a45f807e38bd9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -164,6 +164,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1231,7 +1229,7 @@ index 69c2454533e6f21c70792b555ec02c6bc6d169b3..2607c7ba5cf1aca5f3e5c22be2e4e8b3 @Override 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 448f28856387cf9967063dd8c02b34e5e90d95c9..3399ca62de7ae71af7c3f537bac3345b4c46d0a5 100644 +index 8cc0f2a74191357ab52f30439a515709f8ab80d1..fbb82d344f654b90809582916442c520f344aa39 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -456,7 +456,7 @@ public class LevelChunk implements ChunkAccess { @@ -1305,7 +1303,7 @@ index 5fd66020a937b641e2a060cf38df731a43f3bf55..ec8b67c1b024df38d5e1ad81acff3353 public int getSerializedSize() { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 3dfe539a9ca08d85ddbcc334cfec0734bf92f348..bb3311edffb7a460df8321f00d7d1d9f26c6340e 100644 +index bb8fd88aebb550edec8c679622a02a595cbc6694..4a6981f8bacdeca1069e1ddfe44ac9c4217ce624 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -28,6 +28,7 @@ public class PalettedContainer implements PaletteResize { @@ -1313,9 +1311,9 @@ index 3dfe539a9ca08d85ddbcc334cfec0734bf92f348..bb3311edffb7a460df8321f00d7d1d9f private final Function writer; private final T defaultValue; + private final T[] predefinedObjects; // Paper - Anti-Xray - Add predefined objects - protected BitStorage storage; @Deprecated public final BitStorage getDataBits() { return this.storage; } // Paper - OBFHELPER - private Palette palette; @Deprecated private Palette getDataPalette() { return this.palette; } // Paper - OBFHELPER - private int bits; @Deprecated private int getBitsPerObject() { return this.bits; } // Paper - OBFHELPER + protected BitStorage storage; + private Palette palette; + private int bits; @@ -48,15 +49,51 @@ public class PalettedContainer implements PaletteResize { this.lock.release(); } @@ -1339,7 +1337,7 @@ index 3dfe539a9ca08d85ddbcc334cfec0734bf92f348..bb3311edffb7a460df8321f00d7d1d9f + if (initialize) { + if (predefinedObjects == null) { + // Default -+ this.initialize(4); ++ this.setBits(4); + } else { + // MathHelper.d() is trailingBits(roundCeilPow2(n)), alternatively; (int)ceil(log2(n)); however it's trash, use numberOfLeadingZeros instead + // Count the bits of the maximum array index to initialize a data palette with enough space from the beginning @@ -1349,7 +1347,7 @@ index 3dfe539a9ca08d85ddbcc334cfec0734bf92f348..bb3311edffb7a460df8321f00d7d1d9f + int bitCount = (32 - Integer.numberOfLeadingZeros(Math.max(16, maxIndex) - 1)); + + // Initialize with at least 15 free indixes -+ this.initialize((1 << bitCount) - predefinedObjects.length < 16 ? bitCount + 1 : bitCount); ++ this.setBits((1 << bitCount) - predefinedObjects.length < 16 ? bitCount + 1 : bitCount); + this.addPredefinedObjects(); + } + } @@ -1360,7 +1358,7 @@ index 3dfe539a9ca08d85ddbcc334cfec0734bf92f348..bb3311edffb7a460df8321f00d7d1d9f + private void addPredefinedObjects() { + if (this.predefinedObjects != null && this.palette != this.globalPalette) { + for (T predefinedObject : this.predefinedObjects) { -+ this.palette.getOrCreateIdFor(predefinedObject); ++ this.palette.idFor(predefinedObject); + } + } + } @@ -1369,7 +1367,7 @@ index 3dfe539a9ca08d85ddbcc334cfec0734bf92f348..bb3311edffb7a460df8321f00d7d1d9f private static int getIndex(int x, int y, int z) { return y << 8 | z << 4 | x; } -@@ -86,6 +123,7 @@ public class PalettedContainer implements PaletteResize { +@@ -85,6 +122,7 @@ public class PalettedContainer implements PaletteResize { Palette palette = this.palette; this.setBits(newSize); @@ -1377,10 +1375,10 @@ index 3dfe539a9ca08d85ddbcc334cfec0734bf92f348..bb3311edffb7a460df8321f00d7d1d9f for(int i = 0; i < bitStorage.getSize(); ++i) { T object = palette.valueFor(bitStorage.get(i)); if (object != null) { -@@ -161,11 +199,26 @@ public class PalettedContainer implements PaletteResize { +@@ -159,11 +197,26 @@ public class PalettedContainer implements PaletteResize { + } - @Deprecated public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // Paper - OBFHELPER - public void write(FriendlyByteBuf buf) { + // Paper start - Anti-Xray - Add chunk packet info + @Deprecated public void write(FriendlyByteBuf buf) { @@ -1405,7 +1403,7 @@ index 3dfe539a9ca08d85ddbcc334cfec0734bf92f348..bb3311edffb7a460df8321f00d7d1d9f buf.writeLongArray(this.storage.getRaw()); } finally { this.release(); -@@ -176,12 +229,14 @@ public class PalettedContainer implements PaletteResize { +@@ -174,12 +227,14 @@ public class PalettedContainer implements PaletteResize { public void read(ListTag paletteNbt, long[] data) { try { this.acquire(); @@ -1423,7 +1421,7 @@ index 3dfe539a9ca08d85ddbcc334cfec0734bf92f348..bb3311edffb7a460df8321f00d7d1d9f if (this.palette == this.globalPalette) { Palette palette = new HashMapPalette<>(this.registry, i, this.dummyPaletteResize, this.reader, this.writer); diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 245998e2cea32cf15ee2659639c647f449704ec0..d455eafe3810b6d8f3c6cbbfc0df85d3e6c90567 100644 +index 64cb0658021866c3875d145cc4266896e57c081e..f0c537e1d6b32ecde52b3d456f0f3889ff554824 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java @@ -63,7 +63,7 @@ public class ProtoChunk implements ChunkAccess { diff --git a/patches/server/0368-No-Tick-view-distance-implementation.patch b/patches/server/0368-No-Tick-view-distance-implementation.patch index fed190f16b..87dbb50411 100644 --- a/patches/server/0368-No-Tick-view-distance-implementation.patch +++ b/patches/server/0368-No-Tick-view-distance-implementation.patch @@ -39,7 +39,7 @@ index b8ca1f73b2451307c3711076eaa43e2adb34d92e..45e30c0d78b7625a6a55e6d7d60a823b public EngineMode engineMode; public int maxBlockHeight; diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index dcc8837d0c806a3755f1d20b6780b674edf09a11..530916b8d0c5eb3b7b379100df1e6e0d4ade273d 100644 +index 5c1421620e02b7d4ab4171ebff41076c7ee8cd55..4bc418f45c6f16a9a1c78b6688625268870a96ad 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -636,7 +636,8 @@ public final class MCUtil { @@ -53,7 +53,7 @@ index dcc8837d0c806a3755f1d20b6780b674edf09a11..530916b8d0c5eb3b7b379100df1e6e0d worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); worldData.addProperty("visible-chunk-count", visibleChunks.size()); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index a3692debdf8c0df1f785794bff29235b95750809..5ff96851e7f7c51c365dde0d24da49be6412ab82 100644 +index a066ac00ad3274a7c70edbb9cc442dc9be78a3bb..edf0432967c4621e101611924c4ce826f54e3e34 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -75,6 +75,17 @@ public class ChunkHolder { @@ -74,7 +74,7 @@ index a3692debdf8c0df1f785794bff29235b95750809..5ff96851e7f7c51c365dde0d24da49be public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); -@@ -207,7 +218,7 @@ public class ChunkHolder { +@@ -204,7 +215,7 @@ public class ChunkHolder { } public void blockChanged(BlockPos pos) { @@ -83,7 +83,7 @@ index a3692debdf8c0df1f785794bff29235b95750809..5ff96851e7f7c51c365dde0d24da49be if (chunk != null) { int i = this.levelHeightAccessor.getSectionIndex(pos.getY()); -@@ -223,7 +234,7 @@ public class ChunkHolder { +@@ -220,7 +231,7 @@ public class ChunkHolder { } public void sectionLightChanged(LightLayer lightType, int y) { @@ -92,7 +92,7 @@ index a3692debdf8c0df1f785794bff29235b95750809..5ff96851e7f7c51c365dde0d24da49be if (chunk != null) { chunk.setUnsaved(true); -@@ -313,9 +324,48 @@ public class ChunkHolder { +@@ -310,9 +321,48 @@ public class ChunkHolder { } public void broadcast(Packet packet, boolean onlyOnWatchDistanceEdge) { @@ -145,7 +145,7 @@ index a3692debdf8c0df1f785794bff29235b95750809..5ff96851e7f7c51c365dde0d24da49be public CompletableFuture> getOrScheduleFuture(ChunkStatus targetStatus, ChunkMap chunkStorage) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index c8cc8fa2d210acf82d9c3fa96c0b0c3912dec4d8..6f4c350f486aa70b94be8cf5a7b0e22599283ba9 100644 +index 06e581bc0c0ea4e8141f7b9610cc5a7ef350c287..5bcb9613beb5cd650c670de73e946f1f9dcddb2c 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -127,7 +127,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -520,7 +520,7 @@ index 45c7ebe67019cdbe88b6617a95d5c40d3a68286c..38eebda226e007c8910e04f502ce218c if (withinViewDistance) { DistanceManager.this.ticketThrottlerInput.tell(ChunkTaskPriorityQueueSorter.message(() -> { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7ce027a7352d2ab34c27046d86ae32100c0baeb4..6ecf85579acb186f076f258368051a4ae09c3354 100644 +index 2a493097cba7bde598eafcd2986c4ab0fd20b4e6..be01191507ff677de586355abbae27d30de5a837 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -241,6 +241,7 @@ public class ServerPlayer extends Player { @@ -563,7 +563,7 @@ index bcc946d2747443c34ee8ac2485a5ab41773c93af..2730923bd0bf3b0f928765b9e09e2299 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 7357319e9186c9ffd878268ed9c1f4846ceb3ea9..91bd27148f5b699b72d56844ded76e0e25e2693c 100644 +index 83673e66aab4988e912d78fb8d1a45f807e38bd9..d58a7adb58abc91f66fc893ee7a7a7bded3619a8 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -527,8 +527,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -582,7 +582,7 @@ index 7357319e9186c9ffd878268ed9c1f4846ceb3ea9..91bd27148f5b699b72d56844ded76e0e if ((i & 1) != 0) { 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 164df6e9a91d9fbdbf6e4b835ea1946d81f3be55..a088cb005525fda2c9d5521ab3bac43cfa38a393 100644 +index fbb82d344f654b90809582916442c520f344aa39..750895bed591c9f15cd2ea2d8f0611864782c912 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -33,7 +33,10 @@ import net.minecraft.core.Registry; diff --git a/patches/server/0371-Fix-items-vanishing-through-end-portal.patch b/patches/server/0371-Fix-items-vanishing-through-end-portal.patch index 59a8cc7af7..860140f63d 100644 --- a/patches/server/0371-Fix-items-vanishing-through-end-portal.patch +++ b/patches/server/0371-Fix-items-vanishing-through-end-portal.patch @@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the heightmap resolves the issue without having to load all spawn chunks. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index fe2535aa505232df1b6c5a71e463c5c0004b4de6..6084222c0f46534c4cba81fa32478a467114cceb 100644 +index c64155d9da55db0745a8f37de01f8b28739692c2..80bf2f5e7390bf586b0eab4bac796d32158e1f3f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3004,6 +3004,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3002,6 +3002,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n BlockPos blockposition1; if (flag1) { diff --git a/patches/server/0373-Avoid-hopper-searches-if-there-are-no-items.patch b/patches/server/0373-Avoid-hopper-searches-if-there-are-no-items.patch index 587ef0a60a..43367800cb 100644 --- a/patches/server/0373-Avoid-hopper-searches-if-there-are-no-items.patch +++ b/patches/server/0373-Avoid-hopper-searches-if-there-are-no-items.patch @@ -14,10 +14,10 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 91bd27148f5b699b72d56844ded76e0e25e2693c..a4f446eff2a9e7f8ab99b156d0efe45d60e6c575 100644 +index d58a7adb58abc91f66fc893ee7a7a7bded3619a8..af1cee79e27667b78413760286f517c91d1517cb 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -991,7 +991,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -990,7 +990,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } } diff --git a/patches/server/0380-Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/0380-Add-option-to-nerf-pigmen-from-nether-portals.patch index 55f512e264..81b75ba6ad 100644 --- a/patches/server/0380-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/0380-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -21,7 +21,7 @@ index f2e4939c8144b9bc7441130302ab3e2358c42063..3d14a7dbcc6bc46141596a7e04f790bf private void lightQueueSize() { lightQueueSize = getInt("light-queue-size", lightQueueSize); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6084222c0f46534c4cba81fa32478a467114cceb..7e314890b52621f18ff697a545e3e289a0c0d989 100644 +index 80bf2f5e7390bf586b0eab4bac796d32158e1f3f..d7a4fd6ce9d35500a7c6a21b456f5f0a075e43e8 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -328,6 +328,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -32,7 +32,7 @@ index 6084222c0f46534c4cba81fa32478a467114cceb..7e314890b52621f18ff697a545e3e289 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1882,6 +1883,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1881,6 +1882,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); } @@ -42,7 +42,7 @@ index 6084222c0f46534c4cba81fa32478a467114cceb..7e314890b52621f18ff697a545e3e289 // Paper end return nbt; } catch (Throwable throwable) { -@@ -2021,6 +2025,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2020,6 +2024,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status diff --git a/patches/server/0388-Optimise-TickListServer-by-rewriting-it.patch b/patches/server/0388-Optimise-TickListServer-by-rewriting-it.patch index 536def3a19..6ec28b666f 100644 --- a/patches/server/0388-Optimise-TickListServer-by-rewriting-it.patch +++ b/patches/server/0388-Optimise-TickListServer-by-rewriting-it.patch @@ -889,7 +889,7 @@ index 0000000000000000000000000000000000000000..118988c39e58f28e8a2851792b9c014f + } +} diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 5ff96851e7f7c51c365dde0d24da49be6412ab82..55f355d1218ddb3f320752666407151291c0f398 100644 +index edf0432967c4621e101611924c4ce826f54e3e34..413743bc1bf82c07f85192924e4783b08dbcee79 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -86,6 +86,19 @@ public class ChunkHolder { @@ -912,7 +912,7 @@ index 5ff96851e7f7c51c365dde0d24da49be6412ab82..55f355d1218ddb3f3207526664071512 public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); -@@ -547,6 +560,10 @@ public class ChunkHolder { +@@ -544,6 +557,10 @@ public class ChunkHolder { either.ifLeft(chunk -> { // note: Here is a very good place to add callbacks to logic waiting on this. ChunkHolder.this.isTickingReady = true; @@ -924,7 +924,7 @@ index 5ff96851e7f7c51c365dde0d24da49be6412ab82..55f355d1218ddb3f3207526664071512 }); // Paper end diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 77f88e081991e85d03540e30b9def5dac9ad59be..43007f8cc9a88d7e6fb435551edac4d93a5668a9 100644 +index d2d0350bd16cd818be328afcc2c07f4381dac169..0d948d4d247a12a49fae99e68874a9e65bf76a68 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -220,6 +220,12 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0393-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0393-Optimize-Collision-to-not-load-chunks.patch index edd7412b6a..1c1fa709c3 100644 --- a/patches/server/0393-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/0393-Optimize-Collision-to-not-load-chunks.patch @@ -26,7 +26,7 @@ index 2730923bd0bf3b0f928765b9e09e2299fa9a393d..f98a1c32e0c209473cf7268cbd8245ab entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7e314890b52621f18ff697a545e3e289a0c0d989..fa63a52cba5355612ce417f4bb8077a89ce59398 100644 +index d7a4fd6ce9d35500a7c6a21b456f5f0a075e43e8..1a3d6368b84aa24b6d0361dd30bc06b79f1d5133 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -172,6 +172,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -52,7 +52,7 @@ index b980c26ab5cac02e03525177a9dc4fb0b6a2f9f6..2a784a8342e708e0813c7076a2ca8e42 Stream getEntityCollisions(@Nullable Entity entity, AABB box, Predicate predicate); diff --git a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java b/src/main/java/net/minecraft/world/level/CollisionSpliterator.java -index e6190bfb893de12e87e1da49001ebd963b3d6318..7f8a914085e3d89668e8f41fd099e3b77867f03e 100644 +index e6190bfb893de12e87e1da49001ebd963b3d6318..6f4acf1c7c98a6069b79db483b8c79a8f4b46d54 100644 --- a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java +++ b/src/main/java/net/minecraft/world/level/CollisionSpliterator.java @@ -64,21 +64,35 @@ public class CollisionSpliterator extends AbstractSpliterator { @@ -74,7 +74,7 @@ index e6190bfb893de12e87e1da49001ebd963b3d6318..7f8a914085e3d89668e8f41fd099e3b7 - if (blockGetter == null) { + // Paper start - ensure we don't load chunks + boolean far = this.source != null && net.minecraft.server.MCUtil.distanceSq(this.source.getX(), y, this.source.getZ(), x, y, z) > 14; -+ this.pos.setValues(x, y, z); ++ this.pos.set(x, y, z); + + boolean isRegionLimited = this.collisionGetter instanceof net.minecraft.server.level.WorldGenRegion; + BlockState blockState = isRegionLimited ? Blocks.VOID_AIR.defaultBlockState() : ((!far && this.source instanceof net.minecraft.server.level.ServerPlayer) || (this.source != null && this.source.collisionLoadChunks) @@ -99,10 +99,10 @@ index e6190bfb893de12e87e1da49001ebd963b3d6318..7f8a914085e3d89668e8f41fd099e3b7 continue; } diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 5d4d953f197afc402248ab73daeb6ef59134f48f..95428f13dae909bb7de552aa65e4256bd4049c65 100644 +index 5af90e0f7222356cb0e905a9b6e0c4eac5617a41..ee5fa14d2232b145806aefcaffb5c6348a08058a 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -238,7 +238,8 @@ public final class Shapes { +@@ -237,7 +237,8 @@ public final class Shapes { if (s < 3) { mutableBlockPos.set(axisCycle, q, r, p); diff --git a/patches/server/0404-Improved-Watchdog-Support.patch b/patches/server/0404-Improved-Watchdog-Support.patch index 5f586fd128..e71e43b968 100644 --- a/patches/server/0404-Improved-Watchdog-Support.patch +++ b/patches/server/0404-Improved-Watchdog-Support.patch @@ -71,7 +71,7 @@ index bda7137b3435c9b7610be258cefb6b4ac2c1d47a..09f56e49383d3f5413ad4c28f3a7664e cause = cause.getCause(); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 577681733454da4d62cae7199f494a56bab3cfa4..ff17bd6e7ccd82201256a2c3568297c3191b7e1f 100644 +index 44ad235710dce2b159f891d91b7a0d71e5553507..eb82dd9db7fef4b1f0f764ce153439c69c64168b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -301,7 +301,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + net.minecraft.server.level.ChunkHolder updatingChunk = playerChunkMap.getUpdatingChunkIfPresent(pos.toLong()); + if (updatingChunk != null) { -+ return updatingChunk.getEntityTickingFuture(); ++ return updatingChunk.getEntityTickingChunkFuture(); + } else { + return java.util.concurrent.CompletableFuture.completedFuture(chunk); + } @@ -244,7 +244,7 @@ index 3a13c151066c8784fdc844e1d6310f77ff32e7f1..846b0dcee92f71d1c887ea88744c36f6 Iterator iterator = list.iterator(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index fa63a52cba5355612ce417f4bb8077a89ce59398..32323729f913d27170fca0e69346e8d2943089af 100644 +index 1a3d6368b84aa24b6d0361dd30bc06b79f1d5133..4d2209baf88a3f097e0df1645f88d4afd718c414 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1511,7 +1511,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0419-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0419-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 159a1c849c..141d4d875c 100644 --- a/patches/server/0419-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0419-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -7,10 +7,10 @@ The code following this has better support for null worlds to move them back to the world spawn. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 32323729f913d27170fca0e69346e8d2943089af..6bc6800f8ec3900b552c5da910db577649f5d9e0 100644 +index 4d2209baf88a3f097e0df1645f88d4afd718c414..f08c8212f7a07fd10da127c65d4cea76921585e4 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2000,9 +2000,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1999,9 +1999,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n bworld = server.getWorld(worldName); } diff --git a/patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch index 40bd1ce550..f0009be4f8 100644 --- a/patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6bc6800f8ec3900b552c5da910db577649f5d9e0..677124d720105e9bda9d05a1fcc46ce10f44539d 100644 +index f08c8212f7a07fd10da127c65d4cea76921585e4..1307a37848fcf98cfd7ed19a7b746ba57ac88411 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2147,11 +2147,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2146,11 +2146,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { @@ -34,7 +34,7 @@ index 6bc6800f8ec3900b552c5da910db577649f5d9e0..677124d720105e9bda9d05a1fcc46ce1 entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -2894,6 +2895,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2892,6 +2893,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @Nullable public Entity teleportTo(ServerLevel worldserver, BlockPos location) { // CraftBukkit end @@ -47,7 +47,7 @@ index 6bc6800f8ec3900b552c5da910db577649f5d9e0..677124d720105e9bda9d05a1fcc46ce1 if (this.level instanceof ServerLevel && !this.isRemoved()) { this.level.getProfiler().push("changeDimension"); // CraftBukkit start -@@ -2914,6 +2921,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2912,6 +2919,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n // CraftBukkit end this.level.getProfiler().popPush("reloading"); @@ -59,7 +59,7 @@ index 6bc6800f8ec3900b552c5da910db577649f5d9e0..677124d720105e9bda9d05a1fcc46ce1 Entity entity = this.getType().create((Level) worldserver); if (entity != null) { -@@ -2927,10 +2939,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2925,10 +2937,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index 6bc6800f8ec3900b552c5da910db577649f5d9e0..677124d720105e9bda9d05a1fcc46ce1 // CraftBukkit end } -@@ -3055,7 +3063,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3053,7 +3061,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } public boolean canChangeDimensions() { diff --git a/patches/server/0429-Optimize-Voxel-Shape-Merging.patch b/patches/server/0429-Optimize-Voxel-Shape-Merging.patch index 4227b67cdc..2ef4cbd94e 100644 --- a/patches/server/0429-Optimize-Voxel-Shape-Merging.patch +++ b/patches/server/0429-Optimize-Voxel-Shape-Merging.patch @@ -68,10 +68,10 @@ index 9e0afab2329e560c4b2512548dd4b02dd1a2e69f..06662dbff8180751a8684841aa35f709 this.firstIndices = new int[k]; this.secondIndices = new int[k]; diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 95428f13dae909bb7de552aa65e4256bd4049c65..94f58332bb1408971fe65e5fd0401457ab986441 100644 +index ee5fa14d2232b145806aefcaffb5c6348a08058a..18eeb49a4859a8ab9cbef97caf63c0639bc63233 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -337,9 +337,21 @@ public final class Shapes { +@@ -336,9 +336,21 @@ public final class Shapes { } @VisibleForTesting @@ -94,7 +94,7 @@ index 95428f13dae909bb7de552aa65e4256bd4049c65..94f58332bb1408971fe65e5fd0401457 if (first instanceof CubePointRange && second instanceof CubePointRange) { long l = lcm(i, j); if ((long)size * l <= 256L) { -@@ -347,13 +359,22 @@ public final class Shapes { +@@ -346,13 +358,22 @@ public final class Shapes { } } diff --git a/patches/server/0442-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/0442-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 50ff7129e4..e149fbb05b 100644 --- a/patches/server/0442-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/patches/server/0442-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -56,7 +56,7 @@ index cdf214fca3b0055efa56702470d9d2f890a8aead..a12af10e28f2d023ba6f916b5e7a5353 this.level.getProfiler().push("explosion_blocks"); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 738656ea69dc3c3d84f5be4799fc48e837e52ea3..ce5bccd6d76252309e16b946c44674f4cf74450d 100644 +index c84070d05d325a8f49c3918cc112087b9c1074e9..81c107edb59b2068bdc78617a5ca54aa15f15c0f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -424,6 +424,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -95,7 +95,7 @@ index 27016f964d2f6458298a9052d031a44b3d9f5f4b..878cdfc49253e7916d038495f79fec7c public co.aikar.timings.Timing getTiming() { if (timing == null) { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index c345bd7542f3ffa09719864887e1516f1182e7e3..44cc09006eac6315d167a2628857f9942eb1fc13 100644 +index c345bd7542f3ffa09719864887e1516f1182e7e3..4eac07022a7d896ee8921afa6d35cba7f0c89941 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java @@ -200,6 +200,12 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -128,7 +128,7 @@ index c345bd7542f3ffa09719864887e1516f1182e7e3..44cc09006eac6315d167a2628857f994 + // Paper start - fix headless pistons breaking blocks + BlockPos headPos = pos.relative(enumdirection); + if (com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits || world.getBlockState(headPos) == Blocks.PISTON_HEAD.defaultBlockState().setValue(FACING, enumdirection)) { // double check to make sure we're not a headless piston. -+ world.setAir(headPos, false); ++ world.removeBlock(headPos, false); + } else { + ((ServerLevel)world).getChunkSource().blockChanged(headPos); // ... fix client desync + } @@ -137,7 +137,7 @@ index c345bd7542f3ffa09719864887e1516f1182e7e3..44cc09006eac6315d167a2628857f994 world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index d99ca942f5885b4d9af054547832c05ddb5634eb..6d4ef15842c6bd230543de19dd1053a4fe6ad270 100644 +index 6a3b6611954e07760d586e2dc8c2015cfae7c0a5..736e38a6ee3dc36ed886d047484bda9516845324 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -206,7 +206,7 @@ public abstract class BlockBehaviour { diff --git a/patches/server/0455-incremental-chunk-saving.patch b/patches/server/0455-incremental-chunk-saving.patch index 7a697c69fa..7f1213a6c5 100644 --- a/patches/server/0455-incremental-chunk-saving.patch +++ b/patches/server/0455-incremental-chunk-saving.patch @@ -31,7 +31,7 @@ index 9e5810eb0085ad956f0bd1cd69fa88909d9d638a..77e90a6b7d29ad989fd961e00a6fd97c config.addDefault("world-settings.default." + path, def); return config.getBoolean("world-settings." + worldName + "." + path, config.getBoolean("world-settings.default." + path)); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0e6ec02b011eee8c75ddc6f7db254df735be8e91..a465baa097339a5f661c2c331cbd3cbe854e53b2 100644 +index 407f18a9c7a688eaac8ad7018ae4f1a5fc628379..9f80206f966689b79df4e3b9b82ef9f4d2170bfe 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -300,6 +300,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 100) { // Spigot diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 948a817a1d6f4435655931357aa094b889771e82..88c7ae09e29a32309bf2a63ac0593b42d3fe6a42 100644 +index 38b624e5817f5b2ce70da777b2bb834784de914f..87319eadeba490bdfd0783cacd33e3ec1dcba302 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -111,6 +111,8 @@ public class ChunkHolder { @@ -84,7 +84,7 @@ index 948a817a1d6f4435655931357aa094b889771e82..88c7ae09e29a32309bf2a63ac0593b42 public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); -@@ -533,7 +535,19 @@ public class ChunkHolder { +@@ -530,7 +532,19 @@ public class ChunkHolder { boolean flag2 = playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER); boolean flag3 = playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER); @@ -104,7 +104,7 @@ index 948a817a1d6f4435655931357aa094b889771e82..88c7ae09e29a32309bf2a63ac0593b42 if (!flag2 && flag3) { int expectCreateCount = ++this.fullChunkCreateCount; // Paper this.fullChunkFuture = chunkStorage.prepareAccessibleChunk(this); -@@ -654,9 +668,33 @@ public class ChunkHolder { +@@ -651,9 +665,33 @@ public class ChunkHolder { } public void refreshAccessibility() { @@ -139,7 +139,7 @@ index 948a817a1d6f4435655931357aa094b889771e82..88c7ae09e29a32309bf2a63ac0593b42 for (int i = 0; i < this.futures.length(); ++i) { CompletableFuture> completablefuture = (CompletableFuture) this.futures.get(i); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 0b2329d9ab2040e0793c7920307474c347c3117e..3464593f1c1af6c6b36549496bc85f2e51655ccf 100644 +index 36a9c0e442aa811dd85cede375640e0610197aa6..8d97e0a38a1cf6fcbc458654e2e85a8eb6033dd9 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -97,6 +97,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana @@ -240,7 +240,7 @@ index 0b2329d9ab2040e0793c7920307474c347c3117e..3464593f1c1af6c6b36549496bc85f2e ChunkPos chunkcoordintpair = chunk.getPos(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 135d162a926bd258d2aa001b7d0ef880fd3f2fb9..334f1ad2a5ce236b58a82b1ef2e143eaa3909f12 100644 +index 147f6fd5174a2c489dfb7ea2ce2d2dc7dacfb89d..6c565751c36daa0084196dce5d2f82df64a0c77a 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -672,6 +672,15 @@ public class ServerChunkCache extends ChunkSource { @@ -314,7 +314,7 @@ index a857953f3488e79fd601ac63881bc4d87708afa7..3cf3b0486f786d7d043cce75767753e1 default boolean generateFlatBedrock() { if (this instanceof ProtoChunk) { 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 cc72c5c7e63794974080648abc94646819ea0924..199efaefef890d2695682cc695b02c6ca3f971e2 100644 +index 61c70e17401ec85c0a7e6e1793f6689506b8059a..d866997b974b971245111cac43ac6edf92052de4 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -108,6 +108,13 @@ public class LevelChunk implements ChunkAccess { diff --git a/patches/server/0466-Ensure-Entity-AABB-s-are-never-invalid.patch b/patches/server/0466-Ensure-Entity-AABB-s-are-never-invalid.patch index 43eef5df59..b2e65a5bbd 100644 --- a/patches/server/0466-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/patches/server/0466-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index fe4b09f82d36e5d7e109c86e8f4c003e92ba4e9d..8aeb00440e90f3f72d5c6fde35b4067ebc452f2f 100644 +index 40fe3766bfe06fe15d258d3fc88fb179d2bb5d05..dcc128fdf45b23fe07a20136f498ead2ac6ee4a7 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -560,7 +560,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -17,7 +17,7 @@ index fe4b09f82d36e5d7e109c86e8f4c003e92ba4e9d..8aeb00440e90f3f72d5c6fde35b4067e } protected AABB makeBoundingBox() { -@@ -3737,6 +3737,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3735,6 +3735,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } public final void setPosRaw(double x, double y, double z) { diff --git a/patches/server/0467-Optimize-WorldBorder-collision-checks-and-air.patch b/patches/server/0467-Optimize-WorldBorder-collision-checks-and-air.patch index 729bb94ec1..f697f935f8 100644 --- a/patches/server/0467-Optimize-WorldBorder-collision-checks-and-air.patch +++ b/patches/server/0467-Optimize-WorldBorder-collision-checks-and-air.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize WorldBorder collision checks and air diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8aeb00440e90f3f72d5c6fde35b4067ebc452f2f..7bfd4d85f5af889f6d6e13087331af12ea141238 100644 +index dcc128fdf45b23fe07a20136f498ead2ac6ee4a7..895c4d0f8f6b829de426543c51181a88a1fd340f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1044,7 +1044,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -18,7 +18,7 @@ index 8aeb00440e90f3f72d5c6fde35b4067ebc452f2f..7bfd4d85f5af889f6d6e13087331af12 return true; }); diff --git a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java b/src/main/java/net/minecraft/world/level/CollisionSpliterator.java -index 7f8a914085e3d89668e8f41fd099e3b77867f03e..b7ba467d0a0c59e64cd5c1d562414b1dcc3e7df8 100644 +index 6f4acf1c7c98a6069b79db483b8c79a8f4b46d54..e420c98d9ccc45d570984dc30fdb928883edec9f 100644 --- a/src/main/java/net/minecraft/world/level/CollisionSpliterator.java +++ b/src/main/java/net/minecraft/world/level/CollisionSpliterator.java @@ -133,9 +133,10 @@ public class CollisionSpliterator extends AbstractSpliterator { @@ -36,10 +36,10 @@ index 7f8a914085e3d89668e8f41fd099e3b77867f03e..b7ba467d0a0c59e64cd5c1d562414b1d } } diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 94f58332bb1408971fe65e5fd0401457ab986441..ceeec68fba8dacdc5b023c8817a6863b28c0e132 100644 +index 18eeb49a4859a8ab9cbef97caf63c0639bc63233..16bc18cacbf7a23fb744c8a12e7fd8da699b2fea 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -240,7 +240,7 @@ public final class Shapes { +@@ -239,7 +239,7 @@ public final class Shapes { mutableBlockPos.set(axisCycle, q, r, p); BlockState blockState = world.getTypeIfLoaded(mutableBlockPos); // Paper if (blockState == null) return 0.0D; // Paper diff --git a/patches/server/0473-Support-old-UUID-format-for-NBT.patch b/patches/server/0473-Support-old-UUID-format-for-NBT.patch index f7713f9782..f7ac9b6542 100644 --- a/patches/server/0473-Support-old-UUID-format-for-NBT.patch +++ b/patches/server/0473-Support-old-UUID-format-for-NBT.patch @@ -8,12 +8,12 @@ We have stored UUID in plenty of places that did not get DFU'd So just look for old format and load it if it exists. diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index c25d605e7cd59ffd69d60d53c145c531e092cdb3..cb2a9b262a918b9c410fcfd9d25e85109dbb1ba0 100644 +index 5456387ade8932fb0d9804abe0fd66f1c565e1ae..7199be3b9c00c66f452e92ad35795017112f1658 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -121,6 +121,12 @@ public class CompoundTag implements Tag { +@@ -120,6 +120,12 @@ public class CompoundTag implements Tag { + } - @Deprecated public void setUUID(String prefix, UUID uuid) { putUUID(prefix, uuid); } // Paper - OBFHELPER public void putUUID(String key, UUID value) { + // Paper start - support old format + if (this.contains(key + "Most", 99) && this.contains(key + "Least", 99)) { @@ -24,7 +24,7 @@ index c25d605e7cd59ffd69d60d53c145c531e092cdb3..cb2a9b262a918b9c410fcfd9d25e8510 this.tags.put(key, NbtUtils.createUUID(value)); } -@@ -129,10 +135,20 @@ public class CompoundTag implements Tag { +@@ -128,10 +134,20 @@ public class CompoundTag implements Tag { * You must use {@link #hasUUID(String)} before or else it will throw an NPE. */ public UUID getUUID(String key) { diff --git a/patches/server/0487-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/patches/server/0487-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index f455026312..ba0b28f724 100644 --- a/patches/server/0487-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/patches/server/0487-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -68,7 +68,7 @@ index 18ae2e2b339d357fbe0f6f2b18bc14c0dfe4c222..3b7ba9c755c82a6f086d5542d32b3567 } diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 4d82abf234f67af124dff3f726a6a2e39313a780..e2e01012b4a40bb2a63d780c50d7567b173d5e41 100644 +index 2d5b8e35d52b0dfd075af81a3a936d8a21053b31..9ddedd310eb0323a5a09f51a61bfb7b36503be93 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -671,6 +671,7 @@ public final class MCUtil { @@ -80,7 +80,7 @@ index 4d82abf234f67af124dff3f726a6a2e39313a780..e2e01012b4a40bb2a63d780c50d7567b chunkData.addProperty("queued-for-unload", chunkMap.toDrop.contains(playerChunk.pos.longKey)); chunkData.addProperty("status", status == null ? "unloaded" : status.toString()); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 88c7ae09e29a32309bf2a63ac0593b42d3fe6a42..914678af675be57fecc92189c709da971b8b0ae8 100644 +index 87319eadeba490bdfd0783cacd33e3ec1dcba302..f9207e3661ba630ee1791d0842e0de684b22fd17 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -60,7 +60,7 @@ public class ChunkHolder { @@ -235,7 +235,7 @@ index 88c7ae09e29a32309bf2a63ac0593b42d3fe6a42..914678af675be57fecc92189c709da97 // Paper start - optimise isOutsideOfRange // cached here to avoid a map lookup com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet playersInMobSpawnRange; -@@ -488,7 +617,7 @@ public class ChunkHolder { +@@ -485,7 +614,7 @@ public class ChunkHolder { // CraftBukkit start // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins. if (playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { @@ -244,7 +244,7 @@ index 88c7ae09e29a32309bf2a63ac0593b42d3fe6a42..914678af675be57fecc92189c709da97 LevelChunk chunk = (LevelChunk)either.left().orElse(null); if (chunk != null) { chunkStorage.callbackExecutor.execute(() -> { -@@ -553,13 +682,14 @@ public class ChunkHolder { +@@ -550,13 +679,14 @@ public class ChunkHolder { this.fullChunkFuture = chunkStorage.prepareAccessibleChunk(this); this.scheduleFullChunkPromotion(chunkStorage, this.fullChunkFuture, executor, ChunkHolder.FullChunkStatus.BORDER); // Paper start - cache ticking ready status @@ -260,7 +260,7 @@ index 88c7ae09e29a32309bf2a63ac0593b42d3fe6a42..914678af675be57fecc92189c709da97 } }); this.updateChunkToSave(this.fullChunkFuture, "full"); -@@ -583,7 +713,7 @@ public class ChunkHolder { +@@ -580,7 +710,7 @@ public class ChunkHolder { this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this); this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING); // Paper start - cache ticking ready status @@ -269,7 +269,7 @@ index 88c7ae09e29a32309bf2a63ac0593b42d3fe6a42..914678af675be57fecc92189c709da97 either.ifLeft(chunk -> { // note: Here is a very good place to add callbacks to logic waiting on this. ChunkHolder.this.isTickingReady = true; -@@ -613,7 +743,7 @@ public class ChunkHolder { +@@ -610,7 +740,7 @@ public class ChunkHolder { this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this.pos); this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING); // Paper start - cache ticking ready status @@ -278,7 +278,7 @@ index 88c7ae09e29a32309bf2a63ac0593b42d3fe6a42..914678af675be57fecc92189c709da97 either.ifLeft(chunk -> { ChunkHolder.this.isEntityTickingReady = true; }); -@@ -631,12 +761,30 @@ public class ChunkHolder { +@@ -628,12 +758,30 @@ public class ChunkHolder { this.demoteFullChunk(chunkStorage, playerchunk_state1); } @@ -312,7 +312,7 @@ index 88c7ae09e29a32309bf2a63ac0593b42d3fe6a42..914678af675be57fecc92189c709da97 if (chunk != null) { chunkStorage.callbackExecutor.execute(() -> { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 3464593f1c1af6c6b36549496bc85f2e51655ccf..b92eaa44434e2ee368b90d43f322cb8601d159bb 100644 +index 8d97e0a38a1cf6fcbc458654e2e85a8eb6033dd9..15dba7f2e6a7c670b415f67345fad37873a1130c 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -149,6 +149,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -427,7 +427,7 @@ index 3464593f1c1af6c6b36549496bc85f2e51655ccf..b92eaa44434e2ee368b90d43f322cb86 + // Prioritize circular near + double playerChunkX = Mth.floor(player.getX()) >> 4; + double playerChunkZ = Mth.floor(player.getZ()) >> 4; -+ pos.setValues(player.getX(), 0, player.getZ()); ++ pos.set(player.getX(), 0, player.getZ()); + double twoThirdModifier = 2D / 3D; + MCUtil.getSpiralOutChunks(pos, Math.min(6, viewDistance)).forEach(coord -> { + if (shouldSkipPrioritization(coord)) return; @@ -445,7 +445,7 @@ index 3464593f1c1af6c6b36549496bc85f2e51655ccf..b92eaa44434e2ee368b90d43f322cb86 + + // Prioritize Frustum near 3 + ChunkPos front3 = player.getChunkInFront(3); -+ pos.setValues(front3.x << 4, 0, front3.z << 4); ++ pos.set(front3.x << 4, 0, front3.z << 4); + MCUtil.getSpiralOutChunks(pos, Math.min(5, viewDistance)).forEach(coord -> { + if (shouldSkipPrioritization(coord)) return; + @@ -456,7 +456,7 @@ index 3464593f1c1af6c6b36549496bc85f2e51655ccf..b92eaa44434e2ee368b90d43f322cb86 + // Prioritize Frustum near 5 + if (viewDistance > 4) { + ChunkPos front5 = player.getChunkInFront(5); -+ pos.setValues(front5.x << 4, 0, front5.z << 4); ++ pos.set(front5.x << 4, 0, front5.z << 4); + MCUtil.getSpiralOutChunks(pos, 4).forEach(coord -> { + if (shouldSkipPrioritization(coord)) return; + @@ -468,7 +468,7 @@ index 3464593f1c1af6c6b36549496bc85f2e51655ccf..b92eaa44434e2ee368b90d43f322cb86 + // Prioritize Frustum far 7 + if (viewDistance > 6) { + ChunkPos front7 = player.getChunkInFront(7); -+ pos.setValues(front7.x << 4, 0, front7.z << 4); ++ pos.set(front7.x << 4, 0, front7.z << 4); + MCUtil.getSpiralOutChunks(pos, 3).forEach(coord -> { + if (shouldSkipPrioritization(coord)) { + return; @@ -559,7 +559,7 @@ index 3464593f1c1af6c6b36549496bc85f2e51655ccf..b92eaa44434e2ee368b90d43f322cb86 } diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index d94241bcca4f2fd5e464a860bd356af504dc68b7..e82dcc43ae03c31e9e3ec31dbcfecfde64bd407a 100644 +index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a263d2676 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java @@ -98,6 +98,7 @@ public abstract class DistanceManager { @@ -878,16 +878,16 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..e82dcc43ae03c31e9e3ec31dbcfecfde + ServerPlayer player = (ServerPlayer) backingSet[index]; + + ChunkPos pointInFront = player.getChunkInFront(5); -+ pos.setValues(pointInFront.x << 4, 0, pointInFront.z << 4); ++ pos.set(pointInFront.x << 4, 0, pointInFront.z << 4); + double frontDist = net.minecraft.server.MCUtil.distanceSq(pos, blockPos); + -+ pos.setValues(player.getX(), 0, player.getZ()); ++ pos.set(player.getX(), 0, player.getZ()); + double center = net.minecraft.server.MCUtil.distanceSq(pos, blockPos); + + double dist = Math.min(frontDist, center); + if (!isFront) { + ChunkPos pointInBack = player.getChunkInFront(-7); -+ pos.setValues(pointInBack.x << 4, 0, pointInBack.z << 4); ++ pos.set(pointInBack.x << 4, 0, pointInBack.z << 4); + double backDist = net.minecraft.server.MCUtil.distanceSq(pos, blockPos); + if (frontDist < backDist) { + isFront = true; @@ -941,7 +941,7 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..e82dcc43ae03c31e9e3ec31dbcfecfde } } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 334f1ad2a5ce236b58a82b1ef2e143eaa3909f12..c0bbb1acd7d83a70c9f2c34f7d19cea0039e0567 100644 +index 6c565751c36daa0084196dce5d2f82df64a0c77a..0b22fd8ac75146bc7b647cfbefc73ce890ccb033 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -446,6 +446,26 @@ public class ServerChunkCache extends ChunkSource { @@ -1027,7 +1027,7 @@ index 334f1ad2a5ce236b58a82b1ef2e143eaa3909f12..c0bbb1acd7d83a70c9f2c34f7d19cea0 boolean flag1 = this.chunkMap.promoteChunkMap(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 384f38b3c7dd030f107991137912866ae045f811..29df08d378363d57508dc654a129c60bc38ad21b 100644 +index 1197322df389f9fdc891760230e18950f7295fc1..6acf0fb29261ba005562127894438797d5853573 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -183,6 +183,14 @@ public class ServerPlayer extends Player { @@ -1113,7 +1113,7 @@ index fb010fb253f490a79e9172d7a3d017ad51dac958..3e91275b318904ffa31183987fcbc7b2 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 247d4959c67d41d2f4995c2e19f4c652e97694f5..f452cddd312793465dedb29c4e52d1c4dd1b4360 100644 +index cd31cc4f8d25e95792c4a2690e3a8df17edc406f..576541b061d792a24eaa30df57d00a2945a3ee1f 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -283,8 +283,8 @@ public abstract class PlayerList { @@ -1126,7 +1126,7 @@ index 247d4959c67d41d2f4995c2e19f4c652e97694f5..f452cddd312793465dedb29c4e52d1c4 + worldserver1.getChunkSource().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> { // Paper - Chunk priority net.minecraft.server.level.ChunkHolder updatingChunk = playerChunkMap.getUpdatingChunkIfPresent(pos.toLong()); if (updatingChunk != null) { - return updatingChunk.getEntityTickingFuture(); + return updatingChunk.getEntityTickingChunkFuture(); @@ -697,6 +697,7 @@ public abstract class PlayerList { SocketAddress socketaddress = loginlistener.connection.getRemoteAddress(); @@ -1144,7 +1144,7 @@ index 247d4959c67d41d2f4995c2e19f4c652e97694f5..f452cddd312793465dedb29c4e52d1c4 entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2a0f72b98d025f1f140d9118937d41e7b172be60..0fd3d689b80484339f437525130bc34de2e71e54 100644 +index c0f7b78dbe8f9baf68aa48dd763ab51312e916c6..73c81f0883645dca0ce32efae914d7f40b265c3c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -223,7 +223,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n diff --git a/patches/server/0513-Buffer-joins-to-world.patch b/patches/server/0513-Buffer-joins-to-world.patch index 139ee8a613..665ef6d846 100644 --- a/patches/server/0513-Buffer-joins-to-world.patch +++ b/patches/server/0513-Buffer-joins-to-world.patch @@ -22,7 +22,7 @@ index faa1b775e45563b93ac1d5b904938b1f5ad8d80c..545948f20efd6c8dd42140b565af94cd + } } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 7607bf75968cc32d616e2b44e89901b3681b1131..d32b96a5f51d745869cfc40c01c54de58e1eb843 100644 +index 34c642a9439faec095c58c6017a0dfd4b35a2401..01b9c360c6d687c6a774bf3375802be487cb0e0c 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -37,6 +37,7 @@ import net.minecraft.network.protocol.Packet; @@ -49,7 +49,7 @@ index 7607bf75968cc32d616e2b44e89901b3681b1131..d32b96a5f51d745869cfc40c01c54de5 + } + // Paper end if (this.packetListener instanceof ServerLoginPacketListenerImpl) { -+ if ( ((ServerLoginPacketListenerImpl) this.packetListener).getLoginState() != ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper ++ if ( ((ServerLoginPacketListenerImpl) this.packetListener).state != ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper + || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick ((ServerLoginPacketListenerImpl) this.packetListener).tick(); + } // Paper diff --git a/patches/server/0514-Optimize-redstone-algorithm.patch b/patches/server/0514-Optimize-redstone-algorithm.patch index 11885443f3..5cf1627b1d 100644 --- a/patches/server/0514-Optimize-redstone-algorithm.patch +++ b/patches/server/0514-Optimize-redstone-algorithm.patch @@ -41,7 +41,7 @@ index 2252b9f36ea22a655592c6f176d18b70b7440e4e..8504f4dcfca35c8fe8e266af59762edd keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); 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 0000000000000000000000000000000000000000..3728979e290ab031c9fe9eeb19a0f98d2ce566db +index 0000000000000000000000000000000000000000..d4273df8124d9d6d4a122f5ecef6f3d011da5860 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java @@ -0,0 +1,913 @@ @@ -368,7 +368,7 @@ index 0000000000000000000000000000000000000000..3728979e290ab031c9fe9eeb19a0f98d + if (!wire.canSurvive(null, worldIn, pos)) { + // Pop off the redstone dust + Block.popResource(worldIn, pos, new ItemStack(Items.REDSTONE)); // TODO -+ worldIn.setAir(pos); ++ worldIn.removeBlock(pos, false); + + // Mark this position as not being redstone wire + upd1.type = UpdateNode.Type.OTHER; diff --git a/patches/server/0526-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch b/patches/server/0526-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch index 23616633b3..b9545882f0 100644 --- a/patches/server/0526-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch +++ b/patches/server/0526-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086) diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 779b230c18316242f4322d55b8b28900ca793dac..d51a639fe855d73293cdf322671a8ea643a29cd9 100644 +index 2d81fce2f5d9320b4cc9310fd0428b96318c7237..84f179b5df2e7106913bd17e5f9e5fdd484bce10 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -382,6 +382,7 @@ public class ChunkHolder { +@@ -379,6 +379,7 @@ public class ChunkHolder { } public void blockChanged(BlockPos pos) { diff --git a/patches/server/0527-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0527-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 9bcca52524..20f3d13f13 100644 --- a/patches/server/0527-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0527-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b2e6426b9d8bcc860f83c3b79577bbc1cdb278db..c584868110ef03c721087cd7eaf454bded763477 100644 +index 3bf989fe94d53088ae058c19adde652267a231d0..f4eb377c0a09dcb24d2d7e49aa0bc18c5817f073 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3924,4 +3924,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3922,4 +3922,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n void accept(Entity entity, double x, double y, double z); } @@ -21,7 +21,7 @@ index b2e6426b9d8bcc860f83c3b79577bbc1cdb278db..c584868110ef03c721087cd7eaf454bd + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 62b5070f9645fec91d016988f0f2262fd61e2e89..cd51115b7c56e7eeab1248f39a690fc91524efd7 100644 +index 736cbdc118b7a19b724a3afd433927e8e8316d23..a6250143baced61e87900181f8b37cfd89c717ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -443,6 +443,10 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0529-Entity-isTicking.patch b/patches/server/0529-Entity-isTicking.patch index 07ae9ae61a..6c3023fa5a 100644 --- a/patches/server/0529-Entity-isTicking.patch +++ b/patches/server/0529-Entity-isTicking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c584868110ef03c721087cd7eaf454bded763477..13dca15a70d7eb4d4330509727a2e34dec25f74c 100644 +index f4eb377c0a09dcb24d2d7e49aa0bc18c5817f073..4ba0b06229f98a690162d486befee8fb65e23699 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -52,6 +52,7 @@ import net.minecraft.resources.ResourceKey; @@ -16,7 +16,7 @@ index c584868110ef03c721087cd7eaf454bded763477..13dca15a70d7eb4d4330509727a2e34d import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.TicketType; -@@ -3929,5 +3930,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3927,5 +3928,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n public static int nextEntityId() { return ENTITY_COUNTER.incrementAndGet(); } @@ -27,7 +27,7 @@ index c584868110ef03c721087cd7eaf454bded763477..13dca15a70d7eb4d4330509727a2e34d // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 5929caf68b37470298012fd48dd1b62b005fdf89..281d9ff8c7741d44131743271046af07d34ba21d 100644 +index 3c3614f0f8af3fb2c593dd1154bd64c70713a42e..8246ad7ebecdfc0b7519fe4412fef7b07407e850 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1202,5 +1202,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0531-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch b/patches/server/0531-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch index dd557811c7..be2c3cfe66 100644 --- a/patches/server/0531-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch +++ b/patches/server/0531-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix CME on adding a passenger in CreatureSpawnEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 13dca15a70d7eb4d4330509727a2e34dec25f74c..2822105ba88e8fa155147b2529daea70f56d509b 100644 +index 4ba0b06229f98a690162d486befee8fb65e23699..bf9813eee5865e7363fce3c015a3b8e3e637ce75 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3433,7 +3433,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3431,7 +3431,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } private Stream getIndirectPassengersStream() { diff --git a/patches/server/0561-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0561-Climbing-should-not-bypass-cramming-gamerule.patch index beca324b8e..eac5222942 100644 --- a/patches/server/0561-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0561-Climbing-should-not-bypass-cramming-gamerule.patch @@ -21,10 +21,10 @@ index 935bb237f8ecd63ca4cec64a7c7a341c9d3358e5..208690ceca2485b54acde5123ba494d7 private void keepLoadedRange() { keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2822105ba88e8fa155147b2529daea70f56d509b..9c1b44e45fe9ee1f044e8413002ff4b7c019cfd8 100644 +index bf9813eee5865e7363fce3c015a3b8e3e637ce75..408d0f51353c745cbdc5c314dd25fa0c8a13441c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1724,6 +1724,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1723,6 +1723,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } public boolean isPushable() { @@ -61,7 +61,7 @@ index 8fb89326395a7e70982c0d757b506565e98b12a4..a060cca08631fb42041e3a79a9abc422 } else if (entity.level.isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) { return false; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5bba20d869463ec859ae7ac1904da7b42b98309a..6af985b2eba28d3a694afe663e1d76628add940c 100644 +index a524ea7ff8206036de07d24683adadee8bd41eac..34304fd25a73b3b7e4f078e85b6bee94ab2cc8c8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3271,7 +3271,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0568-MC-4-Fix-item-position-desync.patch b/patches/server/0568-MC-4-Fix-item-position-desync.patch index b677984eb3..1f7bf6b5a7 100644 --- a/patches/server/0568-MC-4-Fix-item-position-desync.patch +++ b/patches/server/0568-MC-4-Fix-item-position-desync.patch @@ -41,10 +41,10 @@ index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f9 public Vec3 updateEntityPosition(Vec3 orig) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9c1b44e45fe9ee1f044e8413002ff4b7c019cfd8..6186a21bd2f6816216c07e18b2eef165ee7bbd32 100644 +index 408d0f51353c745cbdc5c314dd25fa0c8a13441c..879cadfd1fe96059e621c625adef1673a41ac5dc 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3751,6 +3751,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3749,6 +3749,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } public final void setPosRaw(double x, double y, double z) { diff --git a/patches/server/0601-Collision-option-for-requiring-a-player-participant.patch b/patches/server/0601-Collision-option-for-requiring-a-player-participant.patch index b0b93f0dd7..a88561dba9 100644 --- a/patches/server/0601-Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/0601-Collision-option-for-requiring-a-player-participant.patch @@ -28,10 +28,10 @@ index 4227e7fc46e22265316b42bbdb166d60e5aed94e..3d16e4a6bf842a209c760fd89f8edf99 public int wanderingTraderSpawnDayTicks = 24000; public int wanderingTraderSpawnChanceFailureIncrement = 25; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6186a21bd2f6816216c07e18b2eef165ee7bbd32..145b0205b9777c21f51b24022b2d7a127c26fa0f 100644 +index 879cadfd1fe96059e621c625adef1673a41ac5dc..c696beff4211266e93026464ba9af5a5d4342e4f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1607,6 +1607,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1606,6 +1606,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n public void push(Entity entity) { if (!this.isPassengerOfSameVehicle(entity)) { if (!entity.noPhysics && !this.noPhysics) { diff --git a/patches/server/0634-Add-worldborder-events.patch b/patches/server/0634-Add-worldborder-events.patch index 1af06a9e0e..2d18fe0db7 100644 --- a/patches/server/0634-Add-worldborder-events.patch +++ b/patches/server/0634-Add-worldborder-events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add worldborder events diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -index dd49122fada9729a44fc040ffa1f57eb6ac5a124..6028e65c7e5afeea87f14edb16415defe89ebffa 100644 +index c2c54dc4bbfe469f2b8c751012b93d5e728936d6..1e1a9102e067762c9d1bd091388f108ef8170989 100644 --- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java +++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -@@ -109,15 +109,19 @@ public class WorldBorder { +@@ -108,15 +108,19 @@ public class WorldBorder { } public void setCenter(double x, double z) { @@ -31,7 +31,7 @@ index dd49122fada9729a44fc040ffa1f57eb6ac5a124..6028e65c7e5afeea87f14edb16415def } } -@@ -135,25 +139,43 @@ public class WorldBorder { +@@ -134,25 +138,43 @@ public class WorldBorder { } public void setSize(double size) { @@ -79,7 +79,7 @@ index dd49122fada9729a44fc040ffa1f57eb6ac5a124..6028e65c7e5afeea87f14edb16415def } } -@@ -458,6 +480,7 @@ public class WorldBorder { +@@ -457,6 +479,7 @@ public class WorldBorder { @Override public WorldBorder.BorderExtent update() { diff --git a/patches/server/0649-fix-cancelling-block-falling-causing-client-desync.patch b/patches/server/0649-fix-cancelling-block-falling-causing-client-desync.patch index df9575038c..a77761710b 100644 --- a/patches/server/0649-fix-cancelling-block-falling-causing-client-desync.patch +++ b/patches/server/0649-fix-cancelling-block-falling-causing-client-desync.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix cancelling block falling causing client desync diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 5d89acffe7df54b79733bebba342ea694339ac4b..970c53ff78ed82bb7ec1f981d0fd5cbd72de7bf8 100644 +index 5d89acffe7df54b79733bebba342ea694339ac4b..edc6126d45b0cf1918c5722c34ea6fea977ed293 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -119,8 +119,18 @@ public class FallingBlockEntity extends Entity { @@ -23,7 +23,7 @@ index 5d89acffe7df54b79733bebba342ea694339ac4b..970c53ff78ed82bb7ec1f981d0fd5cbd + this.discard(); + return; + } else { -+ this.level.setAir(blockposition, false); ++ this.level.removeBlock(blockposition, false); + } + // Paper end - fix cancelling block falling causing client desync } else if (!this.level.isClientSide) { diff --git a/patches/server/0678-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/0678-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index 7a0c9f8eb4..5c6a3cc1b7 100644 --- a/patches/server/0678-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/server/0678-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -44,7 +44,7 @@ index 6b4163f5601a0961055c8451ec7ef2204938cf69..c54a37516ef1d8a76f7161917bf44812 @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack) { diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index 6dbf806b5984ae16e747dce350c7cffcf0b190ad..f17ed24cee2ac9a9ba5d9a02c1cf8c92ee7fe8db 100644 +index 460a848bd2a417d05a0bbb084371c98b661a427f..67f2d2f45138578646920ccae5b455a842a7b9e8 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -145,7 +145,7 @@ public class Phantom extends FlyingMob implements Enemy { @@ -66,7 +66,7 @@ index 6dbf806b5984ae16e747dce350c7cffcf0b190ad..f17ed24cee2ac9a9ba5d9a02c1cf8c92 @@ -190,6 +191,7 @@ public class Phantom extends FlyingMob implements Enemy { if (this.spawningEntity != null) { - nbt.setUUID("Paper.SpawningEntity", this.spawningEntity); + nbt.putUUID("Paper.SpawningEntity", this.spawningEntity); } + nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper end diff --git a/patches/server/0699-Synchronize-PalettedContainer-instead-of-ReentrantLo.patch b/patches/server/0699-Synchronize-PalettedContainer-instead-of-ReentrantLo.patch index 65c6717bb4..117a3dfebe 100644 --- a/patches/server/0699-Synchronize-PalettedContainer-instead-of-ReentrantLo.patch +++ b/patches/server/0699-Synchronize-PalettedContainer-instead-of-ReentrantLo.patch @@ -13,7 +13,7 @@ contention situations. And this is extremely a low contention situation. diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 66175691af9417275dee33bbc07c6826e807d571..79a6f43f6aa37362990b403695fcdd13f1a2a3ec 100644 +index 4a6981f8bacdeca1069e1ddfe44ac9c4217ce624..f2307f81c399867585ffdefc0db835c6f5e2f42a 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -37,16 +37,18 @@ public class PalettedContainer implements PaletteResize { @@ -36,7 +36,7 @@ index 66175691af9417275dee33bbc07c6826e807d571..79a6f43f6aa37362990b403695fcdd13 } // Paper start - Anti-Xray - Add predefined objects -@@ -134,7 +136,7 @@ public class PalettedContainer implements PaletteResize { +@@ -133,7 +135,7 @@ public class PalettedContainer implements PaletteResize { return this.palette.idFor(objectAdded); } @@ -45,7 +45,7 @@ index 66175691af9417275dee33bbc07c6826e807d571..79a6f43f6aa37362990b403695fcdd13 Object var6; try { this.acquire(); -@@ -158,7 +160,7 @@ public class PalettedContainer implements PaletteResize { +@@ -157,7 +159,7 @@ public class PalettedContainer implements PaletteResize { return (T)(object == null ? this.defaultValue : object); } @@ -54,7 +54,7 @@ index 66175691af9417275dee33bbc07c6826e807d571..79a6f43f6aa37362990b403695fcdd13 try { this.acquire(); this.set(getIndex(i, j, k), object); -@@ -182,7 +184,7 @@ public class PalettedContainer implements PaletteResize { +@@ -181,7 +183,7 @@ public class PalettedContainer implements PaletteResize { return (T)(object == null ? this.defaultValue : object); } @@ -63,7 +63,7 @@ index 66175691af9417275dee33bbc07c6826e807d571..79a6f43f6aa37362990b403695fcdd13 try { this.acquire(); int i = buf.readByte(); -@@ -203,7 +205,7 @@ public class PalettedContainer implements PaletteResize { +@@ -201,7 +203,7 @@ public class PalettedContainer implements PaletteResize { @Deprecated public void write(FriendlyByteBuf buf) { write(buf, null, 0); } @@ -72,7 +72,7 @@ index 66175691af9417275dee33bbc07c6826e807d571..79a6f43f6aa37362990b403695fcdd13 // Paper end try { this.acquire(); -@@ -226,7 +228,7 @@ public class PalettedContainer implements PaletteResize { +@@ -224,7 +226,7 @@ public class PalettedContainer implements PaletteResize { } @@ -81,7 +81,7 @@ index 66175691af9417275dee33bbc07c6826e807d571..79a6f43f6aa37362990b403695fcdd13 try { this.acquire(); // Paper - Anti-Xray - TODO: Should this.predefinedObjects.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)? -@@ -261,7 +263,7 @@ public class PalettedContainer implements PaletteResize { +@@ -259,7 +261,7 @@ public class PalettedContainer implements PaletteResize { } diff --git a/patches/server/0705-Fix-dangerous-end-portal-logic.patch b/patches/server/0705-Fix-dangerous-end-portal-logic.patch index ef3e7062dc..9322b5a1c8 100644 --- a/patches/server/0705-Fix-dangerous-end-portal-logic.patch +++ b/patches/server/0705-Fix-dangerous-end-portal-logic.patch @@ -11,7 +11,7 @@ Move the tick logic into the post tick, where portaling was designed to happen in the first place. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 145b0205b9777c21f51b24022b2d7a127c26fa0f..a73059437a65768565a2269e60fbca8ba6ab5253 100644 +index c696beff4211266e93026464ba9af5a5d4342e4f..af90013d48e2dd827e045e2fc0f7f5be0dbaa33f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -361,6 +361,37 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -52,7 +52,7 @@ index 145b0205b9777c21f51b24022b2d7a127c26fa0f..a73059437a65768565a2269e60fbca8b public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.passengers = ImmutableList.of(); -@@ -2508,6 +2539,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2506,6 +2537,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } this.processPortalCooldown();