From 570006ab1ec1d4320f15b01d41d42136fd863bed 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 +- .../Add-LivingEntity-getTargetEntity.patch | 14 +- patches/server/Add-PhantomPreSpawnEvent.patch | 2 +- .../Add-PlayerConnectionCloseEvent.patch | 8 +- patches/server/Add-TNTPrimeEvent.patch | 2 +- patches/server/Add-World-Util-Methods.patch | 16 +- ...n-in-sunlight-API-for-Phantoms-and-S.patch | 2 +- patches/server/Add-more-Witch-API.patch | 13 +- .../Allow-Saving-of-Oversized-Chunks.patch | 2 +- ...d-mobs-to-jump-and-take-water-damage.patch | 7 +- patches/server/Anti-Xray.patch | 72 +++---- .../Asynchronous-chunk-IO-and-loading.patch | 2 +- patches/server/Basic-PlayerProfile-API.patch | 8 - .../Bound-Treasure-Maps-to-World-Border.patch | 8 +- patches/server/Buffer-joins-to-world.patch | 2 +- patches/server/Chunk-debug-command.patch | 4 +- .../Do-not-load-chunks-for-Pathfinding.patch | 26 --- patches/server/Entity-Origin-API.patch | 2 +- patches/server/Entity-fromMobSpawner.patch | 2 +- .../server/Entity-getEntitySpawnReason.patch | 2 +- patches/server/EntityPathfindEvent.patch | 13 +- ...PI-for-Reason-Source-Triggering-play.patch | 17 +- patches/server/Firework-API-s.patch | 2 +- .../Fix-World-isChunkGenerated-calls.patch | 10 +- ...ient-rendering-skulls-from-same-user.patch | 6 +- ...k-Priority-Urgency-System-for-Chunks.patch | 16 +- ...Load-Chunks-for-Login-Asynchronously.patch | 2 +- ...-API-Replenishable-Lootables-Feature.patch | 2 +- patches/server/MC-Utils.patch | 200 +----------------- patches/server/Mob-Pathfinding-API.patch | 147 ++----------- ...ptimize-Collision-to-not-load-chunks.patch | 2 +- patches/server/Optimize-Pathfinding.patch | 2 +- ...imize-World.isLoaded-BlockPosition-Z.patch | 2 +- ...Location-getType-and-getBlockData-fo.patch | 2 +- .../server/Optimize-redstone-algorithm.patch | 2 +- .../server/Player-affects-spawning-API.patch | 14 +- .../PlayerDeathEvent-getItemsToKeep.patch | 2 +- ...vent-Pathfinding-out-of-World-Border.patch | 6 +- ...and-End-Portal-Frames-from-being-des.patch | 2 +- patches/server/SkeletonHorse-Additions.patch | 2 +- .../Support-old-UUID-format-for-NBT.patch | 2 +- patches/server/Timings-v2.patch | 13 +- ...-block-falling-causing-client-desync.patch | 2 +- 43 files changed, 130 insertions(+), 550 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/Add-LivingEntity-getTargetEntity.patch b/patches/server/Add-LivingEntity-getTargetEntity.patch index 27141642ac..9566205fa0 100644 --- a/patches/server/Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/Add-LivingEntity-getTargetEntity.patch @@ -4,18 +4,6 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -47,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/Add-PhantomPreSpawnEvent.patch b/patches/server/Add-PhantomPreSpawnEvent.patch index edd0466ebc..04b70c1728 100644 --- a/patches/server/Add-PhantomPreSpawnEvent.patch +++ b/patches/server/Add-PhantomPreSpawnEvent.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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/Add-PlayerConnectionCloseEvent.patch b/patches/server/Add-PlayerConnectionCloseEvent.patch index 18f6aaa812..3de17ccbe6 100644 --- a/patches/server/Add-PlayerConnectionCloseEvent.patch +++ b/patches/server/Add-PlayerConnectionCloseEvent.patch @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } 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: @@ -69,11 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -0,0 +0,0 @@ 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 + public ServerLoginPacketListenerImpl.State state; private int tick; @Nullable - GameProfile gameProfile; diff --git a/patches/server/Add-TNTPrimeEvent.patch b/patches/server/Add-TNTPrimeEvent.patch index 572c31d92c..cbf9df4310 100644 --- a/patches/server/Add-TNTPrimeEvent.patch +++ b/patches/server/Add-TNTPrimeEvent.patch @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/Add-World-Util-Methods.patch b/patches/server/Add-World-Util-Methods.patch index 65b939de3c..e30e7e94dd 100644 --- a/patches/server/Add-World-Util-Methods.patch +++ b/patches/server/Add-World-Util-Methods.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java -+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -@@ -0,0 +0,0 @@ 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/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index b6d7845697..9e64ecebf7 100644 --- a/patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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/Add-more-Witch-API.patch b/patches/server/Add-more-Witch-API.patch index 5af2f880bf..652ad2934c 100644 --- a/patches/server/Add-more-Witch-API.patch +++ b/patches/server/Add-more-Witch-API.patch @@ -17,15 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.Iterator; import java.util.List; import java.util.UUID; -@@ -0,0 +0,0 @@ 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; - @@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob { } @@ -117,12 +108,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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/Allow-Saving-of-Oversized-Chunks.patch b/patches/server/Allow-Saving-of-Oversized-Chunks.patch index d84e03b3df..a0dbbc59cb 100644 --- a/patches/server/Allow-Saving-of-Oversized-Chunks.patch +++ b/patches/server/Allow-Saving-of-Oversized-Chunks.patch @@ -182,7 +182,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index a8fd62a880..3599ea2fda 100644 --- a/patches/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/patches/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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()) { @@ -73,8 +73,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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/Anti-Xray.patch b/patches/server/Anti-Xray.patch index a2999a96a4..bc7242244d 100644 --- a/patches/server/Anti-Xray.patch +++ b/patches/server/Anti-Xray.patch @@ -169,7 +169,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + // 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + } + + 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..00000000000000000000000000000000 + // 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..00000000000000000000000000000000 + + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + + 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..00000000000000000000000000000000 + + @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..00000000000000000000000000000000 + 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 + } @@ -1313,9 +1311,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; @@ -0,0 +0,0 @@ public class PalettedContainer implements PaletteResize { this.lock.release(); } @@ -1339,7 +1337,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private void addPredefinedObjects() { + if (this.predefinedObjects != null && this.palette != this.globalPalette) { + for (T predefinedObject : this.predefinedObjects) { -+ this.palette.getOrCreateIdFor(predefinedObject); ++ this.palette.idFor(predefinedObject); + } + } + } @@ -1378,9 +1376,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 T object = palette.valueFor(bitStorage.get(i)); if (object != null) { @@ -0,0 +0,0 @@ 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) { diff --git a/patches/server/Asynchronous-chunk-IO-and-loading.patch b/patches/server/Asynchronous-chunk-IO-and-loading.patch index f76277bfba..b97475f2b7 100644 --- a/patches/server/Asynchronous-chunk-IO-and-loading.patch +++ b/patches/server/Asynchronous-chunk-IO-and-loading.patch @@ -3666,7 +3666,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ((CraftWorld) loc.getWorld()).getHandle().getChunkSource().addTicketAtLevel(TicketType.POST_TELEPORT, pair, 31, 0); + net.minecraft.server.level.ChunkHolder updatingChunk = playerChunkMap.getUpdatingChunkIfPresent(pair.toLong()); + if (updatingChunk != null) { -+ return updatingChunk.getEntityTickingFuture(); ++ return updatingChunk.getEntityTickingChunkFuture(); + } else { + return java.util.concurrent.CompletableFuture.completedFuture(com.mojang.datafixers.util.Either.left(((org.bukkit.craftbukkit.CraftChunk)chunk).getHandle())); + } diff --git a/patches/server/Basic-PlayerProfile-API.patch b/patches/server/Basic-PlayerProfile-API.patch index 0fec9ba8a7..5020cc933d 100644 --- a/patches/server/Basic-PlayerProfile-API.patch +++ b/patches/server/Basic-PlayerProfile-API.patch @@ -477,14 +477,6 @@ diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -0,0 +0,0 @@ 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(); - @@ -0,0 +0,0 @@ public class GameProfileCache { } } diff --git a/patches/server/Bound-Treasure-Maps-to-World-Border.patch b/patches/server/Bound-Treasure-Maps-to-World-Border.patch index af90096c40..c5c06f1818 100644 --- a/patches/server/Bound-Treasure-Maps-to-World-Border.patch +++ b/patches/server/Bound-Treasure-Maps-to-World-Border.patch @@ -21,12 +21,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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/Buffer-joins-to-world.patch b/patches/server/Buffer-joins-to-world.patch index cba62468f3..332ac170b0 100644 --- a/patches/server/Buffer-joins-to-world.patch +++ b/patches/server/Buffer-joins-to-world.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // 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/Chunk-debug-command.patch b/patches/server/Chunk-debug-command.patch index c71fc39f84..e0583e74d1 100644 --- a/patches/server/Chunk-debug-command.patch +++ b/patches/server/Chunk-debug-command.patch @@ -132,7 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int entityTicking = 0; + + for (ChunkHolder chunk : world.getChunkSource().chunkMap.updatingChunkMap.values()) { -+ if (chunk.getFullChunkIfCached() == null) { ++ if (chunk.getFullChunkUnchecked() == null) { + continue; + } + @@ -334,7 +334,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int fullLoadedChunks = 0; + + for (ChunkHolder chunk : allChunks) { -+ if (chunk.getFullChunkIfCached() != null) { ++ if (chunk.getFullChunkUnchecked() != null) { + ++fullLoadedChunks; + } + } diff --git a/patches/server/Do-not-load-chunks-for-Pathfinding.patch b/patches/server/Do-not-load-chunks-for-Pathfinding.patch index 313a9303e9..40acfa111b 100644 --- a/patches/server/Do-not-load-chunks-for-Pathfinding.patch +++ b/patches/server/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java diff --git a/patches/server/Entity-Origin-API.patch b/patches/server/Entity-Origin-API.patch index edbd46b7a9..2d18fb5642 100644 --- a/patches/server/Entity-Origin-API.patch +++ b/patches/server/Entity-Origin-API.patch @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // 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 diff --git a/patches/server/Entity-fromMobSpawner.patch b/patches/server/Entity-fromMobSpawner.patch index d543dca00e..4a19a8e0c3 100644 --- a/patches/server/Entity-fromMobSpawner.patch +++ b/patches/server/Entity-fromMobSpawner.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void inactiveTick() { } // Spigot end @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - nbt.setUUID("Paper.OriginWorld", originWorld); + nbt.putUUID("Paper.OriginWorld", originWorld); nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } + // Save entity's from mob spawner status diff --git a/patches/server/Entity-getEntitySpawnReason.patch b/patches/server/Entity-getEntitySpawnReason.patch index 6cf19eceb8..d2e608bdd4 100644 --- a/patches/server/Entity-getEntitySpawnReason.patch +++ b/patches/server/Entity-getEntitySpawnReason.patch @@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - nbt.setUUID("Paper.OriginWorld", originWorld); + nbt.putUUID("Paper.OriginWorld", originWorld); nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } + if (spawnReason != null) { diff --git a/patches/server/EntityPathfindEvent.patch b/patches/server/EntityPathfindEvent.patch index 0877d9edd8..a0c4c849ea 100644 --- a/patches/server/EntityPathfindEvent.patch +++ b/patches/server/EntityPathfindEvent.patch @@ -43,15 +43,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; -@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public abstract class PathNavigation { @Nullable @@ -99,8 +90,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 8aae5ff2af..099514bdf9 100644 --- a/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -56,10 +56,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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()); @@ -255,19 +255,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java -+++ b/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java diff --git a/patches/server/Firework-API-s.patch b/patches/server/Firework-API-s.patch index 9496737356..4fac7af404 100644 --- a/patches/server/Firework-API-s.patch +++ b/patches/server/Firework-API-s.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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/Fix-World-isChunkGenerated-calls.patch b/patches/server/Fix-World-isChunkGenerated-calls.patch index f3030e6215..4445132f02 100644 --- a/patches/server/Fix-World-isChunkGenerated-calls.patch +++ b/patches/server/Fix-World-isChunkGenerated-calls.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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()) { @@ -123,14 +123,6 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -@@ -0,0 +0,0 @@ public class ChunkStatus { - return this.name; - } - -+ @Deprecated public ChunkStatus getPreviousStatus() { return this.getParent(); } // Paper - OBFHELPER - public ChunkStatus getParent() { - return this.parent; - } @@ -0,0 +0,0 @@ public class ChunkStatus { return this.chunkType; } diff --git a/patches/server/Fix-client-rendering-skulls-from-same-user.patch b/patches/server/Fix-client-rendering-skulls-from-same-user.patch index 52bc9ba2cb..75b51b8650 100644 --- a/patches/server/Fix-client-rendering-skulls-from-same-user.patch +++ b/patches/server/Fix-client-rendering-skulls-from-same-user.patch @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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); + } + } @@ -105,11 +105,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/patches/server/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index fd56bd0ba8..361a411e76 100644 --- a/patches/server/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/patches/server/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -427,7 +427,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + // 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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; @@ -878,16 +878,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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; @@ -1126,7 +1126,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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(); @@ -0,0 +0,0 @@ public abstract class PlayerList { SocketAddress socketaddress = loginlistener.connection.getRemoteAddress(); diff --git a/patches/server/Load-Chunks-for-Login-Asynchronously.patch b/patches/server/Load-Chunks-for-Login-Asynchronously.patch index c4118f64f2..32e0f78469 100644 --- a/patches/server/Load-Chunks-for-Login-Asynchronously.patch +++ b/patches/server/Load-Chunks-for-Login-Asynchronously.patch @@ -152,7 +152,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + worldserver1.getChunkSource().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { + 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); + } diff --git a/patches/server/LootTable-API-Replenishable-Lootables-Feature.patch b/patches/server/LootTable-API-Replenishable-Lootables-Feature.patch index 102124b2b2..57db3aad8a 100644 --- a/patches/server/LootTable-API-Replenishable-Lootables-Feature.patch +++ b/patches/server/LootTable-API-Replenishable-Lootables-Feature.patch @@ -342,7 +342,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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); + } diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 61070a0fc8..bf2e937ca4 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -760,7 +760,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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..00000000000000000000000000000000 + } + + 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) { @@ -2274,22 +2274,6 @@ diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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)); - } @@ -0,0 +0,0 @@ public class BlockPos extends Vec3i { } } @@ -2320,11 +2304,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected CompoundTag(Map entries) { this.tags = entries; @@ -0,0 +0,0 @@ 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) { this.tags.put(key, NbtUtils.createUUID(value)); } @@ -2335,18 +2314,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java -+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java @@ -2915,23 +2882,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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); @@ -0,0 +0,0 @@ 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; } @@ -3214,7 +3174,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }); + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }); + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + -+ return playerChunk.getFullChunkIfCached(); ++ return playerChunk.getFullChunkUnchecked(); + } + + @Nullable @@ -3514,19 +3474,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/player/Inventory.java -+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java @@ -3556,14 +3503,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void setTag(@Nullable CompoundTag tag) { this.tag = tag; if (this.getItem().canBeDepleted()) { -@@ -0,0 +0,0 @@ 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); - } @@ -0,0 +0,0 @@ public final class ItemStack { // CraftBukkit start @Deprecated @@ -3572,18 +3511,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java -+++ b/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java @@ -3775,18 +3702,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.setBlock(pos, state, flags, 512); } -@@ -0,0 +0,0 @@ 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)); @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (this.isOutsideBuildHeight(pos)) { return Blocks.VOID_AIR.defaultBlockState(); @@ -3862,15 +3777,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.server.level.ServerLevel; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; -@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess { private Supplier fullStatus; @Nullable @@ -4099,65 +4005,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/Palette.java -+++ b/src/main/java/net/minecraft/world/level/chunk/Palette.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -0,0 +0,0 @@ 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; - }; -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java @@ -4181,43 +4028,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java diff --git a/patches/server/Mob-Pathfinding-API.patch b/patches/server/Mob-Pathfinding-API.patch index d0e0827345..e9e3d5e4a8 100644 --- a/patches/server/Mob-Pathfinding-API.patch +++ b/patches/server/Mob-Pathfinding-API.patch @@ -40,18 +40,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public void stopPathfinding() { -+ entity.getNavigation().stopPathfinding(); ++ entity.getNavigation().stop(); + } + + @Override + public boolean hasPath() { -+ return entity.getNavigation().getPathEntity() != null; ++ return entity.getNavigation().getPath() != null; + } + + @Nullable + @Override + public PathResult getCurrentPath() { -+ Path path = entity.getNavigation().getPathEntity(); ++ Path path = entity.getNavigation().getPath(); + return path != null ? new PaperPathResult(path) : null; + } + @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public PathResult findPath(Location loc) { + Validate.notNull(loc, "Location can not be null"); -+ Path path = entity.getNavigation().calculateDestination(loc.getX(), loc.getY(), loc.getZ()); ++ Path path = entity.getNavigation().createPath(loc.getX(), loc.getY(), loc.getZ(), 0); + return path != null ? new PaperPathResult(path) : null; + } + @@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public PathResult findPath(LivingEntity target) { + Validate.notNull(target, "Target can not be null"); -+ Path path = entity.getNavigation().calculateDestination(((CraftLivingEntity) target).getHandle()); ++ Path path = entity.getNavigation().createPath(((CraftLivingEntity) target).getHandle(), 0); + return path != null ? new PaperPathResult(path) : null; + } + @@ -75,37 +75,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean moveTo(@Nonnull PathResult path, double speed) { + Validate.notNull(path, "PathResult can not be null"); + Path pathEntity = ((PaperPathResult) path).path; -+ return entity.getNavigation().setDestination(pathEntity, speed); ++ return entity.getNavigation().moveTo(pathEntity, speed); + } + + @Override + public boolean canOpenDoors() { -+ return entity.getNavigation().getPathfinder().getPathfinder().shouldOpenDoors(); ++ return entity.getNavigation().pathFinder.nodeEvaluator.canOpenDoors(); + } + + @Override + public void setCanOpenDoors(boolean canOpenDoors) { -+ entity.getNavigation().getPathfinder().getPathfinder().setShouldOpenDoors(canOpenDoors); ++ entity.getNavigation().pathFinder.nodeEvaluator.setCanOpenDoors(canOpenDoors); + } + + @Override + public boolean canPassDoors() { -+ return entity.getNavigation().getPathfinder().getPathfinder().shouldPassDoors(); ++ return entity.getNavigation().pathFinder.nodeEvaluator.canPassDoors(); + } + + @Override + public void setCanPassDoors(boolean canPassDoors) { -+ entity.getNavigation().getPathfinder().getPathfinder().setShouldPassDoors(canPassDoors); ++ entity.getNavigation().pathFinder.nodeEvaluator.setCanPassDoors(canPassDoors); + } + + @Override + public boolean canFloat() { -+ return entity.getNavigation().getPathfinder().getPathfinder().shouldFloat(); ++ return entity.getNavigation().pathFinder.nodeEvaluator.canFloat(); + } + + @Override + public void setCanFloat(boolean canFloat) { -+ entity.getNavigation().getPathfinder().getPathfinder().setShouldFloat(canFloat); ++ entity.getNavigation().pathFinder.nodeEvaluator.setCanFloat(canFloat); + } + + public class PaperPathResult implements com.destroystokyo.paper.entity.PaperPathfinder.PathResult { @@ -118,14 +118,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Nullable + @Override + public Location getFinalPoint() { -+ Node point = path.getFinalPoint(); ++ Node point = path.getEndNode(); + return point != null ? toLoc(point) : null; + } + + @Override + public List 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..00000000000000000000000000000000 + + @Override + public int getNextPointIndex() { -+ return path.getNextIndex(); ++ return path.getNextNodeIndex(); + } + + @Nullable @@ -142,135 +142,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ 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); - } - -@@ -0,0 +0,0 @@ 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 - } - -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ public abstract class PathNavigation { - } - } - -- @Nullable -+ @Deprecated @Nullable public Path getPathEntity() { return getPath(); } @Nullable // Paper - OBFHELPER - public Path getPath() { - return this.path; - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/Node.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/Node.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/Path.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/Path.java -@@ -0,0 +0,0 @@ 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 +@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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; - } - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java diff --git a/patches/server/Optimize-Collision-to-not-load-chunks.patch b/patches/server/Optimize-Collision-to-not-load-chunks.patch index 35799eb649..2eb1a719a7 100644 --- a/patches/server/Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/Optimize-Collision-to-not-load-chunks.patch @@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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) diff --git a/patches/server/Optimize-Pathfinding.patch b/patches/server/Optimize-Pathfinding.patch index d89486cd3e..f32745f2c0 100644 --- a/patches/server/Optimize-Pathfinding.patch +++ b/patches/server/Optimize-Pathfinding.patch @@ -40,4 +40,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } - @Deprecated public boolean setDestination(@Nullable Path pathentity, double speed) { return moveTo(pathentity, speed); } // Paper - OBFHELPER + public boolean moveTo(@Nullable Path path, double speed) { diff --git a/patches/server/Optimize-World.isLoaded-BlockPosition-Z.patch b/patches/server/Optimize-World.isLoaded-BlockPosition-Z.patch index cb979cef24..55e4b8c5c5 100644 --- a/patches/server/Optimize-World.isLoaded-BlockPosition-Z.patch +++ b/patches/server/Optimize-World.isLoaded-BlockPosition-Z.patch @@ -19,5 +19,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + 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/Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/patches/server/Optimize-isValidLocation-getType-and-getBlockData-fo.patch index cf294cdb86..731ed0c46d 100644 --- a/patches/server/Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/patches/server/Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -184,7 +184,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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/Optimize-redstone-algorithm.patch b/patches/server/Optimize-redstone-algorithm.patch index 9355bf1b01..dbe064cb2d 100644 --- a/patches/server/Optimize-redstone-algorithm.patch +++ b/patches/server/Optimize-redstone-algorithm.patch @@ -368,7 +368,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/Player-affects-spawning-API.patch b/patches/server/Player-affects-spawning-API.patch index 7e48a6b3d4..27d04871a1 100644 --- a/patches/server/Player-affects-spawning-API.patch +++ b/patches/server/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java @@ -118,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/PlayerDeathEvent-getItemsToKeep.patch b/patches/server/PlayerDeathEvent-getItemsToKeep.patch index fb6b68949d..a302625e5d 100644 --- a/patches/server/PlayerDeathEvent-getItemsToKeep.patch +++ b/patches/server/PlayerDeathEvent-getItemsToKeep.patch @@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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/Prevent-Pathfinding-out-of-World-Border.patch b/patches/server/Prevent-Pathfinding-out-of-World-Border.patch index 281df0adae..35d3dd2861 100644 --- a/patches/server/Prevent-Pathfinding-out-of-World-Border.patch +++ b/patches/server/Prevent-Pathfinding-out-of-World-Border.patch @@ -20,8 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // 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/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index bf74192c3f..ddcc875e5c 100644 --- a/patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // 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 + } diff --git a/patches/server/SkeletonHorse-Additions.patch b/patches/server/SkeletonHorse-Additions.patch index 28c6f2b746..1c37bd6e05 100644 --- a/patches/server/SkeletonHorse-Additions.patch +++ b/patches/server/SkeletonHorse-Additions.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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/Support-old-UUID-format-for-NBT.patch b/patches/server/Support-old-UUID-format-for-NBT.patch index aaa8f2cff4..022f678510 100644 --- a/patches/server/Support-old-UUID-format-for-NBT.patch +++ b/patches/server/Support-old-UUID-format-for-NBT.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java @@ -0,0 +0,0 @@ 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)) { diff --git a/patches/server/Timings-v2.patch b/patches/server/Timings-v2.patch index 5895838434..674b561ec3 100644 --- a/patches/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -779,17 +779,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.spigotmc.SlackActivityAccountant; // Spigot public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements SnooperPopulator, CommandSource, AutoCloseable { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop