diff --git a/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch b/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch index 3671d12396..376f9569a4 100644 --- a/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch +++ b/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option to allow iron golems to spawn in air diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7d408542e7..c7cde1d0a0 100644 +index 47c6d66b78e..b773b750ae4 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -21,7 +21,7 @@ index 7d408542e7..c7cde1d0a0 100644 private void bedSearchRadius() { bedSearchRadius = getInt("bed-search-radius", 1); diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java -index 2f764776b2..7f6a567760 100644 +index 2f764776b2f..7f6a5677600 100644 --- a/src/main/java/net/minecraft/server/EntityIronGolem.java +++ b/src/main/java/net/minecraft/server/EntityIronGolem.java @@ -0,0 +0,0 @@ public class EntityIronGolem extends EntityGolem { diff --git a/Spigot-Server-Patches/Add-option-to-disable-pillager-patrols.patch b/Spigot-Server-Patches/Add-option-to-disable-pillager-patrols.patch index a9539255d0..c037500528 100644 --- a/Spigot-Server-Patches/Add-option-to-disable-pillager-patrols.patch +++ b/Spigot-Server-Patches/Add-option-to-disable-pillager-patrols.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option to disable pillager patrols diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index c37a0f035d..3bbf77a8ec 100644 +index 44210855560..1c703e48e99 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ index c37a0f035d..3bbf77a8ec 100644 + } } diff --git a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -index 33488b37e4..a0f5828076 100644 +index 33488b37e4d..a0f58280760 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java @@ -0,0 +0,0 @@ public class MobSpawnerPatrol { diff --git a/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch b/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch index a14703b166..7fcfa9608e 100644 --- a/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index bce502181f..7d408542e7 100644 +index ade7af40eff..47c6d66b78e 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ index bce502181f..7d408542e7 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java -index 2dc3ab4cfa..09c7c13183 100644 +index 2dc3ab4cfa3..09c7c131833 100644 --- a/src/main/java/net/minecraft/server/BlockPortal.java +++ b/src/main/java/net/minecraft/server/BlockPortal.java @@ -0,0 +0,0 @@ public class BlockPortal extends Block { @@ -32,7 +32,7 @@ index 2dc3ab4cfa..09c7c13183 100644 } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 599bcabd14..00df89d650 100644 +index 599bcabd14a..00df89d6509 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke diff --git a/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch b/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch index d99b0c08e0..9de7a499b4 100644 --- a/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch +++ b/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add phantom creative and insomniac controls diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3c0468bc44..bfb52d75c7 100644 +index a4815f5e69c..4612697569f 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -21,7 +21,7 @@ index 3c0468bc44..bfb52d75c7 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java -index 90eeddb1af..96b4912c48 100644 +index 90eeddb1af5..96b4912c483 100644 --- a/src/main/java/net/minecraft/server/EntityPhantom.java +++ b/src/main/java/net/minecraft/server/EntityPhantom.java @@ -0,0 +0,0 @@ public class EntityPhantom extends EntityFlying implements IMonster { @@ -33,7 +33,7 @@ index 90eeddb1af..96b4912c48 100644 return true; } diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index a2d1ef3602..1398c47a2f 100644 +index a2d1ef3602a..1398c47a2f8 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -0,0 +0,0 @@ public final class IEntitySelector { @@ -45,7 +45,7 @@ index a2d1ef3602..1398c47a2f 100644 public static Predicate a(double d0, double d1, double d2, double d3) { double d4 = d3 * d3; diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -index f488c22ed6..0db431cd6a 100644 +index f488c22ed64..0db431cd6ad 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java @@ -0,0 +0,0 @@ public class MobSpawnerPhantom { diff --git a/Spigot-Server-Patches/Anti-Xray.patch b/Spigot-Server-Patches/Anti-Xray.patch index 9677c9a3a6..fe5f6576e9 100644 --- a/Spigot-Server-Patches/Anti-Xray.patch +++ b/Spigot-Server-Patches/Anti-Xray.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Anti-Xray diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4867615215..df24e3297b 100644 +index 48676152152..ca2ac17747d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ @@ -14,9 +14,7 @@ index 4867615215..df24e3297b 100644 +import java.util.Arrays; import java.util.List; -+import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.ChunkEdgeMode; +import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode; -+import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.spigotmc.SpigotWorldConfig; @@ -28,7 +26,6 @@ index 4867615215..df24e3297b 100644 + public boolean antiXray; + public boolean asynchronous; + public EngineMode engineMode; -+ public ChunkEdgeMode chunkEdgeMode; + public int maxChunkSectionIndex; + public int updateRadius; + public List hiddenBlocks; @@ -38,15 +35,6 @@ index 4867615215..df24e3297b 100644 + asynchronous = true; + engineMode = EngineMode.getById(getInt("anti-xray.engine-mode", EngineMode.HIDE.getId())); + engineMode = engineMode == null ? EngineMode.HIDE : engineMode; -+ chunkEdgeMode = ChunkEdgeMode.getById(getInt("anti-xray.chunk-edge-mode", ChunkEdgeMode.WAIT.getId())); -+ chunkEdgeMode = chunkEdgeMode == null ? ChunkEdgeMode.DEFAULT : chunkEdgeMode; -+ -+ if (chunkEdgeMode != ChunkEdgeMode.WAIT) { -+ log("Migrating anti-xray chunk edge mode to " + ChunkEdgeMode.WAIT + " (" + ChunkEdgeMode.WAIT.getId() + ")"); -+ chunkEdgeMode = ChunkEdgeMode.WAIT; -+ set("anti-xray.chunk-edge-mode", ChunkEdgeMode.WAIT.getId()); -+ } -+ + maxChunkSectionIndex = getInt("anti-xray.max-chunk-section-index", 3); + maxChunkSectionIndex = maxChunkSectionIndex > 15 ? 15 : maxChunkSectionIndex; + updateRadius = getInt("anti-xray.update-radius", 2); @@ -61,12 +49,12 @@ index 4867615215..df24e3297b 100644 + set("anti-xray.hidden-blocks", hiddenBlocks); + set("anti-xray.replacement-blocks", replacementBlocks); + } -+ log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); ++ log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); + } } diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java new file mode 100644 -index 0000000000..f7e376ce6a +index 00000000000..df7e4183d88 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java @@ -0,0 +0,0 @@ @@ -78,7 +66,6 @@ index 0000000000..f7e376ce6a +import net.minecraft.server.EnumDirection; +import net.minecraft.server.IBlockData; +import net.minecraft.server.IChunkAccess; -+import net.minecraft.server.IWorldReader; +import net.minecraft.server.PacketPlayOutMapChunk; +import net.minecraft.server.PlayerInteractManager; +import net.minecraft.server.World; @@ -91,20 +78,15 @@ index 0000000000..f7e376ce6a + + } + -+ public IBlockData[] getPredefinedBlockData(IWorldReader world, IChunkAccess chunk, ChunkSection chunkSection, boolean initializeBlocks) { ++ public IBlockData[] getPredefinedBlockData(World world, IChunkAccess chunk, ChunkSection chunkSection, boolean initializeBlocks) { + return null; + } + -+ public boolean onChunkPacketCreate(Chunk chunk, int chunkSectionSelector, boolean force) { -+ return true; -+ } -+ -+ public ChunkPacketInfo getChunkPacketInfo(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, -+ int chunkSectionSelector, boolean forceLoad) { ++ public ChunkPacketInfo getChunkPacketInfo(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, int chunkSectionSelector) { + return null; + } + -+ public void modifyBlocks(PacketPlayOutMapChunk packetPlayOutMapChunk, ChunkPacketInfo chunkPacketInfo, boolean loadChunks, Integer ticketHold) { ++ public void modifyBlocks(PacketPlayOutMapChunk packetPlayOutMapChunk, ChunkPacketInfo chunkPacketInfo) { + packetPlayOutMapChunk.setReady(true); + } + @@ -118,7 +100,7 @@ index 0000000000..f7e376ce6a +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000..23626bef3a +index 00000000000..9c017eb027c --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java @@ -0,0 +0,0 @@ @@ -130,8 +112,6 @@ index 0000000000..23626bef3a +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; -+import java.util.concurrent.atomic.AtomicInteger; -+import java.util.function.Supplier; + +import net.minecraft.server.*; +import org.bukkit.Bukkit; @@ -139,13 +119,12 @@ index 0000000000..23626bef3a + +import com.destroystokyo.paper.PaperWorldConfig; + -+public class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockController { ++public final class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockController { + + private static ExecutorService executorServiceInstance = null; + private final ExecutorService executorService; + private final boolean asynchronous; + private final EngineMode engineMode; -+ private final ChunkEdgeMode chunkEdgeMode; + private final int maxChunkSectionIndex; + private final int updateRadius; + private final IBlockData[] predefinedBlockData; @@ -164,7 +143,6 @@ index 0000000000..23626bef3a + public ChunkPacketBlockControllerAntiXray(PaperWorldConfig paperWorldConfig) { + asynchronous = paperWorldConfig.asynchronous; + engineMode = paperWorldConfig.engineMode; -+ chunkEdgeMode = paperWorldConfig.chunkEdgeMode; + maxChunkSectionIndex = paperWorldConfig.maxChunkSectionIndex; + updateRadius = paperWorldConfig.updateRadius; + @@ -247,23 +225,19 @@ index 0000000000..23626bef3a + } + + @Override -+ public IBlockData[] getPredefinedBlockData(IWorldReader world, IChunkAccess chunk, ChunkSection chunkSection, boolean initializeBlocks) { -+ //Return the block data which should be added to the data palettes so that they can be used for the obfuscation ++ public IBlockData[] getPredefinedBlockData(World world, IChunkAccess chunk, ChunkSection chunkSection, boolean initializeBlocks) { ++ // Return the block data which should be added to the data palettes so that they can be used for the obfuscation + if (chunkSection.getYPosition() >> 4 <= maxChunkSectionIndex) { + switch (engineMode) { + case HIDE: -+ if (world instanceof GeneratorAccess) { -+ switch (((GeneratorAccess) world).getMinecraftWorld().getWorld().getEnvironment()) { -+ case NETHER: -+ return predefinedBlockDataNetherrack; -+ case THE_END: -+ return predefinedBlockDataEndStone; -+ default: -+ return predefinedBlockDataStone; -+ } ++ switch (world.getWorld().getEnvironment()) { ++ case NETHER: ++ return predefinedBlockDataNetherrack; ++ case THE_END: ++ return predefinedBlockDataEndStone; ++ default: ++ return predefinedBlockDataStone; + } -+ -+ return null; + default: + return predefinedBlockData; + } @@ -272,128 +246,33 @@ index 0000000000..23626bef3a + return null; + } + -+ private final AtomicInteger xrayRequests = new AtomicInteger(); -+ -+ private Integer addXrayTickets(final int x, final int z, final ChunkProviderServer chunkProvider) { -+ final Integer hold = Integer.valueOf(this.xrayRequests.getAndIncrement()); -+ -+ // Add at ticket level 33, which is just enough to keep chunks loaded -+ chunkProvider.addTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x, z), 0, hold); -+ chunkProvider.addTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x - 1, z), 0, hold); -+ chunkProvider.addTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x + 1, z), 0, hold); -+ chunkProvider.addTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x, z - 1), 0, hold); -+ chunkProvider.addTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x, z + 1), 0, hold); -+ -+ return hold; -+ } -+ -+ private void removeXrayTickets(final int x, final int z, final ChunkProviderServer chunkProvider, final Integer hold) { -+ // Remove at ticket level 33 (same one we added as), which is just enough to keep chunks loaded -+ chunkProvider.removeTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x, z), 0, hold); -+ chunkProvider.removeTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x - 1, z), 0, hold); -+ chunkProvider.removeTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x + 1, z), 0, hold); -+ chunkProvider.removeTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x, z - 1), 0, hold); -+ chunkProvider.removeTicket(TicketType.ANTIXRAY, new ChunkCoordIntPair(x, z + 1), 0, hold); -+ } -+ -+ private void loadNeighbours(Chunk chunk) { -+ int locX = chunk.getPos().x; -+ int locZ = chunk.getPos().z; -+ chunk.world.getChunkAt(locX - 1, locZ); -+ chunk.world.getChunkAt(locX + 1, locZ); -+ chunk.world.getChunkAt(locX, locZ - 1); -+ chunk.world.getChunkAt(locX, locZ + 1); -+ } -+ + @Override -+ public boolean onChunkPacketCreate(Chunk chunk, int chunkSectionSelector, boolean force) { -+ int locX = chunk.getPos().x; -+ int locZ = chunk.getPos().z; -+ WorldServer world = (WorldServer)chunk.world; -+ ChunkProviderServer chunkProvider = world.getChunkProvider(); -+ -+ //Load nearby chunks if necessary -+ if (force || chunkEdgeMode == ChunkEdgeMode.LOAD) { // TODO temporary -+ // if forced, load NOW; -+ this.loadNeighbours(chunk); -+ } else if (chunkEdgeMode == ChunkEdgeMode.WAIT) { -+ if (chunkProvider.getChunkAtIfCachedImmediately(locX - 1, locZ) == null || -+ chunkProvider.getChunkAtIfCachedImmediately(locX + 1, locZ) == null || -+ chunkProvider.getChunkAtIfCachedImmediately(locX, locZ - 1) == null || -+ chunkProvider.getChunkAtIfCachedImmediately(locX, locZ + 1) == null) { -+ //Don't create the chunk packet now, wait until nearby chunks are loaded and create it later -+ return false; -+ } -+ } else if (false && chunkEdgeMode == ChunkEdgeMode.LOAD) { -+ // TODO Note: These should be asynchronous loads; however we have no such thing in 1.14. -+ boolean missingChunk = false; -+ //noinspection ConstantConditions -+ /* -+ missingChunk |= ((WorldServer)chunk.world).getChunkProvider().getChunkAt(chunk.locX - 1, chunk.locZ, true, true, c -> {}) == null; -+ missingChunk |= ((WorldServer)chunk.world).getChunkProvider().getChunkAt(chunk.locX + 1, chunk.locZ, true, true, c -> {}) == null; -+ missingChunk |= ((WorldServer)chunk.world).getChunkProvider().getChunkAt(chunk.locX, chunk.locZ - 1, true, true, c -> {}) == null; -+ missingChunk |= ((WorldServer)chunk.world).getChunkProvider().getChunkAt(chunk.locX, chunk.locZ + 1, true, true, c -> {}) == null; -+ */ -+ if (missingChunk) { -+ return false; -+ } -+ } -+ -+ //Create the chunk packet now -+ return true; -+ } -+ -+ @Override -+ public ChunkPacketInfoAntiXray getChunkPacketInfo(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, -+ int chunkSectionSelector, boolean forceLoad) { ++ public ChunkPacketInfoAntiXray getChunkPacketInfo(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, int chunkSectionSelector) { + // Return a new instance to collect data and objects in the right state while creating the chunk packet for thread safe access later + // Note: As of 1.14 this has to be moved later due to the chunk system. -+ + ChunkPacketInfoAntiXray chunkPacketInfoAntiXray = new ChunkPacketInfoAntiXray(packetPlayOutMapChunk, chunk, chunkSectionSelector, this); + return chunkPacketInfoAntiXray; + } + + @Override -+ public void modifyBlocks(PacketPlayOutMapChunk packetPlayOutMapChunk, ChunkPacketInfo chunkPacketInfo, boolean loadChunks, Integer hold) { ++ public void modifyBlocks(PacketPlayOutMapChunk packetPlayOutMapChunk, ChunkPacketInfo chunkPacketInfo) { + if (!Bukkit.isPrimaryThread()) { + // plugins? -+ final Integer finalHold = hold; + MinecraftServer.getServer().scheduleOnMain(() -> { -+ this.modifyBlocks(packetPlayOutMapChunk, chunkPacketInfo, loadChunks, finalHold); ++ this.modifyBlocks(packetPlayOutMapChunk, chunkPacketInfo); + }); + return; + } ++ + Chunk chunk = chunkPacketInfo.getChunk(); -+ int locX = chunk.getPos().x; -+ int locZ = chunk.getPos().z; ++ int x = chunk.getPos().x; ++ int z = chunk.getPos().z; + WorldServer world = (WorldServer)chunk.world; -+ -+ Chunk[] chunks = new Chunk[] { -+ (Chunk)world.getChunkIfLoadedImmediately(locX - 1, locZ), -+ (Chunk)world.getChunkIfLoadedImmediately(locX + 1, locZ), -+ (Chunk)world.getChunkIfLoadedImmediately(locX, locZ - 1), -+ (Chunk)world.getChunkIfLoadedImmediately(locX, locZ + 1) -+ }; -+ -+ if (loadChunks) { -+ // Note: This ugly hack is to get us out of the general chunk load/unload queue to prevent deadlock -+ -+ if (chunks[0] == null || chunks[1] == null || chunks[2] == null || chunks[3] == null) { -+ // we need to load -+ MinecraftServer.getServer().scheduleOnMain(() -> { -+ Integer ticketHold = this.addXrayTickets(locX, locZ, world.getChunkProvider()); -+ this.loadNeighbours(chunk); -+ this.modifyBlocks(packetPlayOutMapChunk, chunkPacketInfo, false, ticketHold); -+ }); -+ return; -+ } -+ -+ hold = this.addXrayTickets(locX, locZ, world.getChunkProvider()); -+ // fall through to normal behavior, our chunks are now loaded & have a ticket -+ } -+ -+ ((ChunkPacketInfoAntiXray)chunkPacketInfo).setNearbyChunks(chunks); -+ ((ChunkPacketInfoAntiXray)chunkPacketInfo).ticketHold = hold; ++ ((ChunkPacketInfoAntiXray) chunkPacketInfo).setNearbyChunks( ++ (Chunk) world.getChunkIfLoadedImmediately(x - 1, z), ++ (Chunk) world.getChunkIfLoadedImmediately(x + 1, z), ++ (Chunk) world.getChunkIfLoadedImmediately(x, z - 1), ++ (Chunk) world.getChunkIfLoadedImmediately(x, z + 1)); + + if (asynchronous) { + executorService.submit((ChunkPacketInfoAntiXray) chunkPacketInfo); @@ -402,11 +281,11 @@ index 0000000000..23626bef3a + } + } + -+ //Actually these fields should be variables inside the obfuscate method but in sync mode or with SingleThreadExecutor in async mode it's okay ++ // Actually these fields should be variables inside the obfuscate method but in sync mode or with SingleThreadExecutor in async mode it's okay + private int[] predefinedBlockDataBits; + private final boolean[] solid = new boolean[Block.REGISTRY_ID.size()]; + private final boolean[] obfuscate = new boolean[Block.REGISTRY_ID.size()]; -+ //These boolean arrays represent chunk layers, true means don't obfuscate, false means obfuscate ++ // These boolean arrays represent chunk layers, true means don't obfuscate, false means obfuscate + private boolean[][] current = new boolean[16][16]; + private boolean[][] next = new boolean[16][16]; + private boolean[][] nextNext = new boolean[16][16]; @@ -415,130 +294,112 @@ index 0000000000..23626bef3a + private final ChunkSection[] nearbyChunkSections = new ChunkSection[4]; + + public void obfuscate(ChunkPacketInfoAntiXray chunkPacketInfoAntiXray) { -+ try { -+ boolean[] solidTemp = null; -+ boolean[] obfuscateTemp = null; -+ dataBitsReader.setDataBits(chunkPacketInfoAntiXray.getData()); -+ dataBitsWriter.setDataBits(chunkPacketInfoAntiXray.getData()); -+ int counter = 0; ++ boolean[] solidTemp = null; ++ boolean[] obfuscateTemp = null; ++ dataBitsReader.setDataBits(chunkPacketInfoAntiXray.getData()); ++ dataBitsWriter.setDataBits(chunkPacketInfoAntiXray.getData()); ++ int counter = 0; + -+ for (int chunkSectionIndex = 0; chunkSectionIndex <= maxChunkSectionIndex; chunkSectionIndex++) { -+ if (chunkPacketInfoAntiXray.isWritten(chunkSectionIndex) && chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex) != null) { -+ int[] predefinedBlockDataBitsTemp; ++ for (int chunkSectionIndex = 0; chunkSectionIndex <= maxChunkSectionIndex; chunkSectionIndex++) { ++ if (chunkPacketInfoAntiXray.isWritten(chunkSectionIndex) && chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex) != null) { ++ int[] predefinedBlockDataBitsTemp; + -+ if (chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex) == ChunkSection.GLOBAL_PALETTE) { -+ predefinedBlockDataBitsTemp = engineMode == EngineMode.HIDE ? chunkPacketInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.NETHER ? predefinedBlockDataBitsNetherrackGlobal : chunkPacketInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.THE_END ? predefinedBlockDataBitsEndStoneGlobal : predefinedBlockDataBitsStoneGlobal : predefinedBlockDataBitsGlobal; -+ } else { -+ predefinedBlockDataBitsTemp = predefinedBlockDataBits == null ? predefinedBlockDataBits = engineMode == EngineMode.HIDE ? new int[1] : new int[predefinedBlockData.length] : predefinedBlockDataBits; ++ if (chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex) == ChunkSection.GLOBAL_PALETTE) { ++ predefinedBlockDataBitsTemp = engineMode == EngineMode.HIDE ? chunkPacketInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.NETHER ? predefinedBlockDataBitsNetherrackGlobal : chunkPacketInfoAntiXray.getChunk().world.getWorld().getEnvironment() == Environment.THE_END ? predefinedBlockDataBitsEndStoneGlobal : predefinedBlockDataBitsStoneGlobal : predefinedBlockDataBitsGlobal; ++ } else { ++ predefinedBlockDataBitsTemp = predefinedBlockDataBits == null ? predefinedBlockDataBits = engineMode == EngineMode.HIDE ? new int[1] : new int[predefinedBlockData.length] : predefinedBlockDataBits; + -+ for (int i = 0; i < predefinedBlockDataBitsTemp.length; i++) { -+ predefinedBlockDataBitsTemp[i] = chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex).getOrCreateIdFor(chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex)[i]); ++ for (int i = 0; i < predefinedBlockDataBitsTemp.length; i++) { ++ predefinedBlockDataBitsTemp[i] = chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex).getOrCreateIdFor(chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex)[i]); ++ } ++ } ++ ++ dataBitsWriter.setIndex(chunkPacketInfoAntiXray.getDataBitsIndex(chunkSectionIndex)); ++ ++ // Check if the chunk section below was not obfuscated ++ if (chunkSectionIndex == 0 || !chunkPacketInfoAntiXray.isWritten(chunkSectionIndex - 1) || chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex - 1) == null) { ++ // If so, initialize some stuff ++ dataBitsReader.setBitsPerObject(chunkPacketInfoAntiXray.getBitsPerObject(chunkSectionIndex)); ++ dataBitsReader.setIndex(chunkPacketInfoAntiXray.getDataBitsIndex(chunkSectionIndex)); ++ solidTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex), solid, solidGlobal); ++ obfuscateTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex), obfuscate, obfuscateGlobal); ++ // Read the blocks of the upper layer of the chunk section below if it exists ++ ChunkSection belowChunkSection = null; ++ boolean skipFirstLayer = chunkSectionIndex == 0 || (belowChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex - 1]) == Chunk.EMPTY_CHUNK_SECTION; ++ ++ for (int z = 0; z < 16; z++) { ++ for (int x = 0; x < 16; x++) { ++ current[z][x] = true; ++ next[z][x] = skipFirstLayer || !solidGlobal[ChunkSection.GLOBAL_PALETTE.getOrCreateIdFor(belowChunkSection.getType(x, 15, z))]; + } + } + -+ dataBitsWriter.setIndex(chunkPacketInfoAntiXray.getOrCreateIdForIndex(chunkSectionIndex)); ++ // Abuse the obfuscateLayer method to read the blocks of the first layer of the current chunk section ++ dataBitsWriter.setBitsPerObject(0); ++ obfuscateLayer(-1, dataBitsReader, dataBitsWriter, solidTemp, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, emptyNearbyChunkSections, counter); ++ } + -+ //Check if the chunk section below was not obfuscated -+ if (chunkSectionIndex == 0 || !chunkPacketInfoAntiXray.isWritten(chunkSectionIndex - 1) || chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex - 1) == null) { -+ //If so, initialize some stuff -+ dataBitsReader.setBitsPerObject(chunkPacketInfoAntiXray.getBitsPerObject(chunkSectionIndex)); -+ dataBitsReader.setIndex(chunkPacketInfoAntiXray.getOrCreateIdForIndex(chunkSectionIndex)); -+ solidTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex), solid, solidGlobal); -+ obfuscateTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex), obfuscate, obfuscateGlobal); -+ //Read the blocks of the upper layer of the chunk section below if it exists -+ ChunkSection belowChunkSection = null; -+ boolean skipFirstLayer = chunkSectionIndex == 0 || (belowChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex - 1]) == Chunk.EMPTY_CHUNK_SECTION; ++ dataBitsWriter.setBitsPerObject(chunkPacketInfoAntiXray.getBitsPerObject(chunkSectionIndex)); ++ nearbyChunkSections[0] = chunkPacketInfoAntiXray.getNearbyChunks()[0] == null ? Chunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[0].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[1] = chunkPacketInfoAntiXray.getNearbyChunks()[1] == null ? Chunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[1].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[2] = chunkPacketInfoAntiXray.getNearbyChunks()[2] == null ? Chunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[2].getSections()[chunkSectionIndex]; ++ nearbyChunkSections[3] = chunkPacketInfoAntiXray.getNearbyChunks()[3] == null ? Chunk.EMPTY_CHUNK_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++) { ++ boolean[][] temp = current; ++ current = next; ++ next = nextNext; ++ nextNext = temp; ++ counter = obfuscateLayer(y, dataBitsReader, dataBitsWriter, solidTemp, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, nearbyChunkSections, counter); ++ } ++ ++ // Check if the chunk section above doesn't need obfuscation ++ if (chunkSectionIndex == maxChunkSectionIndex || !chunkPacketInfoAntiXray.isWritten(chunkSectionIndex + 1) || chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex + 1) == null) { ++ // 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 ++ ChunkSection aboveChunkSection; ++ ++ if (chunkSectionIndex != 15 && (aboveChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex + 1]) != Chunk.EMPTY_CHUNK_SECTION) { ++ boolean[][] temp = current; ++ current = next; ++ next = nextNext; ++ nextNext = temp; + + for (int z = 0; z < 16; z++) { + for (int x = 0; x < 16; x++) { -+ current[z][x] = true; -+ next[z][x] = skipFirstLayer || !solidGlobal[ChunkSection.GLOBAL_PALETTE.getOrCreateIdFor(belowChunkSection.getType(x, 15, z))]; -+ } -+ } -+ -+ //Abuse the obfuscateLayer method to read the blocks of the first layer of the current chunk section -+ dataBitsWriter.setBitsPerObject(0); -+ obfuscateLayer(-1, dataBitsReader, dataBitsWriter, solidTemp, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, emptyNearbyChunkSections, counter); -+ } -+ -+ dataBitsWriter.setBitsPerObject(chunkPacketInfoAntiXray.getBitsPerObject(chunkSectionIndex)); -+ nearbyChunkSections[0] = chunkPacketInfoAntiXray.getNearbyChunks()[0] == null ? Chunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[0].getSections()[chunkSectionIndex]; -+ nearbyChunkSections[1] = chunkPacketInfoAntiXray.getNearbyChunks()[1] == null ? Chunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[1].getSections()[chunkSectionIndex]; -+ nearbyChunkSections[2] = chunkPacketInfoAntiXray.getNearbyChunks()[2] == null ? Chunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[2].getSections()[chunkSectionIndex]; -+ nearbyChunkSections[3] = chunkPacketInfoAntiXray.getNearbyChunks()[3] == null ? Chunk.EMPTY_CHUNK_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++) { -+ boolean[][] temp = current; -+ current = next; -+ next = nextNext; -+ nextNext = temp; -+ counter = obfuscateLayer(y, dataBitsReader, dataBitsWriter, solidTemp, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, nearbyChunkSections, counter); -+ } -+ -+ //Check if the chunk section above doesn't need obfuscation -+ if (chunkSectionIndex == maxChunkSectionIndex || !chunkPacketInfoAntiXray.isWritten(chunkSectionIndex + 1) || chunkPacketInfoAntiXray.getPredefinedObjects(chunkSectionIndex + 1) == null) { -+ //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 -+ ChunkSection aboveChunkSection; -+ -+ if (chunkSectionIndex != 15 && (aboveChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex + 1]) != Chunk.EMPTY_CHUNK_SECTION) { -+ boolean[][] temp = current; -+ current = next; -+ next = nextNext; -+ nextNext = temp; -+ -+ for (int z = 0; z < 16; z++) { -+ for (int x = 0; x < 16; x++) { -+ if (!solidGlobal[ChunkSection.GLOBAL_PALETTE.getOrCreateIdFor(aboveChunkSection.getType(x, 0, z))]) { -+ current[z][x] = true; -+ } ++ if (!solidGlobal[ChunkSection.GLOBAL_PALETTE.getOrCreateIdFor(aboveChunkSection.getType(x, 0, z))]) { ++ current[z][x] = true; + } + } -+ -+ //There is nothing to read anymore -+ dataBitsReader.setBitsPerObject(0); -+ solid[0] = true; -+ counter = obfuscateLayer(15, dataBitsReader, dataBitsWriter, solid, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, nearbyChunkSections, counter); + } -+ } else { -+ //If not, initialize the reader and other stuff for the chunk section above to obfuscate the upper layer of the current chunk section -+ dataBitsReader.setBitsPerObject(chunkPacketInfoAntiXray.getBitsPerObject(chunkSectionIndex + 1)); -+ dataBitsReader.setIndex(chunkPacketInfoAntiXray.getOrCreateIdForIndex(chunkSectionIndex + 1)); -+ solidTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex + 1), solid, solidGlobal); -+ obfuscateTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex + 1), obfuscate, obfuscateGlobal); -+ boolean[][] temp = current; -+ current = next; -+ next = nextNext; -+ nextNext = temp; -+ counter = obfuscateLayer(15, dataBitsReader, dataBitsWriter, solidTemp, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, nearbyChunkSections, counter); ++ ++ // There is nothing to read anymore ++ dataBitsReader.setBitsPerObject(0); ++ solid[0] = true; ++ counter = obfuscateLayer(15, dataBitsReader, dataBitsWriter, solid, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, nearbyChunkSections, counter); + } -+ -+ dataBitsWriter.finish(); -+ } -+ } -+ -+ chunkPacketInfoAntiXray.getPacketPlayOutMapChunk().setReady(true); -+ -+ } finally { -+ if (chunkPacketInfoAntiXray.ticketHold != null) { -+ Runnable runnable = () -> { -+ Chunk chunk = chunkPacketInfoAntiXray.getChunk(); -+ ChunkCoordIntPair chunkPos = chunk.getPos(); -+ -+ ChunkPacketBlockControllerAntiXray.this.removeXrayTickets(chunkPos.x, chunkPos.z, (ChunkProviderServer) chunk.world.getChunkProvider(), -+ chunkPacketInfoAntiXray.ticketHold); -+ }; -+ if (MinecraftServer.getServer().isMainThread()) { -+ runnable.run(); + } else { -+ MinecraftServer.getServer().scheduleOnMain(runnable); ++ // If not, initialize the reader and other stuff for the chunk section above to obfuscate the upper layer of the current chunk section ++ dataBitsReader.setBitsPerObject(chunkPacketInfoAntiXray.getBitsPerObject(chunkSectionIndex + 1)); ++ dataBitsReader.setIndex(chunkPacketInfoAntiXray.getDataBitsIndex(chunkSectionIndex + 1)); ++ solidTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex + 1), solid, solidGlobal); ++ obfuscateTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex + 1), obfuscate, obfuscateGlobal); ++ boolean[][] temp = current; ++ current = next; ++ next = nextNext; ++ nextNext = temp; ++ counter = obfuscateLayer(15, dataBitsReader, dataBitsWriter, solidTemp, obfuscateTemp, predefinedBlockDataBitsTemp, current, next, nextNext, nearbyChunkSections, counter); + } ++ ++ dataBitsWriter.finish(); + } + } ++ ++ chunkPacketInfoAntiXray.getPacketPlayOutMapChunk().setReady(true); + } + + private int obfuscateLayer(int y, DataBitsReader dataBitsReader, DataBitsWriter dataBitsWriter, boolean[] solid, boolean[] obfuscate, int[] predefinedBlockDataBits, boolean[][] current, boolean[][] next, boolean[][] nextNext, ChunkSection[] nearbyChunkSections, int counter) { -+ //First block of first line ++ // First block of first line + int dataBits = dataBitsReader.read(); + + if (nextNext[0][0] = !solid[dataBits]) { @@ -561,7 +422,7 @@ index 0000000000..23626bef3a + next[0][0] = true; + } + -+ //First line ++ // First line + for (int x = 1; x < 15; x++) { + dataBits = dataBitsReader.read(); + @@ -587,7 +448,7 @@ index 0000000000..23626bef3a + } + } + -+ //Last block of first line ++ // Last block of first line + dataBits = dataBitsReader.read(); + + if (nextNext[0][15] = !solid[dataBits]) { @@ -610,9 +471,9 @@ index 0000000000..23626bef3a + next[0][15] = true; + } + -+ //All inner lines ++ // All inner lines + for (int z = 1; z < 15; z++) { -+ //First block ++ // First block + dataBits = dataBitsReader.read(); + + if (nextNext[z][0] = !solid[dataBits]) { @@ -636,7 +497,7 @@ index 0000000000..23626bef3a + next[z][0] = true; + } + -+ //All inner blocks ++ // All inner blocks + for (int x = 1; x < 15; x++) { + dataBits = dataBitsReader.read(); + @@ -663,7 +524,7 @@ index 0000000000..23626bef3a + } + } + -+ //Last block ++ // Last block + dataBits = dataBitsReader.read(); + + if (nextNext[z][15] = !solid[dataBits]) { @@ -688,7 +549,7 @@ index 0000000000..23626bef3a + } + } + -+ //First block of last line ++ // First block of last line + dataBits = dataBitsReader.read(); + + if (nextNext[15][0] = !solid[dataBits]) { @@ -711,7 +572,7 @@ index 0000000000..23626bef3a + next[15][0] = true; + } + -+ //Last line ++ // Last line + for (int x = 1; x < 15; x++) { + dataBits = dataBitsReader.read(); + @@ -737,7 +598,7 @@ index 0000000000..23626bef3a + } + } + -+ //Last block of last line ++ // Last block of last line + dataBits = dataBitsReader.read(); + + if (nextNext[15][15] = !solid[dataBits]) { @@ -826,7 +687,7 @@ index 0000000000..23626bef3a + updateBlock(world, blockPosition.north()); + updateBlock(world, blockPosition.south()); + } else { -+ //Do nothing if updateRadius <= 0 (test mode) ++ // Do nothing if updateRadius <= 0 (test mode) + } + } + @@ -834,7 +695,7 @@ index 0000000000..23626bef3a + IBlockData blockData = world.getTypeIfLoaded(blockPosition); + + if (blockData != null && obfuscateGlobal[ChunkSection.GLOBAL_PALETTE.getOrCreateIdFor(blockData)]) { -+ //world.notify(blockPosition, blockData, blockData, 3); ++ // world.notify(blockPosition, blockData, blockData, 3); + ((WorldServer)world).getChunkProvider().flagDirty(blockPosition); // We only need to re-send to client + } + } @@ -870,43 +731,10 @@ index 0000000000..23626bef3a + return description; + } + } -+ -+ public enum ChunkEdgeMode { -+ -+ DEFAULT(1, "default"), -+ WAIT(2, "wait until nearby chunks are loaded"), -+ LOAD(3, "load nearby chunks"); -+ -+ private final int id; -+ private final String description; -+ -+ ChunkEdgeMode(int id, String description) { -+ this.id = id; -+ this.description = description; -+ } -+ -+ public static ChunkEdgeMode getById(int id) { -+ for (ChunkEdgeMode chunkEdgeMode : values()) { -+ if (chunkEdgeMode.id == id) { -+ return chunkEdgeMode; -+ } -+ } -+ -+ return null; -+ } -+ -+ public int getId() { -+ return id; -+ } -+ -+ public String getDescription() { -+ return description; -+ } -+ } +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java new file mode 100644 -index 0000000000..a68bace353 +index 00000000000..41618994b46 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java @@ -0,0 +0,0 @@ @@ -970,7 +798,7 @@ index 0000000000..a68bace353 + dataPalettes[chunkSectionIndex] = dataPalette; + } + -+ public int getOrCreateIdForIndex(int chunkSectionIndex) { ++ public int getDataBitsIndex(int chunkSectionIndex) { + return dataBitsIndexes[chunkSectionIndex]; + } + @@ -993,7 +821,7 @@ index 0000000000..a68bace353 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java new file mode 100644 -index 0000000000..067dfb2f14 +index 00000000000..e61421d87a1 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java @@ -0,0 +0,0 @@ @@ -1003,11 +831,10 @@ index 0000000000..067dfb2f14 +import net.minecraft.server.IBlockData; +import net.minecraft.server.PacketPlayOutMapChunk; + -+public class ChunkPacketInfoAntiXray extends ChunkPacketInfo implements Runnable { ++public final class ChunkPacketInfoAntiXray extends ChunkPacketInfo implements Runnable { + + private Chunk[] nearbyChunks; + private final ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray; -+ public Integer ticketHold; + + public ChunkPacketInfoAntiXray(PacketPlayOutMapChunk packetPlayOutMapChunk, Chunk chunk, int chunkSectionSelector, + ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray) { @@ -1030,13 +857,13 @@ index 0000000000..067dfb2f14 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java new file mode 100644 -index 0000000000..cc586827aa +index 00000000000..c5a7b186e96 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.antixray; + -+public class DataBitsReader { ++public final class DataBitsReader { + + private byte[] dataBits; + private int bitsPerObject; @@ -1092,13 +919,13 @@ index 0000000000..cc586827aa +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java new file mode 100644 -index 0000000000..37093419cf +index 00000000000..2eff19f6aaa --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.antixray; + -+public class DataBitsWriter { ++public final class DataBitsWriter { + + private byte[] dataBits; + private int bitsPerObject; @@ -1181,7 +1008,7 @@ index 0000000000..37093419cf + } +} diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index af0d6aff4d..472d3a4c03 100644 +index af0d6aff4de..2604fe9756e 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -1189,12 +1016,12 @@ index af0d6aff4d..472d3a4c03 100644 } - chunksection = new ChunkSection(j >> 4 << 4); -+ chunksection = new ChunkSection(j >> 4 << 4, this, this.world, true); // Paper - Anti-Xray ++ chunksection = new ChunkSection(j >> 4 << 4, this, this.world, true); // Paper - Anti-Xray - Add parameters this.sections[j >> 4] = chunksection; } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 8e4b3e52cb..79e85520f3 100644 +index 8e4b3e52cbc..d287ea55c55 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader { @@ -1202,7 +1029,7 @@ index 8e4b3e52cb..79e85520f3 100644 if (nbttagcompound2.hasKeyOfType("Palette", 9) && nbttagcompound2.hasKeyOfType("BlockStates", 12)) { - ChunkSection chunksection = new ChunkSection(b0 << 4); -+ ChunkSection chunksection = new ChunkSection(b0 << 4, null, worldserver, false); // Paper - Anti-Xray ++ ChunkSection chunksection = new ChunkSection(b0 << 4, null, worldserver, false); // Paper - Anti-Xray - Add parameters chunksection.getBlocks().a(nbttagcompound2.getList("Palette", 10), nbttagcompound2.getLongArray("BlockStates")); chunksection.recalcBlockCounts(); @@ -1211,58 +1038,75 @@ index 8e4b3e52cb..79e85520f3 100644 }); } else { - ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1); -+ ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray ++ ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter protochunk.a(biomestorage); object = protochunk; diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 0d5deee365..4526527aca 100644 +index e056fbcb216..eeb7eee925d 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -0,0 +0,0 @@ public class ChunkSection { +@@ -0,0 +0,0 @@ + package net.minecraft.server; - public static final DataPalette GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); - private final int yPos; -- private short nonEmptyBlockCount; -+ short nonEmptyBlockCount; // Paper - private -> package-private - private short tickingBlockCount; ++import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info + import javax.annotation.Nullable; + + public class ChunkSection { +@@ -0,0 +0,0 @@ public class ChunkSection { private short e; final DataPaletteBlock blockIds; - public ChunkSection(int i) { +- public ChunkSection(int i) { - this(i, (short) 0, (short) 0, (short) 0); -+ // Paper start - add parameters -+ this(i, (IChunkAccess)null, (IWorldReader)null, true); -+ } -+ public ChunkSection(int i, IChunkAccess chunk, IWorldReader world, boolean initializeBlocks) { ++ // Paper start - Anti-Xray - Add parameters ++ @Deprecated public ChunkSection(int i) { this(i, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere ++ public ChunkSection(int i, IChunkAccess chunk, World world, boolean initializeBlocks) { + this(i, (short) 0, (short) 0, (short) 0, chunk, world, initializeBlocks); + // Paper end } - public ChunkSection(int i, short short0, short short1, short short2) { -+ // Paper start - add parameters -+ this(i, short0, short1, short2, (IChunkAccess)null, (IWorldReader)null, true); -+ } -+ public ChunkSection(int i, short short0, short short1, short short2, IChunkAccess chunk, IWorldReader world, boolean initializeBlocks) { +- public ChunkSection(int i, short short0, short short1, short short2) { ++ // Paper start - Anti-Xray - Add parameters ++ @Deprecated public ChunkSection(int i, short short0, short short1, short short2) { this(i, short0, short1, short2, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere ++ public ChunkSection(int i, short short0, short short1, short short2, IChunkAccess chunk, World world, boolean initializeBlocks) { + // Paper end this.yPos = i; this.nonEmptyBlockCount = short0; this.tickingBlockCount = short1; this.e = short2; - this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); -+ this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), world instanceof GeneratorAccess ? ((GeneratorAccess) world).getMinecraftWorld().chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, initializeBlocks) : null, initializeBlocks); // Paper - Anti-Xray - Add predefined block data ++ this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), world == null ? null : world.chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, initializeBlocks), initializeBlocks); // Paper - Anti-Xray - Add predefined block data } public IBlockData getType(int i, int j, int k) { +@@ -0,0 +0,0 @@ public class ChunkSection { + return this.blockIds; + } + +- public void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER +- public void b(PacketDataSerializer packetdataserializer) { ++ // Paper start - Anti-Xray - Add chunk packet info ++ @Deprecated public void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere ++ @Deprecated public void b(PacketDataSerializer packetdataserializer) { this.writeChunkSection(packetdataserializer, null); } // Notice for updates: Please make sure this method isn't used anywhere ++ public void writeChunkSection(PacketDataSerializer packetDataSerializer, ChunkPacketInfo chunkPacketInfo) { this.b(packetDataSerializer, chunkPacketInfo); } // OBFHELPER ++ public void b(PacketDataSerializer packetdataserializer, ChunkPacketInfo chunkPacketInfo) { ++ // Paper end + packetdataserializer.writeShort(this.nonEmptyBlockCount); +- this.blockIds.b(packetdataserializer); ++ this.blockIds.writeDataPaletteBlock(packetdataserializer, chunkPacketInfo, this.yPos >> 4); // Paper - Anti-Xray - Add chunk packet info + } + + public int j() { diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 2c1d1b1a55..44aed67274 100644 +index 2c1d1b1a556..2c7872bd051 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -0,0 +0,0 @@ package net.minecraft.server; import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2IntMap.Entry; -+import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray ++import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info import java.util.Arrays; import java.util.Objects; import java.util.concurrent.locks.ReentrantLock; @@ -1275,15 +1119,14 @@ index 2c1d1b1a55..44aed67274 100644 private DataPalette h; private DataPalette getDataPalette() { return this.h; } // Paper - OBFHELPER private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { + this.j.unlock(); } - public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T t0) { -+ // Paper start - Anti-Xray - Support default constructor -+ this(datapalette, registryblockid, function, function1, t0, null, true); -+ } -+ +- public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T t0) { ++ // Paper start - Anti-Xray - Add predefined objects ++ @Deprecated public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T t0) { this(datapalette, registryblockid, function, function1, t0, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere + public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T t0, T[] predefinedObjects, boolean initialize) { -+ // Paper end - Anti-Xray - Add predefined objects ++ // Paper end this.b = datapalette; this.d = registryblockid; this.e = function; @@ -1311,8 +1154,8 @@ index 2c1d1b1a55..44aed67274 100644 + } + } + // Paper end - } - ++ } ++ + // Paper start - Anti-Xray - Add predefined objects + private void addPredefinedObjects() { + if (this.predefinedObjects != null && this.getDataPalette() != this.getDataPaletteGlobal()) { @@ -1320,12 +1163,11 @@ index 2c1d1b1a55..44aed67274 100644 + this.getDataPalette().getOrCreateIdFor(this.predefinedObjects[i]); + } + } -+ } + } + // Paper end -+ + private static int b(int i, int j, int k) { return j << 8 | k << 4 | i; - } @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { int j; @@ -1335,18 +1177,20 @@ index 2c1d1b1a55..44aed67274 100644 T t1 = datapalette.a(databits.a(j)); @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { + return t0 == null ? this.g : t0; + } - public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER - public void b(PacketDataSerializer packetdataserializer) { -+ // Paper start - add parameters -+ this.writeDataPaletteBlock(packetdataserializer, null, 0); -+ } -+ public void writeDataPaletteBlock(PacketDataSerializer packetdataserializer, ChunkPacketInfo chunkPacketInfo, int chunkSectionIndex) { +- public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER +- public void b(PacketDataSerializer packetdataserializer) { ++ // Paper start - Anti-Xray - Add chunk packet info ++ @Deprecated public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere ++ @Deprecated public void b(PacketDataSerializer packetdataserializer) { this.writeDataPaletteBlock(packetdataserializer, null, 0); } // Notice for updates: Please make sure this method isn't used anywhere ++ public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer, ChunkPacketInfo chunkPacketInfo, int chunkSectionIndex) { this.b(packetDataSerializer, chunkPacketInfo, chunkSectionIndex); } // OBFHELPER ++ public void b(PacketDataSerializer packetdataserializer, ChunkPacketInfo chunkPacketInfo, int chunkSectionIndex) { + // Paper end this.a(); packetdataserializer.writeByte(this.i); this.h.b(packetdataserializer); -+ + // Paper start - Anti-Xray - Add chunk packet info + if (chunkPacketInfo != null) { + chunkPacketInfo.setBitsPerObject(chunkSectionIndex, this.getBitsPerObject()); @@ -1355,7 +1199,6 @@ index 2c1d1b1a55..44aed67274 100644 + chunkPacketInfo.setPredefinedObjects(chunkSectionIndex, this.predefinedObjects); + } + // Paper end -+ packetdataserializer.a(this.a.a()); this.b(); } @@ -1377,7 +1220,7 @@ index 2c1d1b1a55..44aed67274 100644 if (this.h == this.b) { diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 02a9f3d5fa..55441e1002 100644 +index 02a9f3d5fa4..55441e10023 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -1432,13 +1275,13 @@ index 02a9f3d5fa..55441e1002 100644 public void a() { this.o(); diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 23223f3f45..e54663c214 100644 +index 23223f3f452..0d485064cac 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -0,0 +0,0 @@ package net.minecraft.server; -+import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray ++import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info import com.google.common.collect.Lists; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -1449,9 +1292,11 @@ index 23223f3f45..e54663c214 100644 + private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager - public PacketPlayOutMapChunk() {} ++ // Paper start - Async-Anti-Xray - Set the ready flag to true + public PacketPlayOutMapChunk() { -+ this.ready = true; // Paper - Async-Anti-Xray - Set the ready flag to true ++ this.ready = true; + } ++ // Paper end // Paper start private final java.util.List extraPackets = new java.util.ArrayList<>(); @@ -1459,12 +1304,7 @@ index 23223f3f45..e54663c214 100644 } // Paper end public PacketPlayOutMapChunk(Chunk chunk, int i) { -+ // Paper start - add forceLoad param -+ this(chunk, i, false); -+ } -+ public PacketPlayOutMapChunk(Chunk chunk, int i, boolean forceLoad) { -+ // Paper end -+ ChunkPacketInfo chunkPacketInfo = chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i, forceLoad); // Paper - Anti-Xray - Add chunk packet info ++ ChunkPacketInfo chunkPacketInfo = chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); this.a = chunkcoordintpair.x; @@ -1477,8 +1317,8 @@ index 23223f3f45..e54663c214 100644 + if (chunkPacketInfo != null) { + chunkPacketInfo.setData(this.getData()); + } ++ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); + // Paper end -+ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info this.g = Lists.newArrayList(); iterator = chunk.getTileEntities().entrySet().iterator(); int totalTileEntities = 0; // Paper @@ -1486,7 +1326,7 @@ index 23223f3f45..e54663c214 100644 this.g.add(nbttagcompound); } } -+ chunk.world.chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo, forceLoad, null); // Paper - Anti-Xray - Modify blocks ++ chunk.world.chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks + } + // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag @@ -1503,13 +1343,16 @@ index 23223f3f45..e54663c214 100644 public void a(PacketDataSerializer packetdataserializer) throws IOException { this.a = packetdataserializer.readInt(); @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { + return bytebuf; + } - public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER - public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { -+ // Paper start - Add parameter -+ return this.writeChunk(packetdataserializer, chunk, i, null); -+ } -+ public int writeChunk(PacketDataSerializer packetdataserializer, Chunk chunk, int i, ChunkPacketInfo chunkPacketInfo) { +- public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER +- public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { ++ // Paper start - Anti-Xray - Add chunk packet info ++ @Deprecated public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere ++ @Deprecated public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { return this.writeChunk(packetdataserializer, chunk, i, null); } // Notice for updates: Please make sure this method isn't used anywhere ++ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector, ChunkPacketInfo chunkPacketInfo) { return this.a(packetDataSerializer, chunk, chunkSectionSelector, chunkPacketInfo); } // OBFHELPER ++ public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i, ChunkPacketInfo chunkPacketInfo) { + // Paper end int j = 0; ChunkSection[] achunksection = chunk.getSections(); @@ -1519,38 +1362,12 @@ index 23223f3f45..e54663c214 100644 if (chunksection != Chunk.a && (!this.f() || !chunksection.c()) && (i & 1 << k) != 0) { j |= 1 << k; - chunksection.b(packetdataserializer); -+ packetdataserializer.writeShort(chunksection.nonEmptyBlockCount); // Paper - Anti-Xray - Add chunk packet info -+ chunksection.getBlocks().writeDataPaletteBlock(packetdataserializer, chunkPacketInfo, k); // Paper - Anti-Xray - Add chunk packet info ++ chunksection.writeChunkSection(packetdataserializer, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info } } -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 040d4b41ea..f1620ba80e 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -0,0 +0,0 @@ public class PlayerChunk { - World world = chunk.getWorld(); - - if (this.dirtyCount == 64) { -+ // Paper start - Anti-Xray - Load nearby chunks if necessary -+ if (!chunk.world.chunkPacketBlockController.onChunkPacketCreate(chunk, '\uffff', false)) { -+ return; -+ } -+ // Paper end - this.s = -1; - } - -@@ -0,0 +0,0 @@ public class PlayerChunk { - this.a(world, blockposition); - } - } else if (this.dirtyCount == 64) { -- this.a(new PacketPlayOutMapChunk(chunk, this.r), false); -+ this.a(new PacketPlayOutMapChunk(chunk, this.r, true), false); // Paper - Anti-Xray - } else if (this.dirtyCount != 0) { - this.a(new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, chunk), false); - diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 9171785ad5..eb29d0e956 100644 +index 9171785ad54..94b0c54d9d4 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -1558,21 +1375,12 @@ index 9171785ad5..eb29d0e956 100644 } - return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a)); -+ return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray ++ return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter }, this.executor); } -@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - private void a(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { - if (apacket[0] == null) { -- apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); -+ apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, true); // Paper - Anti-Xray - apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine); - } - diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 17b7eddac4..ce66090b8d 100644 +index 17b7eddac4f..ce66090b8dc 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -0,0 +0,0 @@ public class PlayerInteractManager { @@ -1585,34 +1393,32 @@ index 17b7eddac4..ce66090b8d 100644 public void a(BlockPosition blockposition, PacketPlayInBlockDig.EnumPlayerDigType packetplayinblockdig_enumplayerdigtype, String s) { diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 39339fa275..f376e21068 100644 +index 39339fa2755..deb7fb09019 100644 --- a/src/main/java/net/minecraft/server/ProtoChunk.java +++ b/src/main/java/net/minecraft/server/ProtoChunk.java @@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { private long s; private final Map t; private volatile boolean u; -+ private final GeneratorAccess world; // Paper - Anti-Xray ++ private final World world; // Paper - Anti-Xray - Add world - public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter) { -+ // Paper start - add world parameter -+ this(chunkcoordintpair, chunkconverter, (GeneratorAccess)null); -+ } -+ public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, GeneratorAccess world) { +- public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter) { ++ // Paper start - Anti-Xray - Add world ++ @Deprecated public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter) { this(chunkcoordintpair, chunkconverter, null); } // Notice for updates: Please make sure this constructor isn't used anywhere ++ public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, World world) { + // Paper end this(chunkcoordintpair, chunkconverter, (ChunkSection[]) null, new ProtoChunkTickList<>((block) -> { return block == null || block.getBlockData().isAir(); }, chunkcoordintpair), new ProtoChunkTickList<>((fluidtype) -> { return fluidtype == null || fluidtype == FluidTypes.EMPTY; - }, chunkcoordintpair)); -+ }, chunkcoordintpair), world); // Paper - add world parameter ++ }, chunkcoordintpair), world); // Paper - Anti-Xray - Add world } - public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, @Nullable ChunkSection[] achunksection, ProtoChunkTickList protochunkticklist, ProtoChunkTickList protochunkticklist1) { -+ // Paper start - add world parameter -+ this(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, (GeneratorAccess)null); -+ } -+ public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, @Nullable ChunkSection[] achunksection, ProtoChunkTickList protochunkticklist, ProtoChunkTickList protochunkticklist1, GeneratorAccess world) { +- public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, @Nullable ChunkSection[] achunksection, ProtoChunkTickList protochunkticklist, ProtoChunkTickList protochunkticklist1) { ++ // Paper start - Anti-Xray - Add world ++ @Deprecated public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, @Nullable ChunkSection[] achunksection, ProtoChunkTickList protochunkticklist, ProtoChunkTickList protochunkticklist1) { this(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, null); } // Notice for updates: Please make sure this constructor isn't used anywhere ++ public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, @Nullable ChunkSection[] achunksection, ProtoChunkTickList protochunkticklist, ProtoChunkTickList protochunkticklist1, World world) { + this.world = world; + // Paper end this.f = Maps.newEnumMap(HeightMap.Type.class); @@ -1623,24 +1429,25 @@ index 39339fa275..f376e21068 100644 public ChunkSection a(int i) { if (this.j[i] == Chunk.a) { - this.j[i] = new ChunkSection(i << 4); -+ this.j[i] = new ChunkSection(i << 4, this, this.world, true); // Paper - Anti-Xray ++ this.j[i] = new ChunkSection(i << 4, this, this.world, true); // Paper - Anti-Xray - Add parameters } return this.j[i]; -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 75ab9f185b..4cf28bc2df 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java -@@ -0,0 +0,0 @@ public class TicketType { - public static final TicketType PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit - public static final TicketType PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit - public static final TicketType FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper -+ public static final TicketType ANTIXRAY = a("antixray", Integer::compareTo); // Paper - Anti-Xray +diff --git a/src/main/java/net/minecraft/server/ProtoChunkExtension.java b/src/main/java/net/minecraft/server/ProtoChunkExtension.java +index 01bf28dc34d..caa18b046cd 100644 +--- a/src/main/java/net/minecraft/server/ProtoChunkExtension.java ++++ b/src/main/java/net/minecraft/server/ProtoChunkExtension.java +@@ -0,0 +0,0 @@ public class ProtoChunkExtension extends ProtoChunk { + private final Chunk a; + + public ProtoChunkExtension(Chunk chunk) { +- super(chunk.getPos(), ChunkConverter.a); ++ super(chunk.getPos(), ChunkConverter.a, chunk.world); // Paper - Anti-Xray - Add parameter + this.a = chunk; + } - public static TicketType a(String s, Comparator comparator) { - return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8cf3c10274..0bde171743 100644 +index 8cf3c10274b..0bde1717431 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ package net.minecraft.server; @@ -1676,19 +1483,41 @@ index 8cf3c10274..0bde171743 100644 if (iblockdata1 == null) { // CraftBukkit start - remove blockstate if failed (or the same) +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +index a53bb7295c5..47f1b970b9b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { + private final WorldServer worldServer; + private final int x; + private final int z; +- private static final DataPaletteBlock emptyBlockIDs = new ChunkSection(0).getBlocks(); ++ private static final DataPaletteBlock emptyBlockIDs = new ChunkSection(0, null, null, true).getBlocks(); // Paper - Anti-Xray - Add parameters + private static final byte[] emptyLight = new byte[2048]; + + public CraftChunk(net.minecraft.server.Chunk chunk) { +@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { + NBTTagCompound data = new NBTTagCompound(); + cs[i].getBlocks().a(data, "Palette", "BlockStates"); + +- DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection ++ DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no predefined block data and don't initialize because it's done in the line below internally + blockids.a(data.getList("Palette", CraftMagicNumbers.NBT.TAG_COMPOUND), data.getLongArray("BlockStates")); + + sectionBlockIDs[i] = blockids; diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java -index 8191e7c348..969d548de2 100644 +index 8191e7c3489..bb18740ebdf 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -0,0 +0,0 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { private final int maxHeight; private final ChunkSection[] sections; private Set tiles; -+ private World world; // Paper - Anti-Xray ++ private World world; // Paper - Anti-Xray - Add world public CraftChunkData(World world) { this(world.getMaxHeight()); -+ this.world = world; // Paper - Anti-Xray ++ this.world = world; // Paper - Anti-Xray - Add world } /* pp for tests */ CraftChunkData(int maxHeight) { @@ -1697,7 +1526,7 @@ index 8191e7c348..969d548de2 100644 ChunkSection section = sections[y >> 4]; if (create && section == null) { - sections[y >> 4] = section = new ChunkSection(y >> 4 << 4); -+ sections[y >> 4] = section = new ChunkSection(y >> 4 << 4, null, world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) world).getHandle() : null, true); // Paper - Anti-Xray ++ sections[y >> 4] = section = new ChunkSection(y >> 4 << 4, null, world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) world).getHandle() : null, true); // Paper - Anti-Xray - Add parameters } return section; } diff --git a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch index 1d971c8caa..6ea76b1fd0 100644 --- a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch @@ -121,7 +121,7 @@ tasks required to be executed by the chunk load task (i.e lighting and some poi tasks). diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -index fa1c920ea6..98acbfa44d 100644 +index fa1c920ea60..98acbfa44dd 100644 --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +0,0 @@ public class WorldTimingsHandler { @@ -161,7 +161,7 @@ index fa1c920ea6..98acbfa44d 100644 public static Timing getTickList(WorldServer worldserver, String timingsType) { diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index dbd1439970..f4836e2da1 100644 +index dbd14399707..f4836e2da10 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ @@ -222,89 +222,9 @@ index dbd1439970..f4836e2da1 100644 + } + } } -diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java -index 23626bef3a..1edcecd2ee 100644 ---- a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java -+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java -@@ -0,0 +0,0 @@ import java.util.concurrent.Executors; - import java.util.concurrent.atomic.AtomicInteger; - import java.util.function.Supplier; - -+import com.destroystokyo.paper.io.PrioritizedTaskQueue; - import net.minecraft.server.*; - import org.bukkit.Bukkit; - import org.bukkit.World.Environment; -@@ -0,0 +0,0 @@ public class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockControll - - private final AtomicInteger xrayRequests = new AtomicInteger(); - -+ // Paper start - async chunk api -+ private Integer nextTicketHold() { -+ return Integer.valueOf(this.xrayRequests.getAndIncrement()); -+ } -+ // Paper end -+ - private Integer addXrayTickets(final int x, final int z, final ChunkProviderServer chunkProvider) { - final Integer hold = Integer.valueOf(this.xrayRequests.getAndIncrement()); - -@@ -0,0 +0,0 @@ public class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockControll - chunk.world.getChunkAt(locX, locZ + 1); - } - -+ // Paper start - async chunk api -+ private void loadNeighbourAsync(ChunkProviderServer chunkProvider, WorldServer world, int chunkX, int chunkZ, int[] counter, java.util.function.Consumer onNeighourLoad, Runnable onAllNeighboursLoad) { -+ chunkProvider.getChunkAtAsynchronously(chunkX, chunkZ, true, (Chunk neighbour) -> { -+ onNeighourLoad.accept(neighbour); -+ if (++counter[0] == 4) { -+ onAllNeighboursLoad.run(); -+ } -+ }); -+ world.asyncChunkTaskManager.raisePriority(chunkX, chunkZ, PrioritizedTaskQueue.HIGHER_PRIORITY); -+ } -+ -+ private void loadNeighboursAsync(Chunk chunk, java.util.function.Consumer onNeighourLoad, Runnable onAllNeighboursLoad) { -+ int[] loaded = new int[1]; -+ -+ int locX = chunk.getPos().x; -+ int locZ = chunk.getPos().z; -+ WorldServer world = ((WorldServer)chunk.world); -+ -+ onNeighourLoad.accept(chunk); -+ -+ ChunkProviderServer chunkProvider = world.getChunkProvider(); -+ -+ this.loadNeighbourAsync(chunkProvider, world, locX - 1, locZ, loaded, onNeighourLoad, onAllNeighboursLoad); -+ this.loadNeighbourAsync(chunkProvider, world, locX + 1, locZ, loaded, onNeighourLoad, onAllNeighboursLoad); -+ this.loadNeighbourAsync(chunkProvider, world, locX, locZ - 1, loaded, onNeighourLoad, onAllNeighboursLoad); -+ this.loadNeighbourAsync(chunkProvider, world, locX, locZ + 1, loaded, onNeighourLoad, onAllNeighboursLoad); -+ } -+ // Paper end -+ - @Override - public boolean onChunkPacketCreate(Chunk chunk, int chunkSectionSelector, boolean force) { - int locX = chunk.getPos().x; -@@ -0,0 +0,0 @@ public class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockControll - - if (chunks[0] == null || chunks[1] == null || chunks[2] == null || chunks[3] == null) { - // we need to load -- MinecraftServer.getServer().scheduleOnMain(() -> { -- Integer ticketHold = this.addXrayTickets(locX, locZ, world.getChunkProvider()); -- this.loadNeighbours(chunk); -+ // Paper start - async chunk api -+ Integer ticketHold = this.nextTicketHold(); -+ this.loadNeighboursAsync(chunk, (Chunk neighbour) -> { // when a neighbour is loaded -+ ((WorldServer)neighbour.world).getChunkProvider().addTicket(TicketType.ANTIXRAY, neighbour.getPos(), 0, ticketHold); -+ }, -+ () -> { // once neighbours get loaded - this.modifyBlocks(packetPlayOutMapChunk, chunkPacketInfo, false, ticketHold); - }); -+ // Paper end - return; - } - diff --git a/src/main/java/com/destroystokyo/paper/io/IOUtil.java b/src/main/java/com/destroystokyo/paper/io/IOUtil.java new file mode 100644 -index 0000000000..5af0ac3d9e +index 00000000000..5af0ac3d9e8 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/IOUtil.java @@ -0,0 +0,0 @@ @@ -372,7 +292,7 @@ index 0000000000..5af0ac3d9e +} diff --git a/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java new file mode 100644 -index 0000000000..4f10a8311e +index 00000000000..4f10a8311ea --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java @@ -0,0 +0,0 @@ @@ -1039,7 +959,7 @@ index 0000000000..4f10a8311e +} diff --git a/src/main/java/com/destroystokyo/paper/io/PrioritizedTaskQueue.java b/src/main/java/com/destroystokyo/paper/io/PrioritizedTaskQueue.java new file mode 100644 -index 0000000000..97f2e433c4 +index 00000000000..97f2e433c48 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/PrioritizedTaskQueue.java @@ -0,0 +0,0 @@ @@ -1322,7 +1242,7 @@ index 0000000000..97f2e433c4 +} diff --git a/src/main/java/com/destroystokyo/paper/io/QueueExecutorThread.java b/src/main/java/com/destroystokyo/paper/io/QueueExecutorThread.java new file mode 100644 -index 0000000000..ee906b594b +index 00000000000..ee906b594b3 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/QueueExecutorThread.java @@ -0,0 +0,0 @@ @@ -1569,7 +1489,7 @@ index 0000000000..ee906b594b +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java new file mode 100644 -index 0000000000..ac9bc3e231 +index 00000000000..ac9bc3e2316 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java @@ -0,0 +0,0 @@ @@ -1724,7 +1644,7 @@ index 0000000000..ac9bc3e231 +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java new file mode 100644 -index 0000000000..60312b85f9 +index 00000000000..60312b85f9e --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java @@ -0,0 +0,0 @@ @@ -1842,7 +1762,7 @@ index 0000000000..60312b85f9 +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java new file mode 100644 -index 0000000000..1dfa8abfd8 +index 00000000000..1dfa8abfd86 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java @@ -0,0 +0,0 @@ @@ -1888,7 +1808,7 @@ index 0000000000..1dfa8abfd8 +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java new file mode 100644 -index 0000000000..2b20c159f6 +index 00000000000..2b20c159f6b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java @@ -0,0 +0,0 @@ @@ -2385,7 +2305,7 @@ index 0000000000..2b20c159f6 + +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 4c9c8e4839..259af7095c 100644 +index 4c9c8e48397..259af7095c4 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -2555,7 +2475,7 @@ index 4c9c8e4839..259af7095c 100644 } finally { playerChunkMap.callbackExecutor.run(); diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 79e85520f3..7389aba1a4 100644 +index d287ea55c55..34cd09a503b 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; @@ -2820,7 +2740,7 @@ index 79e85520f3..7389aba1a4 100644 nbttagcompound1.set("PostProcessing", a(ichunkaccess.l())); diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index 134a4f0b7d..40ce30cdc2 100644 +index 134a4f0b7d2..40ce30cdc2a 100644 --- a/src/main/java/net/minecraft/server/ChunkStatus.java +++ b/src/main/java/net/minecraft/server/ChunkStatus.java @@ -0,0 +0,0 @@ public class ChunkStatus { @@ -2856,7 +2776,7 @@ index 134a4f0b7d..40ce30cdc2 100644 return this.c() >= chunkstatus.c(); } diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index 7e5ece9d50..cfe43e882e 100644 +index 7e5ece9d50a..cfe43e882e5 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler implements Mailbox { + public static final TicketType PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit public static final TicketType PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit public static final TicketType FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper - public static final TicketType ANTIXRAY = a("antixray", Integer::compareTo); // Paper - Anti-Xray + public static final TicketType ASYNC_LOAD = a("async_load", Long::compareTo); // Paper public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index c999f8c9bf..b59ef1a633 100644 +index c999f8c9bf8..b59ef1a6333 100644 --- a/src/main/java/net/minecraft/server/VillagePlace.java +++ b/src/main/java/net/minecraft/server/VillagePlace.java @@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection { @@ -3983,7 +3903,7 @@ index c999f8c9bf..b59ef1a633 100644 HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 8561f96b9a..c0476f69e4 100644 +index 8561f96b9a1..c0476f69e4a 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -4089,7 +4009,7 @@ index 8561f96b9a..c0476f69e4 100644 } public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 50467656df..d3ac0ffe46 100644 +index 50467656df0..d3ac0ffe468 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { @@ -4150,7 +4070,7 @@ index 50467656df..d3ac0ffe46 100644 // Spigot start @Override diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 07936eeba2..5bdcdcf9e8 100644 +index 07936eeba2a..5bdcdcf9e85 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -0,0 +0,0 @@ import java.lang.management.ThreadInfo; diff --git a/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch b/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch index ff67267198..f0cf5ee9c4 100644 --- a/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch +++ b/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch @@ -8,7 +8,7 @@ This allows you to solve an issue in vanilla behavior where: * On normal difficulty they will have a 50% of getting infected or dying. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index c7cde1d0a0..7ca67a4aa5 100644 +index b773b750ae4..c3af4c9a9fe 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -22,7 +22,7 @@ index c7cde1d0a0..7ca67a4aa5 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 8635d4f40c..07ebc1d816 100644 +index 8635d4f40ca..07ebc1d8161 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { diff --git a/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch b/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch index 31e39a3634..07095b263d 100644 --- a/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch +++ b/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch @@ -25,12 +25,12 @@ P3) Solutions for 1) and especially 2) might not be future-proof, while this server-internal fix makes this change future-proof. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4c50109365..a09282e00e 100644 +index a3fc76b5122..90ba51e05bb 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { } - log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); + log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); } + + public boolean disableRelativeProjectileVelocity; @@ -39,7 +39,7 @@ index 4c50109365..a09282e00e 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 634e2bd304..9c97edf9c9 100644 +index 634e2bd3049..9c97edf9c9e 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile { @@ -52,7 +52,7 @@ index 634e2bd304..9c97edf9c9 100644 @Override diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 6c091b6808..f5c8074dcf 100644 +index 6c091b68087..f5c8074dcf1 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java @@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile { diff --git a/Spigot-Server-Patches/Fix-zero-tick-instant-grow-farms-MC-113809.patch b/Spigot-Server-Patches/Fix-zero-tick-instant-grow-farms-MC-113809.patch index 5fd58e9365..e0a1b4656a 100644 --- a/Spigot-Server-Patches/Fix-zero-tick-instant-grow-farms-MC-113809.patch +++ b/Spigot-Server-Patches/Fix-zero-tick-instant-grow-farms-MC-113809.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix zero-tick instant grow farms MC-113809 diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index e790326c9c..c37a0f035d 100644 +index 928fefb4195..44210855560 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -21,7 +21,7 @@ index e790326c9c..c37a0f035d 100644 public Map altItemDespawnRateMap; private void altItemDespawnRate() { diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 540fcce1dd..e29ec958b3 100644 +index 540fcce1dd4..e29ec958b35 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block implements IMaterial { @@ -33,7 +33,7 @@ index 540fcce1dd..e29ec958b3 100644 private final boolean i; private final boolean j; diff --git a/src/main/java/net/minecraft/server/BlockBamboo.java b/src/main/java/net/minecraft/server/BlockBamboo.java -index c482aad3e3..02c548dd9c 100644 +index c482aad3e3e..02c548dd9c9 100644 --- a/src/main/java/net/minecraft/server/BlockBamboo.java +++ b/src/main/java/net/minecraft/server/BlockBamboo.java @@ -0,0 +0,0 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { @@ -45,7 +45,7 @@ index c482aad3e3..02c548dd9c 100644 int i = this.b(worldserver, blockposition) + 1; diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index e0974e256f..3524fcb927 100644 +index e0974e256f0..3524fcb9278 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java @@ -0,0 +0,0 @@ public class BlockCactus extends Block { @@ -57,7 +57,7 @@ index e0974e256f..3524fcb927 100644 if (worldserver.isEmpty(blockposition1)) { diff --git a/src/main/java/net/minecraft/server/BlockChorusFlower.java b/src/main/java/net/minecraft/server/BlockChorusFlower.java -index d70b52cadf..b624cf3804 100644 +index d70b52cadf1..b624cf38047 100644 --- a/src/main/java/net/minecraft/server/BlockChorusFlower.java +++ b/src/main/java/net/minecraft/server/BlockChorusFlower.java @@ -0,0 +0,0 @@ public class BlockChorusFlower extends Block { @@ -69,7 +69,7 @@ index d70b52cadf..b624cf3804 100644 if (worldserver.isEmpty(blockposition1) && blockposition1.getY() < 256) { diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index 55b07444e1..3bc3c5aa29 100644 +index 55b07444e1d..3bc3c5aa29f 100644 --- a/src/main/java/net/minecraft/server/BlockReed.java +++ b/src/main/java/net/minecraft/server/BlockReed.java @@ -0,0 +0,0 @@ public class BlockReed extends Block { @@ -81,7 +81,7 @@ index 55b07444e1..3bc3c5aa29 100644 for (i = 1; worldserver.getType(blockposition.down(i)).getBlock() == this; ++i) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index fd8ca2a510..06d693ca2c 100644 +index 38c5b721bf1..17560a20fce 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/Generator-Settings.patch b/Spigot-Server-Patches/Generator-Settings.patch index 123b653306..42b85c2b75 100644 --- a/Spigot-Server-Patches/Generator-Settings.patch +++ b/Spigot-Server-Patches/Generator-Settings.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Generator Settings diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index fd3dbea628..e790326c9c 100644 +index 515673e0fec..928fefb4195 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ index fd3dbea628..e790326c9c 100644 + } } diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -index af81a84142..2268fbdd87 100644 +index af81a841428..2268fbdd871 100644 --- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java @@ -0,0 +0,0 @@ public abstract class ChunkGeneratorAbstract diff --git a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch index f893d65d2c..6a50b67125 100644 --- a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch +++ b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch @@ -16,7 +16,7 @@ lots of chunks already. This massively reduces the lag spikes from sync chunk gens. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 747305619b..746b5b5589 100644 +index 747305619b5..746b5b55896 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -59,7 +59,7 @@ index 747305619b..746b5b5589 100644 return ichunkaccess1; }, (playerchunk_failure) -> { diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 04b97cec29..568fbbd5f2 100644 +index 3d610e41969..4b341c81fc9 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { @@ -197,7 +197,7 @@ index 04b97cec29..568fbbd5f2 100644 private void d(int i) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index db5a35598d..22550f74df 100644 +index 00f26ae23da..6c178492b75 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { diff --git a/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch b/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch index f6f1fccd0c..d79fec57ab 100644 --- a/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch +++ b/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement alternative item-despawn-rate diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index a09282e00e..9d9260ad07 100644 +index 90ba51e05bb..b1d09eb457c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ @@ -17,9 +17,7 @@ index a09282e00e..9d9260ad07 100644 import java.util.List; +import java.util.Map; - import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.ChunkEdgeMode; import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode; - import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.configuration.ConfigurationSection; @@ -80,7 +78,7 @@ index a09282e00e..9d9260ad07 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index ef2cf6565b..507627a29f 100644 +index ef2cf6565b5..507627a29f6 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -0,0 +0,0 @@ import java.util.Objects; diff --git a/Spigot-Server-Patches/Increase-Light-Queue-Size.patch b/Spigot-Server-Patches/Increase-Light-Queue-Size.patch index a3066b6cf1..62736176b8 100644 --- a/Spigot-Server-Patches/Increase-Light-Queue-Size.patch +++ b/Spigot-Server-Patches/Increase-Light-Queue-Size.patch @@ -14,7 +14,7 @@ light engine on shutdown... The queue size only puts a cap on max loss, doesn't solve that problem. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 803be76772..3c0468bc44 100644 +index 3f44be577e3..a4815f5e69c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -28,7 +28,7 @@ index 803be76772..3c0468bc44 100644 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d1f82eff21..77adc64e30 100644 +index d1f82eff218..77adc64e30c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant exten @@ -31,7 +31,7 @@ index cd17bf2be5..b85e67a85d 100644 @Override diff --git a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java -index c76a43837b..e35ec2db07 100644 +index c76a43837b4..e35ec2db078 100644 --- a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java +++ b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java @@ -0,0 +0,0 @@ public class PathfinderTargetCondition { diff --git a/Spigot-Server-Patches/MC-Utils.patch b/Spigot-Server-Patches/MC-Utils.patch index bcfa03dcc1..b8207f8805 100644 --- a/Spigot-Server-Patches/MC-Utils.patch +++ b/Spigot-Server-Patches/MC-Utils.patch @@ -6,7 +6,7 @@ Subject: [PATCH] MC Utils diff --git a/src/main/java/com/destroystokyo/paper/util/concurrent/WeakSeqLock.java b/src/main/java/com/destroystokyo/paper/util/concurrent/WeakSeqLock.java new file mode 100644 -index 0000000000..4029dc68cf +index 00000000000..4029dc68cf3 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/concurrent/WeakSeqLock.java @@ -0,0 +0,0 @@ @@ -80,7 +80,7 @@ index 0000000000..4029dc68cf +} diff --git a/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Int.java b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Int.java new file mode 100644 -index 0000000000..59868f37d1 +index 00000000000..59868f37d14 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Int.java @@ -0,0 +0,0 @@ @@ -248,7 +248,7 @@ index 0000000000..59868f37d1 +} diff --git a/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Object.java b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Object.java new file mode 100644 -index 0000000000..7bab31a312 +index 00000000000..7bab31a3124 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/map/QueuedChangesMapLong2Object.java @@ -0,0 +0,0 @@ @@ -456,7 +456,7 @@ index 0000000000..7bab31a312 +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java new file mode 100644 -index 0000000000..4eac057786 +index 00000000000..4eac0577862 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java @@ -0,0 +0,0 @@ @@ -591,7 +591,7 @@ index 0000000000..4eac057786 +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java new file mode 100644 -index 0000000000..cdda74564c +index 00000000000..cdda74564ce --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java @@ -0,0 +0,0 @@ @@ -725,7 +725,7 @@ index 0000000000..cdda74564c +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java new file mode 100644 -index 0000000000..84ef8d9eca +index 00000000000..84ef8d9ecab --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java @@ -0,0 +0,0 @@ @@ -859,7 +859,7 @@ index 0000000000..84ef8d9eca +} diff --git a/src/main/java/com/destroystokyo/paper/util/math/IntegerUtil.java b/src/main/java/com/destroystokyo/paper/util/math/IntegerUtil.java new file mode 100644 -index 0000000000..c3b936f54b +index 00000000000..c3b936f54b3 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/math/IntegerUtil.java @@ -0,0 +0,0 @@ @@ -1095,7 +1095,7 @@ index 0000000000..c3b936f54b +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java new file mode 100644 -index 0000000000..c71ed11834 +index 00000000000..c71ed118345 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java @@ -0,0 +0,0 @@ @@ -1540,7 +1540,7 @@ index 0000000000..c71ed11834 +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java new file mode 100644 -index 0000000000..3f86c1ad43 +index 00000000000..3f86c1ad437 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java @@ -0,0 +0,0 @@ @@ -1721,7 +1721,7 @@ index 0000000000..3f86c1ad43 +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java new file mode 100644 -index 0000000000..8a552a87ab +index 00000000000..8a552a87abf --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java @@ -0,0 +0,0 @@ @@ -1754,7 +1754,7 @@ index 0000000000..8a552a87ab +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java new file mode 100644 -index 0000000000..0292afc522 +index 00000000000..0292afc5224 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java @@ -0,0 +0,0 @@ @@ -1784,7 +1784,7 @@ index 0000000000..0292afc522 +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PooledLinkedHashSets.java b/src/main/java/com/destroystokyo/paper/util/misc/PooledLinkedHashSets.java new file mode 100644 -index 0000000000..e51104e65a +index 00000000000..e51104e65a0 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/PooledLinkedHashSets.java @@ -0,0 +0,0 @@ @@ -2077,7 +2077,7 @@ index 0000000000..e51104e65a +} diff --git a/src/main/java/com/destroystokyo/paper/util/pooled/PooledObjects.java b/src/main/java/com/destroystokyo/paper/util/pooled/PooledObjects.java new file mode 100644 -index 0000000000..d4325f1f11 +index 00000000000..d4325f1f115 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/pooled/PooledObjects.java @@ -0,0 +0,0 @@ @@ -2268,7 +2268,7 @@ index 0000000000..d4325f1f11 +} diff --git a/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java new file mode 100644 -index 0000000000..9df0006c1a +index 00000000000..9df0006c1a2 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java @@ -0,0 +0,0 @@ @@ -2340,7 +2340,7 @@ index 0000000000..9df0006c1a + } +} diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java -index 4f60b931a1..f427953a83 100644 +index 4f60b931a14..f427953a83c 100644 --- a/src/main/java/net/minecraft/server/AxisAlignedBB.java +++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java @@ -0,0 +0,0 @@ public class AxisAlignedBB { @@ -2352,7 +2352,7 @@ index 4f60b931a1..f427953a83 100644 return this.a(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); } diff --git a/src/main/java/net/minecraft/server/BlockAccessAir.java b/src/main/java/net/minecraft/server/BlockAccessAir.java -index eff6ebcd30..30cbfc8eac 100644 +index eff6ebcd30b..30cbfc8eac2 100644 --- a/src/main/java/net/minecraft/server/BlockAccessAir.java +++ b/src/main/java/net/minecraft/server/BlockAccessAir.java @@ -0,0 +0,0 @@ public enum BlockAccessAir implements IBlockAccess { @@ -2375,7 +2375,7 @@ index eff6ebcd30..30cbfc8eac 100644 public IBlockData getType(BlockPosition blockposition) { return Blocks.AIR.getBlockData(); diff --git a/src/main/java/net/minecraft/server/BlockDataAbstract.java b/src/main/java/net/minecraft/server/BlockDataAbstract.java -index 1cf97cefc9..2040f18349 100644 +index 1cf97cefc9d..2040f183490 100644 --- a/src/main/java/net/minecraft/server/BlockDataAbstract.java +++ b/src/main/java/net/minecraft/server/BlockDataAbstract.java @@ -0,0 +0,0 @@ public abstract class BlockDataAbstract implements IBlockDataHolder { @@ -2387,7 +2387,7 @@ index 1cf97cefc9..2040f18349 100644 return this.d.containsKey(iblockstate); } diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index c88a62f6b7..f8ac39e1b0 100644 +index c88a62f6b72..f8ac39e1b01 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali @@ -2450,7 +2450,7 @@ index c88a62f6b7..f8ac39e1b0 100644 this.d = i; } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 55373cae07..b39ce329aa 100644 +index 55373cae078..b39ce329aa0 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -2681,7 +2681,7 @@ index 55373cae07..b39ce329aa 100644 // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java -index 11c4d23ba9..53c15c1c0b 100644 +index 11c4d23ba98..53c15c1c0bf 100644 --- a/src/main/java/net/minecraft/server/ChunkCache.java +++ b/src/main/java/net/minecraft/server/ChunkCache.java @@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { @@ -2715,7 +2715,7 @@ index 11c4d23ba9..53c15c1c0b 100644 @Override public TileEntity getTileEntity(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index 260644bf0b..f2a19acd84 100644 +index 260644bf0be..f2a19acd845 100644 --- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java @@ -0,0 +0,0 @@ public class ChunkCoordIntPair { @@ -2730,7 +2730,7 @@ index 260644bf0b..f2a19acd84 100644 } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 32c496fa88..ba2af2abe2 100644 +index 32c496fa88e..ba2af2abe2d 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -2962,8 +2962,20 @@ index 32c496fa88..ba2af2abe2 100644 @Nullable @Override public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { +diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java +index 652067757a6..638b0e39798 100644 +--- a/src/main/java/net/minecraft/server/ChunkSection.java ++++ b/src/main/java/net/minecraft/server/ChunkSection.java +@@ -0,0 +0,0 @@ public class ChunkSection { + return this.blockIds; + } + ++ public void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeShort(this.nonEmptyBlockCount); + this.blockIds.b(packetdataserializer); diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 7ca3a1d0c5..2edd9b8714 100644 +index 7ca3a1d0c59..2edd9b87146 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -0,0 +0,0 @@ public class DataBits { @@ -2975,7 +2987,7 @@ index 7ca3a1d0c5..2edd9b8714 100644 return this.a; } diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java -index 75ba698868..45403fbe30 100644 +index 75ba6988687..45403fbe308 100644 --- a/src/main/java/net/minecraft/server/DataPalette.java +++ b/src/main/java/net/minecraft/server/DataPalette.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -2992,7 +3004,7 @@ index 75ba698868..45403fbe30 100644 T a(int i); diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 774a8f5434..d5f5a51872 100644 +index 774a8f54342..d5f5a51872d 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -0,0 +0,0 @@ import java.util.stream.Collectors; @@ -3034,7 +3046,7 @@ index 774a8f5434..d5f5a51872 100644 this.a(); packetdataserializer.writeByte(this.i); diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index fe69161e5b..b40c8d2f83 100644 +index fe69161e5b9..b40c8d2f83a 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityUnleashEvent; @@ -3047,7 +3059,7 @@ index fe69161e5b..b40c8d2f83 100644 super(entitytypes, world); } diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index bdfb173853..0b06fa2b66 100644 +index bdfb1738539..0b06fa2b664 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -3059,7 +3071,7 @@ index bdfb173853..0b06fa2b66 100644 // CraftBukkit start - fire event setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 9d1adaaa2c..3ace8ee854 100644 +index 9d1adaaa2c0..3ace8ee854c 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -3071,7 +3083,7 @@ index 9d1adaaa2c..3ace8ee854 100644 @Override public float getBukkitYaw() { diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index 00c3b666d7..e5322fbae5 100644 +index 00c3b666d7b..e5322fbae51 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -0,0 +0,0 @@ import java.util.function.Predicate; @@ -3083,7 +3095,7 @@ index 00c3b666d7..e5322fbae5 100644 super(entitytypes, world); this.f = 5; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 541ddc928b..26e32aa1db 100644 +index 541ddc928b9..26e32aa1dbd 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -3105,7 +3117,7 @@ index 541ddc928b..26e32aa1db 100644 this.displayName = this.getName(); this.canPickUpLoot = true; diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 29e776ca19..4328273b1f 100644 +index 29e776ca196..4328273b1fc 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -0,0 +0,0 @@ import com.mojang.datafixers.DataFixUtils; @@ -3128,7 +3140,7 @@ index 29e776ca19..4328273b1f 100644 } diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index 1890c760f9..7e5ece9d50 100644 +index 1890c760f9f..7e5ece9d50a 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler implements Mailbox h = new CompletableFuture(); diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java -index ba315131e1..cbe2aa4c0a 100644 +index ba315131e16..cbe2aa4c0ac 100644 --- a/src/main/java/net/minecraft/server/IWorldReader.java +++ b/src/main/java/net/minecraft/server/IWorldReader.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -3202,7 +3214,7 @@ index ba315131e1..cbe2aa4c0a 100644 IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag); diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 75308712d0..aa7501d366 100644 +index 75308712d06..aa7501d366b 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -0,0 +0,0 @@ import org.bukkit.event.world.StructureGrowEvent; @@ -3262,7 +3274,7 @@ index 75308712d0..aa7501d366 100644 // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 -index 0000000000..9fb9a96ccb +index 00000000000..9fb9a96ccb3 --- /dev/null +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +0,0 @@ @@ -3681,7 +3693,7 @@ index 0000000000..9fb9a96ccb + } +} diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index e85b24a327..75604dbc69 100644 +index e85b24a327f..75604dbc69d 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java @@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { @@ -3710,7 +3722,7 @@ index e85b24a327..75604dbc69 100644 return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); } diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 6700582e36..3ccf166366 100644 +index 6700582e362..3ccf1663669 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -3742,7 +3754,7 @@ index 6700582e36..3ccf166366 100644 public QueuedPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { this.a = packet; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 81b6f4581f..d9574a9ace 100644 +index 81b6f4581f8..d9574a9ace9 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java @@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { @@ -3754,7 +3766,7 @@ index 81b6f4581f..d9574a9ace 100644 for (int j = 1; j < 5; ++j) { if ((i & -1 << j * 7) == 0) { diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index 90223deae3..63c4dbd327 100644 +index 90223deae33..63c4dbd327b 100644 --- a/src/main/java/net/minecraft/server/PacketEncoder.java +++ b/src/main/java/net/minecraft/server/PacketEncoder.java @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder> { @@ -3766,7 +3778,7 @@ index 90223deae3..63c4dbd327 100644 throw new SkipEncodeException(throwable); } else { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 677e3e5f68..3a1d0deb0d 100644 +index 677e3e5f687..3a1d0deb0de 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { @@ -3787,7 +3799,7 @@ index 677e3e5f68..3a1d0deb0d 100644 int j = 0; ChunkSection[] achunksection = chunk.getSections(); diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 5c5bf010d0..6e9f402fb0 100644 +index 5c5bf010d07..6e9f402fb0f 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { @@ -3977,7 +3989,7 @@ index 5c5bf010d0..6e9f402fb0 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 7ad30548e2..b505244516 100644 +index 7ad30548e2a..b5052445163 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -4050,7 +4062,7 @@ index 7ad30548e2..b505244516 100644 @Override diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0c496ee0a0..6a681d694e 100644 +index 0c496ee0a04..6a681d694e7 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -4067,7 +4079,7 @@ index 0c496ee0a0..6a681d694e 100644 private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java -index 08768a3c87..d103cfaace 100644 +index 08768a3c877..d103cfaace4 100644 --- a/src/main/java/net/minecraft/server/PlayerInventory.java +++ b/src/main/java/net/minecraft/server/PlayerInventory.java @@ -0,0 +0,0 @@ public class PlayerInventory implements IInventory, INamableTileEntity { @@ -4080,7 +4092,7 @@ index 08768a3c87..d103cfaace 100644 public final EntityHuman player; private ItemStack carried; diff --git a/src/main/java/net/minecraft/server/PotionUtil.java b/src/main/java/net/minecraft/server/PotionUtil.java -index b3824898da..bf4172be52 100644 +index b3824898daa..bf4172be525 100644 --- a/src/main/java/net/minecraft/server/PotionUtil.java +++ b/src/main/java/net/minecraft/server/PotionUtil.java @@ -0,0 +0,0 @@ public class PotionUtil { @@ -4092,7 +4104,7 @@ index b3824898da..bf4172be52 100644 MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry); diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 6e65306a27..39339fa275 100644 +index 6e65306a275..39339fa2755 100644 --- a/src/main/java/net/minecraft/server/ProtoChunk.java +++ b/src/main/java/net/minecraft/server/ProtoChunk.java @@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { @@ -4115,7 +4127,7 @@ index 6e65306a27..39339fa275 100644 public IBlockData getType(BlockPosition blockposition) { int i = blockposition.getY(); diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 7b6e0e86b0..187c4e0f58 100644 +index 7b6e0e86b00..187c4e0f58b 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { @@ -4127,7 +4139,7 @@ index 7b6e0e86b0..187c4e0f58 100644 public synchronized DataInputStream a(ChunkCoordIntPair chunkcoordintpair) throws IOException { int i = this.getOffset(chunkcoordintpair); diff --git a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java -index 8c123f265e..9d0e8c2d43 100644 +index 8c123f265e6..9d0e8c2d43b 100644 --- a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java +++ b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java @@ -0,0 +0,0 @@ public class RegionLimitedWorldAccess implements GeneratorAccess { @@ -4158,7 +4170,7 @@ index 8c123f265e..9d0e8c2d43 100644 public IBlockData getType(BlockPosition blockposition) { return this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4).getType(blockposition); diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index 4efcb8b595..60948afa4e 100644 +index 4efcb8b5957..60948afa4ea 100644 --- a/src/main/java/net/minecraft/server/RegistryBlockID.java +++ b/src/main/java/net/minecraft/server/RegistryBlockID.java @@ -0,0 +0,0 @@ public class RegistryBlockID implements Registry { @@ -4170,7 +4182,7 @@ index 4efcb8b595..60948afa4e 100644 return this.b.size(); } diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 7b92ecfff9..7e224ebeff 100644 +index 7b92ecfff94..7e224ebeff3 100644 --- a/src/main/java/net/minecraft/server/SystemUtils.java +++ b/src/main/java/net/minecraft/server/SystemUtils.java @@ -0,0 +0,0 @@ public class SystemUtils { @@ -4183,7 +4195,7 @@ index 7b92ecfff9..7e224ebeff 100644 public static long getTimeMillis() { diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index f82db93f88..75ab9f185b 100644 +index f82db93f882..75ab9f185b3 100644 --- a/src/main/java/net/minecraft/server/TicketType.java +++ b/src/main/java/net/minecraft/server/TicketType.java @@ -0,0 +0,0 @@ public class TicketType { @@ -4195,7 +4207,7 @@ index f82db93f88..75ab9f185b 100644 public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2e1eabba14..2a4fa455ff 100644 +index 2e1eabba14a..2a4fa455ff3 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -4259,7 +4271,7 @@ index 2e1eabba14..2a4fa455ff 100644 return this.setTypeAndData(blockposition, fluid.getBlockData(), 3 | (flag ? 64 : 0)); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index e181df6f4d..4a9132c701 100644 +index e181df6f4d0..4a9132c7016 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { @@ -4271,7 +4283,7 @@ index e181df6f4d..4a9132c701 100644 /** * Mirror diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -index d8358a0f03..d0b813008c 100644 +index d8358a0f031..d0b813008ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java @@ -0,0 +0,0 @@ public class DummyGeneratorAccess implements GeneratorAccess { @@ -4298,7 +4310,7 @@ index d8358a0f03..d0b813008c 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java -index 1aec70a1f1..f72c13beda 100644 +index 1aec70a1f1a..f72c13bedaa 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java +++ b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java @@ -0,0 +0,0 @@ import java.util.RandomAccess; diff --git a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch index be105c99c7..87c11cbc32 100644 --- a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch +++ b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch @@ -9,7 +9,7 @@ Per-Player is absent due to difficulty of maintaining the diff required to make it happen. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index bfb52d75c7..57baf7092d 100644 +index 4612697569f..5c8a946d5c8 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -23,7 +23,7 @@ index bfb52d75c7..57baf7092d 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 53d3acccd3..af8a3e186e 100644 +index 69bfece7d43..2332f126f73 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -79,7 +79,7 @@ index 53d3acccd3..af8a3e186e 100644 public final boolean areNeighboursLoaded(final int radius) { diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index 7cd4e29123..942efe62fe 100644 +index 7cd4e291235..942efe62fe5 100644 --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java +++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java @@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { @@ -101,7 +101,7 @@ index 7cd4e29123..942efe62fe 100644 if (flag1) { ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 6e8179b465..e32c458dfe 100644 +index 6e8179b4651..e32c458dfe5 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -114,7 +114,7 @@ index 6e8179b465..e32c458dfe 100644 super((World) worldserver, gameprofile); playerinteractmanager.player = this; diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 8742d13499..72ce7bf0c3 100644 +index bae9371a1e2..9d71c4c455d 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { @@ -207,7 +207,7 @@ index 8742d13499..72ce7bf0c3 100644 public CompletableFuture> a(ChunkStatus chunkstatus, PlayerChunkMap playerchunkmap) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 099e612171..345f2689c7 100644 +index 4317d9b98e4..a3abad95a11 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -539,7 +539,7 @@ index 099e612171..345f2689c7 100644 + final void sendChunk(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER private void a(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { if (apacket[0] == null) { - apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, true); // Paper - Anti-Xray + apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(this.tracker.chunkX, this.tracker.chunkZ); PlayerChunk playerchunk = PlayerChunkMap.this.getVisibleChunk(chunkcoordintpair.pair()); @@ -550,7 +550,7 @@ index 099e612171..345f2689c7 100644 } } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index edf9df8c8a..ec95b63e51 100644 +index edf9df8c8ad..ec95b63e51a 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -581,7 +581,7 @@ index edf9df8c8a..ec95b63e51 100644 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 899c535c40..0e6368d0fb 100644 +index 899c535c405..0e6368d0fb3 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -600,7 +600,7 @@ index 899c535c40..0e6368d0fb 100644 if (!this.isClientSide && (i & 1) != 0) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 995f706678..ee7ae46389 100644 +index 995f706678f..ee7ae463898 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { @@ -645,7 +645,7 @@ index 995f706678..ee7ae46389 100644 private final Spigot spigot = new Spigot() { diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index d873b8cf3a..f735217e7a 100644 +index d873b8cf3ae..f735217e7a9 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -0,0 +0,0 @@ public class ActivationRange diff --git a/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index 0616c9fb56..da1e183012 100644 --- a/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -17,7 +17,7 @@ This should fully solve all of the issues around it so that only natural influences natural spawns. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index df24e3297b..4c50109365 100644 +index ca2ac17747d..a3fc76b5122 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -38,7 +38,7 @@ index df24e3297b..4c50109365 100644 public boolean asynchronous; public EngineMode engineMode; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 62c2275098..6654b91998 100644 +index ad5e538b249..5d1fa08f697 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch b/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch index 4bd593d60e..a35726f407 100644 --- a/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch +++ b/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch @@ -8,7 +8,7 @@ faster on its own, however removing the try catch makes it easier to inline due to code size diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 65882f4632..696634ebf5 100644 +index bb95fe20e8a..33456b0bb42 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -48,7 +48,7 @@ index 65882f4632..696634ebf5 100644 // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 3eaf893cdf..cda718bba0 100644 +index 64b625e988f..b7b06e082e5 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -0,0 +0,0 @@ public class ChunkSection { diff --git a/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch b/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch index 96f54e20f6..799741b34c 100644 --- a/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch +++ b/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch @@ -42,7 +42,7 @@ sets the excessive tick delay to the specified ticks (defaults to 60 * 20 ticks, aka 60 seconds) diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index f4836e2da1..647f6fc8ef 100644 +index f4836e2da10..647f6fc8efb 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { @@ -61,7 +61,7 @@ index f4836e2da1..647f6fc8ef 100644 ConfigurationSection section; diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java new file mode 100644 -index 0000000000..ce653f6b4b +index 00000000000..ce653f6b4be --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java @@ -0,0 +0,0 @@ @@ -689,7 +689,7 @@ index 0000000000..ce653f6b4b +} diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/TickListServerInterval.java b/src/main/java/com/destroystokyo/paper/server/ticklist/TickListServerInterval.java new file mode 100644 -index 0000000000..13cf1a55a9 +index 00000000000..13cf1a55a9b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/server/ticklist/TickListServerInterval.java @@ -0,0 +0,0 @@ @@ -736,7 +736,7 @@ index 0000000000..13cf1a55a9 +} diff --git a/src/main/java/com/destroystokyo/paper/util/set/LinkedSortedSet.java b/src/main/java/com/destroystokyo/paper/util/set/LinkedSortedSet.java new file mode 100644 -index 0000000000..118988c39e +index 00000000000..118988c39e5 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/set/LinkedSortedSet.java @@ -0,0 +0,0 @@ @@ -883,7 +883,7 @@ index 0000000000..118988c39e + } +} diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index e650a2e48d..2d07d350d2 100644 +index 9010359fbdc..07813c55cdc 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali @@ -895,7 +895,7 @@ index e650a2e48d..2d07d350d2 100644 return this.b(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index e67e006535..ca1b5b3b09 100644 +index e67e0065357..ca1b5b3b094 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -913,7 +913,7 @@ index e67e006535..ca1b5b3b09 100644 public ChunkProviderServer(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, WorldLoadListener worldloadlistener, Supplier supplier) { this.world = worldserver; diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java -index 33cfeabdee..2287e47d1b 100644 +index 33cfeabdee0..2287e47d1b8 100644 --- a/src/main/java/net/minecraft/server/NextTickListEntry.java +++ b/src/main/java/net/minecraft/server/NextTickListEntry.java @@ -0,0 +0,0 @@ import java.util.Comparator; @@ -984,7 +984,7 @@ index 33cfeabdee..2287e47d1b 100644 public String toString() { return this.e + ": " + this.a + ", " + this.b + ", " + this.c + ", " + this.f; diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 74e6b8b973..04b97cec29 100644 +index bf592125f4c..3d610e41969 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { @@ -999,7 +999,7 @@ index 74e6b8b973..04b97cec29 100644 } }); diff --git a/src/main/java/net/minecraft/server/StructureBoundingBox.java b/src/main/java/net/minecraft/server/StructureBoundingBox.java -index dbb565e74d..185658e230 100644 +index dbb565e74d2..185658e2306 100644 --- a/src/main/java/net/minecraft/server/StructureBoundingBox.java +++ b/src/main/java/net/minecraft/server/StructureBoundingBox.java @@ -0,0 +0,0 @@ import com.google.common.base.MoreObjects; @@ -1038,7 +1038,7 @@ index dbb565e74d..185658e230 100644 return baseblockposition.getX() >= this.a && baseblockposition.getX() <= this.d && baseblockposition.getZ() >= this.c && baseblockposition.getZ() <= this.f && baseblockposition.getY() >= this.b && baseblockposition.getY() <= this.e; } diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java -index f533860bbe..3f1aa5ced6 100644 +index f533860bbed..3f1aa5ced69 100644 --- a/src/main/java/net/minecraft/server/TickListServer.java +++ b/src/main/java/net/minecraft/server/TickListServer.java @@ -0,0 +0,0 @@ public class TickListServer implements TickList { @@ -1161,7 +1161,7 @@ index f533860bbe..3f1aa5ced6 100644 } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 9a2b4fa7a2..9b9e242432 100644 +index fcbc9f29139..5173731dc55 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/Optimise-random-block-ticking.patch b/Spigot-Server-Patches/Optimise-random-block-ticking.patch index 6cd1146f67..87a273ffea 100644 --- a/Spigot-Server-Patches/Optimise-random-block-ticking.patch +++ b/Spigot-Server-Patches/Optimise-random-block-ticking.patch @@ -20,7 +20,7 @@ remains the same. diff --git a/src/main/java/com/destroystokyo/paper/util/math/ThreadUnsafeRandom.java b/src/main/java/com/destroystokyo/paper/util/math/ThreadUnsafeRandom.java new file mode 100644 -index 0000000000..3edc8e52e0 +index 00000000000..3edc8e52e06 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/math/ThreadUnsafeRandom.java @@ -0,0 +0,0 @@ @@ -71,7 +71,7 @@ index 0000000000..3edc8e52e0 + } +} diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index e29ec958b3..e40375b67a 100644 +index e29ec958b35..e40375b67a4 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block implements IMaterial { @@ -86,7 +86,7 @@ index e29ec958b3..e40375b67a 100644 } diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java -index 6d351f0979..a44f65f40d 100644 +index 6d351f0979e..a44f65f40d2 100644 --- a/src/main/java/net/minecraft/server/BlockFluids.java +++ b/src/main/java/net/minecraft/server/BlockFluids.java @@ -0,0 +0,0 @@ public class BlockFluids extends Block implements IFluidSource { @@ -99,7 +99,7 @@ index 6d351f0979..a44f65f40d 100644 @Override diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index db7ba12fd4..9010359fbd 100644 +index db7ba12fd4f..9010359fbdc 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali @@ -111,7 +111,7 @@ index db7ba12fd4..9010359fbd 100644 return this.d(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 42eede6781..65882f4632 100644 +index a2a0ca3394c..bb95fe20e8a 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -126,7 +126,7 @@ index 42eede6781..65882f4632 100644 } diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 4526527aca..3eaf893cdf 100644 +index eeb7eee925d..64b625e988f 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -135,30 +135,17 @@ index 4526527aca..3eaf893cdf 100644 public static final DataPalette GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); - private final int yPos; + final int yPos; // Paper - private -> package-private - short nonEmptyBlockCount; // Paper - private -> package-private + private short nonEmptyBlockCount; - private short tickingBlockCount; + short tickingBlockCount; // Paper - private -> package-private private short e; final DataPaletteBlock blockIds; -+ Chunk chunk; // Paper + final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper + - public ChunkSection(int i) { - // Paper start - add parameters - this(i, (IChunkAccess)null, (IWorldReader)null, true); -@@ -0,0 +0,0 @@ public class ChunkSection { - this.tickingBlockCount = short1; - this.e = short2; - this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), world instanceof GeneratorAccess ? ((GeneratorAccess) world).getMinecraftWorld().chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, initializeBlocks) : null, initializeBlocks); // Paper - Anti-Xray - Add predefined block data -+ // Paper start -+ if (chunk instanceof Chunk) { -+ this.chunk = (Chunk)chunk; -+ } -+ // Paper end - } - - public IBlockData getType(int i, int j, int k) { + // Paper start - Anti-Xray - Add parameters + @Deprecated public ChunkSection(int i) { this(i, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere + public ChunkSection(int i, IChunkAccess chunk, World world, boolean initializeBlocks) { @@ -0,0 +0,0 @@ public class ChunkSection { --this.nonEmptyBlockCount; if (iblockdata1.q()) { @@ -215,7 +202,7 @@ index 4526527aca..3eaf893cdf 100644 } diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index f9680b6830..a61cffa3f4 100644 +index f9680b6830c..a61cffa3f49 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -0,0 +0,0 @@ public class DataBits { @@ -266,7 +253,7 @@ index f9680b6830..a61cffa3f4 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 44aed67274..fa664897fb 100644 +index 2c7872bd051..be5f98c3c36 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java @@ -0,0 +0,0 @@ public class DataPaletteBlock implements DataPaletteExpandable { @@ -285,7 +272,7 @@ index 44aed67274..fa664897fb 100644 public interface a { diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java -index dd02cb3485..b24a5100b4 100644 +index dd02cb34850..b24a5100b45 100644 --- a/src/main/java/net/minecraft/server/EntityTurtle.java +++ b/src/main/java/net/minecraft/server/EntityTurtle.java @@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal { @@ -298,7 +285,7 @@ index dd02cb3485..b24a5100b4 100644 public final BlockPosition getHome() { return this.es(); } // Paper - OBFHELPER diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index de43881653..e821c236b4 100644 +index de43881653f..e821c236b45 100644 --- a/src/main/java/net/minecraft/server/IBlockData.java +++ b/src/main/java/net/minecraft/server/IBlockData.java @@ -0,0 +0,0 @@ public class IBlockData extends BlockDataAbstract implements @@ -351,7 +338,7 @@ index de43881653..e821c236b4 100644 public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0c23fc89d7..de9f49b884 100644 +index 0c23fc89d7a..de9f49b8848 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -376,7 +363,7 @@ index 0c23fc89d7..de9f49b884 100644 public boolean isSavingDisabled() { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index c348e3e500..fcbc9f2913 100644 +index c348e3e5008..fcbc9f29139 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/Optimize-Hoppers.patch b/Spigot-Server-Patches/Optimize-Hoppers.patch index 9ab4a66798..53c3767359 100644 --- a/Spigot-Server-Patches/Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/Optimize-Hoppers.patch @@ -13,7 +13,7 @@ Subject: [PATCH] Optimize Hoppers * Remove Streams from Item Suck In and restore restore 1.12 AABB checks which is simpler and no voxel allocations (was doing TWO Item Suck ins) diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f8d8cb8655..3b8488d3ff 100644 +index e89ad807ed9..fca4b6e20ab 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -31,7 +31,7 @@ index f8d8cb8655..3b8488d3ff 100644 + } } diff --git a/src/main/java/net/minecraft/server/IHopper.java b/src/main/java/net/minecraft/server/IHopper.java -index e1aa272e52..4da26365ec 100644 +index e1aa272e526..4da26365ec5 100644 --- a/src/main/java/net/minecraft/server/IHopper.java +++ b/src/main/java/net/minecraft/server/IHopper.java @@ -0,0 +0,0 @@ public interface IHopper extends IInventory { @@ -53,7 +53,7 @@ index e1aa272e52..4da26365ec 100644 + double B();default double getZ() { return B(); } // Paper - OBFHELPER } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index d953cdef14..d6e43313bf 100644 +index d953cdef14a..d6e43313bf0 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -0,0 +0,0 @@ public final class ItemStack { @@ -73,7 +73,7 @@ index d953cdef14..d6e43313bf 100644 itemstack.d(this.C()); if (this.tag != null) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 26be349870..63db74993c 100644 +index 26be3498704..63db74993c1 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager()); diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 958279249f..a8e64dfdab 100644 +index 958279249fd..a8e64dfdab1 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -105,7 +105,7 @@ index 958279249f..a8e64dfdab 100644 this.world.b(this.position, this); if (!this.c.isAir()) { diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index 907d088c86..280c4e99e8 100644 +index 907d088c869..280c4e99e82 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi @@ -370,7 +370,7 @@ index 907d088c86..280c4e99e8 100644 if (!list.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 568e04faa3..9e161746f2 100644 +index 568e04faa31..9e161746f2a 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Pillager-patrol-spawn-settings-and-per-player-option.patch b/Spigot-Server-Patches/Pillager-patrol-spawn-settings-and-per-player-option.patch index 027121ff5c..d4db953d91 100644 --- a/Spigot-Server-Patches/Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/Spigot-Server-Patches/Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -10,7 +10,7 @@ When not per player it will use the Vanilla mechanic of one delay per world and the world age for the start day. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7ca67a4aa5..803be76772 100644 +index c3af4c9a9fe..3f44be577e3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -36,7 +36,7 @@ index 7ca67a4aa5..803be76772 100644 private void entitiesTargetWithFollowRange() { entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index cf837bdb3b..900631ebe0 100644 +index cf837bdb3b2..900631ebe05 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -48,7 +48,7 @@ index cf837bdb3b..900631ebe0 100644 public boolean queueHealthUpdatePacket = false; public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; diff --git a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -index a0f5828076..edca6d3abd 100644 +index a0f58280760..edca6d3abdc 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java @@ -0,0 +0,0 @@ import java.util.Random; @@ -128,7 +128,7 @@ index a0f5828076..edca6d3abd 100644 if (entityhuman.isSpectator()) { return 0; diff --git a/src/main/java/net/minecraft/server/StatisticWrapper.java b/src/main/java/net/minecraft/server/StatisticWrapper.java -index 3b6034038a..9c95c0ccfc 100644 +index 3b6034038a4..9c95c0ccfcd 100644 --- a/src/main/java/net/minecraft/server/StatisticWrapper.java +++ b/src/main/java/net/minecraft/server/StatisticWrapper.java @@ -0,0 +0,0 @@ public class StatisticWrapper implements Iterable> { diff --git a/Spigot-Server-Patches/Seed-based-feature-search.patch b/Spigot-Server-Patches/Seed-based-feature-search.patch index a6511a9775..d08c81c173 100644 --- a/Spigot-Server-Patches/Seed-based-feature-search.patch +++ b/Spigot-Server-Patches/Seed-based-feature-search.patch @@ -15,7 +15,7 @@ changes but this should usually not happen. A config option to disable this improvement is added though in case that should ever be necessary. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3b8488d3ff..bce502181f 100644 +index fca4b6e20ab..ade7af40eff 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -32,7 +32,7 @@ index 3b8488d3ff..bce502181f 100644 private void maxEntityCollision() { maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) ); diff --git a/src/main/java/net/minecraft/server/BiomeManager.java b/src/main/java/net/minecraft/server/BiomeManager.java -index e96f544f12..68423645df 100644 +index e96f544f126..68423645df3 100644 --- a/src/main/java/net/minecraft/server/BiomeManager.java +++ b/src/main/java/net/minecraft/server/BiomeManager.java @@ -0,0 +0,0 @@ public class BiomeManager { @@ -49,7 +49,7 @@ index e96f544f12..68423645df 100644 return this.c.a(this.b, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a); } diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index f2a19acd84..09f1308b0d 100644 +index f2a19acd845..09f1308b0d0 100644 --- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java @@ -0,0 +0,0 @@ public class ChunkCoordIntPair { @@ -66,7 +66,7 @@ index f2a19acd84..09f1308b0d 100644 return this.z << 4; } diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index e8ce2ecf23..acfe732af5 100644 +index e8ce2ecf23e..acfe732af5b 100644 --- a/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java @@ -0,0 +0,0 @@ public abstract class StructureGenerator @@ -94,7 +94,7 @@ index e8ce2ecf23..acfe732af5 100644 public abstract StructureGenerator.a a(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 228e6e9ab9..f1d072a39c 100644 +index 228e6e9ab99..f1d072a39cc 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch b/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch index 3530ff4732..8c36d6cc85 100644 --- a/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch +++ b/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch @@ -5,7 +5,7 @@ Subject: [PATCH] implement optional per player mob spawns diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -index 98acbfa44d..a94ebf7c76 100644 +index 98acbfa44dd..a94ebf7c76f 100644 --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +0,0 @@ public class WorldTimingsHandler { @@ -25,7 +25,7 @@ index 98acbfa44d..a94ebf7c76 100644 poiUnload = Timings.ofSafe(name + "Chunk unload - POI"); chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk"); diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9d9260ad07..fd3dbea628 100644 +index b1d09eb457c..515673e0fec 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -40,7 +40,7 @@ index 9d9260ad07..fd3dbea628 100644 } diff --git a/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java new file mode 100644 -index 0000000000..9ebd7ecb7a +index 00000000000..9ebd7ecb7a0 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java @@ -0,0 +0,0 @@ @@ -299,7 +299,7 @@ index 0000000000..9ebd7ecb7a +} diff --git a/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java b/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java new file mode 100644 -index 0000000000..4f13d3ff83 +index 00000000000..4f13d3ff839 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java @@ -0,0 +0,0 @@ @@ -545,7 +545,7 @@ index 0000000000..4f13d3ff83 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index ea1117dc86..fe894a68bc 100644 +index ea1117dc86e..fe894a68bc2 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -599,7 +599,7 @@ index ea1117dc86..fe894a68bc 100644 } } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index f375c9507c..fcd887ce30 100644 +index f375c9507c0..fcd887ce30d 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -631,7 +631,7 @@ index f375c9507c..fcd887ce30 100644 return this.cs; } diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 8427ee2ee8..0f04bcc8b7 100644 +index 8427ee2ee8b..0f04bcc8b7c 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -0,0 +0,0 @@ public class EntityTypes { @@ -643,7 +643,7 @@ index 8427ee2ee8..0f04bcc8b7 100644 return this.bb; } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 43abdb47fd..0fd1d6b3e6 100644 +index 963ce3eeec6..692388821a7 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -682,7 +682,7 @@ index 43abdb47fd..0fd1d6b3e6 100644 private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index fdac5bb3a2..58bbf2f9d2 100644 +index fdac5bb3a2d..58bbf2f9d2e 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ package net.minecraft.server; @@ -755,7 +755,7 @@ index fdac5bb3a2..58bbf2f9d2 100644 @Nullable diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 731f6a8320..38c5b721bf 100644 +index 731f6a83200..38c5b721bf1 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World {