diff --git a/patches/unapplied/api/0187-PlayerDeathEvent-shouldDropExperience.patch b/patches/api/0186-PlayerDeathEvent-shouldDropExperience.patch similarity index 97% rename from patches/unapplied/api/0187-PlayerDeathEvent-shouldDropExperience.patch rename to patches/api/0186-PlayerDeathEvent-shouldDropExperience.patch index cc31e67473..f10b186731 100644 --- a/patches/unapplied/api/0187-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/api/0186-PlayerDeathEvent-shouldDropExperience.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 8c46eaebf004823c1c31eb2c7304181487cb1332..3d45d2e41aad6992b40a22030f2a63baeec78757 100644 +index 61d12cb8f0a924abf696b6da7258f34dbb7b51b6..8175e5329f7fb6da4c7faf695162b51492114dc3 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -1,6 +1,8 @@ diff --git a/patches/unapplied/api/0188-Add-effect-to-block-break-naturally.patch b/patches/api/0187-Add-effect-to-block-break-naturally.patch similarity index 93% rename from patches/unapplied/api/0188-Add-effect-to-block-break-naturally.patch rename to patches/api/0187-Add-effect-to-block-break-naturally.patch index a137ba158d..fc1d381d17 100644 --- a/patches/unapplied/api/0188-Add-effect-to-block-break-naturally.patch +++ b/patches/api/0187-Add-effect-to-block-break-naturally.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add effect to block break naturally diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 5ac36e0f90d0889853736390877aa92ec0ca181b..25294bd8c4faa05af1429d934c5666742e3ee23c 100644 +index 5e92f8f6ba5368ae934c24154ab13fbc6a46272f..20463f92d83dea3130d4a3f0ac70e5f399c97711 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -470,6 +470,26 @@ public interface Block extends Metadatable { diff --git a/patches/unapplied/server/0367-Anti-Xray.patch b/patches/removed/1.18/0361-Anti-Xray.patch similarity index 76% rename from patches/unapplied/server/0367-Anti-Xray.patch rename to patches/removed/1.18/0361-Anti-Xray.patch index ae99811884..648adb1b28 100644 --- a/patches/unapplied/server/0367-Anti-Xray.patch +++ b/patches/removed/1.18/0361-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 ade858610c76be24576fe60d509e4a8f2531f442..367bea78d479b73b35a324c58f8f9b981d9c8ccf 100644 +index 7a97a4a395f20680bc3b028586c9a17b84783d99..75f6915e2a2cc7328cf51b953edcc3ee6f9e7fbd 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -1,10 +1,12 @@ @@ -21,7 +21,7 @@ index ade858610c76be24576fe60d509e4a8f2531f442..367bea78d479b73b35a324c58f8f9b98 import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.spigotmc.SpigotWorldConfig; -@@ -528,5 +530,40 @@ public class PaperWorldConfig { +@@ -518,5 +520,40 @@ public class PaperWorldConfig { private void lightQueueSize() { lightQueueSize = getInt("light-queue-size", lightQueueSize); } @@ -258,7 +258,7 @@ index 0000000000000000000000000000000000000000..280ece653cdda74e9c8fab4e9e5b3a95 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000000000000000000000000000000000..58052a5f773b5882acd90bc0214a36e8a512817c +index 0000000000000000000000000000000000000000..f9ed88082f1a58a0572acc22761fad4340185aeb --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java @@ -0,0 +1,635 @@ @@ -268,7 +268,7 @@ index 0000000000000000000000000000000000000000..58052a5f773b5882acd90bc0214a36e8 +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Registry; -+import net.minecraft.network.protocol.game.ClientboundLevelChunkPacket; ++import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; +import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; @@ -420,7 +420,7 @@ index 0000000000000000000000000000000000000000..58052a5f773b5882acd90bc0214a36e8 + } + + @Override -+ public ChunkPacketInfoAntiXray getChunkPacketInfo(ClientboundLevelChunkPacket chunkPacket, LevelChunk chunk) { ++ public ChunkPacketInfoAntiXray getChunkPacketInfo(ClientboundLevelChunkPacketData chunkPacket, LevelChunk chunk) { + // Return a new instance to collect data and objects in the right state while creating the chunk packet for thread safe access later + return new ChunkPacketInfoAntiXray(chunkPacket, chunk, this); + } @@ -899,19 +899,19 @@ index 0000000000000000000000000000000000000000..58052a5f773b5882acd90bc0214a36e8 +} 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 0000000000000000000000000000000000000000..7bc2d4daffa8e9e71c3bf496d2cf1a2b7f3c6a4b +index 0000000000000000000000000000000000000000..351ab20ba506cca55ee198f06346bad8b1593d0a --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java @@ -0,0 +1,80 @@ +package com.destroystokyo.paper.antixray; + -+import net.minecraft.network.protocol.game.ClientboundLevelChunkPacket; ++import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; +import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.chunk.Palette; + +public class ChunkPacketInfo { + -+ private final ClientboundLevelChunkPacket chunkPacket; ++ private final ClientboundLevelChunkPacketData chunkPacket; + private final LevelChunk chunk; + private final int[] bits; + private final Object[] palettes; @@ -919,26 +919,26 @@ index 0000000000000000000000000000000000000000..7bc2d4daffa8e9e71c3bf496d2cf1a2b + private final Object[][] presetValues; + private byte[] buffer; + -+ public ChunkPacketInfo(ClientboundLevelChunkPacket chunkPacket, LevelChunk chunk) { ++ public ChunkPacketInfo(ClientboundLevelChunkPacketData chunkPacket, LevelChunk chunk) { + this.chunkPacket = chunkPacket; + this.chunk = chunk; + int sections = chunk.getSectionsCount(); -+ bits = new int[sections]; -+ palettes = new Object[sections]; -+ indexes = new int[sections]; -+ presetValues = new Object[sections][]; ++ this.bits = new int[sections]; ++ this.palettes = new Object[sections]; ++ this.indexes = new int[sections]; ++ this.presetValues = new Object[sections][]; + } + -+ public ClientboundLevelChunkPacket getChunkPacket() { -+ return chunkPacket; ++ public ClientboundLevelChunkPacketData getChunkPacket() { ++ return this.chunkPacket; + } + + public LevelChunk getChunk() { -+ return chunk; ++ return this.chunk; + } + + public byte[] getBuffer() { -+ return buffer; ++ return this.buffer; + } + + public void setBuffer(byte[] buffer) { @@ -946,7 +946,7 @@ index 0000000000000000000000000000000000000000..7bc2d4daffa8e9e71c3bf496d2cf1a2b + } + + public int getBits(int chunkSectionIndex) { -+ return bits[chunkSectionIndex]; ++ return this.bits[chunkSectionIndex]; + } + + public void setBits(int chunkSectionIndex, int bits) { @@ -955,24 +955,24 @@ index 0000000000000000000000000000000000000000..7bc2d4daffa8e9e71c3bf496d2cf1a2b + + @SuppressWarnings("unchecked") + public Palette getPalette(int chunkSectionIndex) { -+ return (Palette) palettes[chunkSectionIndex]; ++ return (Palette) this.palettes[chunkSectionIndex]; + } + + public void setPalette(int chunkSectionIndex, Palette palette) { -+ palettes[chunkSectionIndex] = palette; ++ this.palettes[chunkSectionIndex] = palette; + } + + public int getIndex(int chunkSectionIndex) { -+ return indexes[chunkSectionIndex]; ++ return this.indexes[chunkSectionIndex]; + } + + public void setIndex(int chunkSectionIndex, int index) { -+ indexes[chunkSectionIndex] = index; ++ this.indexes[chunkSectionIndex] = index; + } + + @SuppressWarnings("unchecked") + public T[] getPresetValues(int chunkSectionIndex) { -+ return (T[]) presetValues[chunkSectionIndex]; ++ return (T[]) this.presetValues[chunkSectionIndex]; + } + + public void setPresetValues(int chunkSectionIndex, T[] presetValues) { @@ -980,18 +980,18 @@ index 0000000000000000000000000000000000000000..7bc2d4daffa8e9e71c3bf496d2cf1a2b + } + + public boolean isWritten(int chunkSectionIndex) { -+ return bits[chunkSectionIndex] != 0; ++ return this.bits[chunkSectionIndex] != 0; + } +} 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 0000000000000000000000000000000000000000..02324a59ac21db5349fe2a74248b2c6f92fa8233 +index 0000000000000000000000000000000000000000..a3ee0cf08076848806912b983d386caadf762acc --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java @@ -0,0 +1,29 @@ +package com.destroystokyo.paper.antixray; + -+import net.minecraft.network.protocol.game.ClientboundLevelChunkPacket; ++import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.LevelChunk; + @@ -1000,13 +1000,13 @@ index 0000000000000000000000000000000000000000..02324a59ac21db5349fe2a74248b2c6f + private final ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray; + private LevelChunk[] nearbyChunks; + -+ public ChunkPacketInfoAntiXray(ClientboundLevelChunkPacket chunkPacket, LevelChunk chunk, ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray) { ++ public ChunkPacketInfoAntiXray(ClientboundLevelChunkPacketData chunkPacket, LevelChunk chunk, ChunkPacketBlockControllerAntiXray chunkPacketBlockControllerAntiXray) { + super(chunkPacket, chunk); + this.chunkPacketBlockControllerAntiXray = chunkPacketBlockControllerAntiXray; + } + + public LevelChunk[] getNearbyChunks() { -+ return nearbyChunks; ++ return this.nearbyChunks; + } + + public void setNearbyChunks(LevelChunk... nearbyChunks) { @@ -1015,18 +1015,18 @@ index 0000000000000000000000000000000000000000..02324a59ac21db5349fe2a74248b2c6f + + @Override + public void run() { -+ chunkPacketBlockControllerAntiXray.obfuscate(this); ++ this.chunkPacketBlockControllerAntiXray.obfuscate(this); + } +} -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java -index c28879f32b004f36ff746ea2274f91ddd9501e71..60d72e488bc77cd913328be400ca374a873b4561 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java -@@ -37,7 +37,24 @@ public class ClientboundLevelChunkPacket implements Packet chunkPacketInfo = modifyBlocks ? chunk.level.chunkPacketBlockController.getChunkPacketInfo(this, chunk) : null; + // Paper end - ChunkPos chunkPos = chunk.getPos(); - this.x = chunkPos.x; - this.z = chunkPos.z; -@@ -51,7 +68,14 @@ public class ClientboundLevelChunkPacket implements Packet entry : chunk.getHeightmaps()) { +@@ -43,7 +60,13 @@ public class ClientboundLevelChunkPacketData { + } + + this.buffer = new byte[calculateChunkSize(chunk)]; +- extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk); + // Paper start - Anti-Xray - Add chunk packet info + if (chunkPacketInfo != null) { + chunkPacketInfo.setBuffer(this.buffer); + } + -+ this.availableSections = this.extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk, chunkPacketInfo); ++ this.extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk, chunkPacketInfo); + // Paper end - this.blockEntitiesTags = Lists.newArrayList(); + this.blockEntitiesData = Lists.newArrayList(); int totalTileEntities = 0; // Paper -@@ -71,6 +95,7 @@ public class ClientboundLevelChunkPacket implements Packet chunkPacketInfo) { -+ // Paper end - BitSet bitSet = new BitSet(); - LevelChunkSection[] levelChunkSections = chunk.getSections(); - int i = 0; -@@ -129,7 +157,7 @@ public class ClientboundLevelChunkPacket implements Packet chunkPacketInfo) { + for(LevelChunkSection levelChunkSection : chunk.getSections()) { +- levelChunkSection.write(buf); ++ levelChunkSection.write(buf, chunkPacketInfo); } + } +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +index 079734654c0fd421561b5f9003cd318bad5787a9..dc8ff27a3851982b0a798274ddb5e13af6917794 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +@@ -14,11 +14,12 @@ public class ClientboundLevelChunkWithLightPacket implements Packet[] packets, LevelChunk chunk) { - if (packets[0] == null) { -- packets[0] = new ClientboundLevelChunkPacket(chunk); -+ packets[0] = new ClientboundLevelChunkPacket(chunk, chunk.level.chunkPacketBlockController.shouldModify(player, chunk)); // Paper - Ani-Xray - Bypass - packets[1] = new ClientboundLightUpdatePacket(chunk.getPos(), this.lightEngine, (BitSet) null, (BitSet) null, true); + private void playerLoadedChunk(ServerPlayer player, MutableObject cachedDataPacket, LevelChunk chunk) { + if (cachedDataPacket.getValue() == null) { +- cachedDataPacket.setValue(new ClientboundLevelChunkWithLightPacket(chunk, this.lightEngine, (BitSet) null, (BitSet) null, true)); ++ cachedDataPacket.setValue(new ClientboundLevelChunkWithLightPacket(chunk, this.lightEngine, (BitSet) null, (BitSet) null, true, chunk.level.chunkPacketBlockController.shouldModify(player, chunk))); // Paper - Ani-Xray - Bypass } + player.trackChunk(chunk.getPos(), (Packet) cachedDataPacket.getValue()); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 085d807881e92149c3b31b6f76b2a5539ee629fa..1b342701b410a508323286944508e7faa175ab43 100644 +index 09deaa9badf53bdc1292796c643751d8d92ac585..6c4f1fa1d96f906f3b4e1e352c919155a1092530 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -378,7 +378,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -391,7 +391,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // Add env and gen to constructor, WorldData -> WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error @@ -1120,10 +1131,10 @@ index 085d807881e92149c3b31b6f76b2a5539ee629fa..1b342701b410a508323286944508e7fa this.convertable = convertable_conversionsession; this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile()); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 6219634a57976a6a0a9b32ed08d56107d6b5d1c3..31e3534d6e15f91d781fabb0670e53ef66cb8977 100644 +index 44e5ab0b545de41b937c7ce304ce643f78a43734..a85b89a0d525e623e154c8b1bea55470d2072dcb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -49,7 +49,7 @@ import org.bukkit.event.player.PlayerInteractEvent; +@@ -48,7 +48,7 @@ import org.bukkit.event.player.PlayerInteractEvent; public class ServerPlayerGameMode { private static final Logger LOGGER = LogManager.getLogger(); @@ -1132,7 +1143,7 @@ index 6219634a57976a6a0a9b32ed08d56107d6b5d1c3..31e3534d6e15f91d781fabb0670e53ef protected final ServerPlayer player; private GameType gameModeForPlayer; @Nullable -@@ -315,6 +315,8 @@ public class ServerPlayerGameMode { +@@ -314,6 +314,8 @@ public class ServerPlayerGameMode { } } @@ -1142,10 +1153,10 @@ index 6219634a57976a6a0a9b32ed08d56107d6b5d1c3..31e3534d6e15f91d781fabb0670e53ef public void destroyAndAck(BlockPos pos, ServerboundPlayerActionPacket.Action action, String reason) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index a8772b168eedca4933b4b4132ea81afd6bcaafa2..35209090439d5ab3bf5c37de28a39e60d482b64c 100644 +index de7abae207b0a565a25fa4ed2f66b94c6b0cdcf9..69ac5ec34b6eb95036b679ed299e11766093935c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -166,6 +166,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -167,6 +167,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper @@ -1153,16 +1164,16 @@ index a8772b168eedca4933b4b4132ea81afd6bcaafa2..35209090439d5ab3bf5c37de28a39e60 public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPos lastPhysicsProblem; // Spigot -@@ -187,7 +188,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - return this.typeKey; - } +@@ -186,7 +187,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + public abstract ResourceKey getTypeKey(); - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) { + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Anti-Xray - Pass executor this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper this.generator = gen; -@@ -261,6 +262,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -262,6 +263,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); @@ -1172,89 +1183,20 @@ index a8772b168eedca4933b4b4132ea81afd6bcaafa2..35209090439d5ab3bf5c37de28a39e60 } // Paper start -@@ -440,6 +444,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -441,6 +445,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit end - BlockState iblockdata1 = chunk.setType(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag + BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag + this.chunkPacketBlockController.onBlockChange(this, pos, state, iblockdata1, flags, maxUpdateDepth); // Paper - Anti-Xray if (iblockdata1 == null) { // CraftBukkit start - remove blockstate if failed (or the same) -diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 149ac5ec368b53a9a5e9208bd49a3c9453625d9c..12d11a249c759e99568a76c791cc0d65adfcfe94 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -74,7 +74,7 @@ public interface ChunkAccess extends BlockGetter, FeatureAccess { - default LevelChunkSection getOrCreateSection(int yIndex) { - LevelChunkSection[] levelChunkSections = this.getSections(); - if (levelChunkSections[yIndex] == LevelChunk.EMPTY_SECTION) { -- levelChunkSections[yIndex] = new LevelChunkSection(this.getSectionYFromSectionIndex(yIndex)); -+ levelChunkSections[yIndex] = new LevelChunkSection(this.getSectionYFromSectionIndex(yIndex), this, this.getLevel(), true); // Paper - Anti-Xray - Add parameters - } - - return levelChunkSections[yIndex]; -diff --git a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java -index 69c2454533e6f21c70792b555ec02c6bc6d169b3..f9e0e109497d685a9d88d2fa8892287b9fa97443 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java -@@ -86,7 +86,7 @@ public class EmptyLevelChunk extends LevelChunk { - private static final Biome[] EMPTY_BIOMES = new Biome[0]; - - public EmptyChunkBiomeContainer(Level world) { -- super(world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), world, EMPTY_BIOMES); -+ super(net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), world, EMPTY_BIOMES); // Paper - Anti-Xray - The world isnt ready yet, use server singleton for registry - } - - @Override -diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 8141935e2ee58bbb58c6b5cfdef5a9a88d7658ec..515e28eea8cbab261320352ee0db9b877807f3ed 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -456,7 +456,7 @@ public class LevelChunk implements ChunkAccess { - return null; - } - -- chunksection = new LevelChunkSection(SectionPos.blockToSectionCoord(i)); -+ chunksection = new LevelChunkSection(SectionPos.blockToSectionCoord(i), this, this.level, true); // Paper - Anti-Xray - Add parameters - this.sections[j] = chunksection; - } - diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index 5fd66020a937b641e2a060cf38df731a43f3bf55..c9fefeef19bd46ade51b23eadb5eef3a88024ea1 100644 +index 92a42aea3f54c49e2055e8000645d91da9471e09..2e651fcf0227dcf0d36fba6bf6e4ba6a5e21dfd7 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -20,16 +20,25 @@ public class LevelChunkSection { - private short tickingFluidCount; - final PalettedContainer states; // Paper - package-private - -- public LevelChunkSection(int yOffset) { -- this(yOffset, (short)0, (short)0, (short)0); -+ // Paper start - Anti-Xray - Add parameters -+ @Deprecated public LevelChunkSection(int yOffset) { this(yOffset, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere -+ public LevelChunkSection(int yOffset, ChunkAccess chunk, net.minecraft.world.level.Level level, boolean initializeBlocks) { -+ this(yOffset, (short) 0, (short) 0, (short) 0, chunk, level, initializeBlocks); -+ // Paper end - } - -- public LevelChunkSection(int yOffset, short nonEmptyBlockCount, short randomTickableBlockCount, short nonEmptyFluidCount) { -+ // Paper start - Anti-Xray - Add parameters -+ @Deprecated public LevelChunkSection(int yOffset, short nonEmptyBlockCount, short randomTickableBlockCount, short nonEmptyFluidCount) { // Notice for updates: Please make sure this constructor isn't used anywhere -+ this(yOffset, nonEmptyBlockCount, randomTickableBlockCount, nonEmptyFluidCount, null, null, true); -+ } -+ public LevelChunkSection(int yOffset, short nonEmptyBlockCount, short randomTickableBlockCount, short nonEmptyFluidCount, ChunkAccess chunk, net.minecraft.world.level.Level level, boolean initializeBlocks) { -+ // Paper end - this.bottomBlockY = getBottomBlockY(yOffset); - this.nonEmptyBlockCount = nonEmptyBlockCount; - this.tickingBlockCount = randomTickableBlockCount; - this.tickingFluidCount = nonEmptyFluidCount; -- this.states = new PalettedContainer<>(GLOBAL_BLOCKSTATE_PALETTE, Block.BLOCK_STATE_REGISTRY, NbtUtils::readBlockState, NbtUtils::writeBlockState, Blocks.AIR.defaultBlockState()); -+ this.states = new PalettedContainer<>(GLOBAL_BLOCKSTATE_PALETTE, Block.BLOCK_STATE_REGISTRY, NbtUtils::readBlockState, NbtUtils::writeBlockState, Blocks.AIR.defaultBlockState(), -+ level == null ? null : level.chunkPacketBlockController.getPresetBlockStates(level, chunk, this, initializeBlocks), initializeBlocks); // Paper - Anti-Xray - Add preset block states - } - - public static int getBottomBlockY(int chunkPos) { -@@ -147,9 +156,12 @@ public class LevelChunkSection { - this.states.read(buf); +@@ -158,9 +158,12 @@ public class LevelChunkSection { + this.biomes.read(buf); } - public void write(FriendlyByteBuf buf) { @@ -1265,43 +1207,42 @@ index 5fd66020a937b641e2a060cf38df731a43f3bf55..c9fefeef19bd46ade51b23eadb5eef3a buf.writeShort(this.nonEmptyBlockCount); - this.states.write(buf); + this.states.write(buf, chunkPacketInfo, this.bottomBlockY); // Paper - Anti-Xray - Add chunk packet info + this.biomes.write(buf); } - public int getSerializedSize() { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index bb8fd88aebb550edec8c679622a02a595cbc6694..ac51089aae57a5f1d2411367ff177e058702894c 100644 +index b7b81cbdb36b0041177e012cb932d4267638d9c9..803b75e88e96d4bdcde002fde4000d136d6f07e5 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -28,6 +28,7 @@ public class PalettedContainer implements PaletteResize { - private final Function reader; - private final Function writer; - private final T defaultValue; +@@ -33,6 +33,7 @@ public class PalettedContainer implements PaletteResize { + return 0; + }; + public final IdMap registry; + private final T[] presetValues; // Paper - Anti-Xray - Add preset values - protected BitStorage storage; - private Palette palette; - private int bits; -@@ -48,14 +49,46 @@ public class PalettedContainer implements PaletteResize { - this.lock.release(); + private volatile PalettedContainer.Data data; + private final PalettedContainer.Strategy strategy; + private final Semaphore lock = new Semaphore(1); +@@ -63,14 +64,47 @@ public class PalettedContainer implements PaletteResize { + }); } -- public PalettedContainer(Palette fallbackPalette, IdMapper idList, Function elementDeserializer, Function elementSerializer, T defaultElement) { +- public PalettedContainer(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration dataProvider, BitStorage storage, List list) { + // Paper start - Anti-Xray - Add preset values -+ @Deprecated public PalettedContainer(Palette fallbackPalette, IdMapper idList, Function elementDeserializer, Function elementSerializer, T defaultElement) { // Notice for updates: Please make sure this constructor isn't used anywhere -+ this(fallbackPalette, idList, elementDeserializer, elementSerializer, defaultElement, null, true); ++ @Deprecated public PalettedContainer(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration dataProvider, BitStorage storage, List list) { // Notice for updates: Please make sure this constructor isn't used anywhere ++ this(idList, paletteProvider, dataProvider, storage, list, null, true); + } -+ public PalettedContainer(Palette fallbackPalette, IdMapper idList, Function elementDeserializer, Function elementSerializer, T defaultElement, T[] presetValues, boolean initialize) { ++ public PalettedContainer(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration dataProvider, BitStorage storage, List list, T[] presetValues, boolean initialize) { + // Paper end - this.globalPalette = fallbackPalette; this.registry = idList; - this.reader = elementDeserializer; - this.writer = elementSerializer; - this.defaultValue = defaultElement; -- this.setBits(4); + this.strategy = paletteProvider; + Palette datapalette = dataProvider.factory().create(dataProvider.bits(), idList, this, list); + + this.data = new PalettedContainer.Data(dataProvider, storage, datapalette); + // Paper start - Anti-Xray - Add preset values + this.presetValues = presetValues; + -+ if (initialize) { -+ if (presetValues == null) { ++ if(initialize) { ++ if(presetValues == null) { + // Default + this.setBits(4); + } else { @@ -1315,8 +1256,8 @@ index bb8fd88aebb550edec8c679622a02a595cbc6694..ac51089aae57a5f1d2411367ff177e05 + } + } + // Paper end -+ } -+ + } + + // Paper start - Anti-Xray - Add preset values + private void addPresetValues() { + if (this.presetValues != null && this.palette != this.globalPalette) { @@ -1324,23 +1265,24 @@ index bb8fd88aebb550edec8c679622a02a595cbc6694..ac51089aae57a5f1d2411367ff177e05 + this.palette.idFor(presetValue); + } + } - } ++ } + // Paper end - - private static int getIndex(int x, int y, int z) { - return y << 8 | z << 4 | x; -@@ -84,6 +117,7 @@ public class PalettedContainer implements PaletteResize { - BitStorage bitStorage = this.storage; - Palette palette = this.palette; - this.setBits(newSize); ++ + public PalettedContainer(IdMap idList, T object, PalettedContainer.Strategy paletteProvider) { + this.strategy = paletteProvider; + this.registry = idList; +@@ -88,6 +122,7 @@ public class PalettedContainer implements PaletteResize { + public int onResize(int newBits, T object) { + PalettedContainer.Data datapaletteblock_c = this.data; + PalettedContainer.Data datapaletteblock_c1 = this.createOrReuseData(datapaletteblock_c, newBits); + this.addPresetValues(); // Paper - Anti-Xray - Add preset values - for(int i = 0; i < bitStorage.getSize(); ++i) { - T object = palette.valueFor(bitStorage.get(i)); -@@ -153,17 +187,38 @@ public class PalettedContainer implements PaletteResize { - - this.palette.read(buf); - buf.readLongArray(this.storage.getRaw()); + datapaletteblock_c1.copyFrom(datapaletteblock_c.palette, datapaletteblock_c.storage); + this.data = datapaletteblock_c1; +@@ -168,17 +203,26 @@ public class PalettedContainer implements PaletteResize { + datapaletteblock_c.palette.read(buf); + buf.readLongArray(datapaletteblock_c.storage.getRaw()); + this.data = datapaletteblock_c; + // Paper start - Anti-Xray - Add preset values + // If there are many preset values this may require several resize operations + // This can be avoided by calculating the required bits in advance, as it is done in #read(ListTag, long[]) @@ -1358,99 +1300,96 @@ index bb8fd88aebb550edec8c679622a02a595cbc6694..ac51089aae57a5f1d2411367ff177e05 + @Deprecated public void write(FriendlyByteBuf buf) { write(buf, null, 0); } // Notice for updates: Please make sure this method isn't used anywhere + public void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo chunkPacketInfo, int bottomBlockY) { + // Paper end + this.acquire(); + try { - this.acquire(); - buf.writeByte(this.bits); +- this.data.write(buf); ++ this.data.write(buf, chunkPacketInfo, bottomBlockY); + } finally { + this.release(); + } +@@ -188,6 +232,7 @@ public class PalettedContainer implements PaletteResize { + private static DataResult> read(IdMap idList, PalettedContainer.Strategy provider, PalettedContainer.DiscData serialized) { + List list = serialized.paletteEntries(); + int i = provider.size(); ++ // TODO I think we need to inject the old code into the calculateBitsForSerialization method + int j = provider.calculateBitsForSerialization(idList, list.size()); + PalettedContainer.Configuration datapaletteblock_a = provider.getConfiguration(idList, j); + Object object; +@@ -224,7 +269,7 @@ public class PalettedContainer implements PaletteResize { + } + } + +- return DataResult.success(new PalettedContainer<>(idList, provider, datapaletteblock_a, (BitStorage) object, list)); ++ return DataResult.success(new PalettedContainer<>(idList, provider, datapaletteblock_a, (BitStorage) object, list, this.presetValues, true)); + } + + private PalettedContainer.DiscData write(IdMap idList, PalettedContainer.Strategy provider) { +@@ -450,9 +495,22 @@ public class PalettedContainer implements PaletteResize { + return 1 + this.palette.getSerializedSize() + FriendlyByteBuf.getVarIntSize(this.storage.getSize()) + this.storage.getRaw().length * 8; + } + +- public void write(FriendlyByteBuf buf) { ++ // Paper start - Anti-Xray - Add chunk packet info ++ @Deprecated public void write(FriendlyByteBuf buf) { this.write(buf, null, 0);} // Notice for updates: Please make sure this method isn't used anywhere - it is used for biomes now ++ public void write(FriendlyByteBuf buf, com.destroystokyo.paper.antixray.ChunkPacketInfo chunkPacketInfo, int bottomBlockY) { ++ // Paper end + buf.writeByte(this.storage.getBits()); this.palette.write(buf); -+ + // Paper start - Anti-Xray - Add chunk packet info + if (chunkPacketInfo != null) { + // Bottom block to 0 based chunk section index + int chunkSectionIndex = (bottomBlockY >> 4) - chunkPacketInfo.getChunk().getMinSection(); -+ chunkPacketInfo.setBits(chunkSectionIndex, this.bits); ++ chunkPacketInfo.setBits(chunkSectionIndex, this.storage.getBits()); + chunkPacketInfo.setPalette(chunkSectionIndex, this.palette); + chunkPacketInfo.setIndex(chunkSectionIndex, buf.writerIndex() + FriendlyByteBuf.getVarIntSize(this.storage.getRaw().length)); -+ chunkPacketInfo.setPresetValues(chunkSectionIndex, this.presetValues); ++ chunkPacketInfo.setPresetValues(chunkSectionIndex, this.presetValues); // TODO where do we get this from? + } + // Paper end -+ buf.writeLongArray(this.storage.getRaw()); - } finally { - this.release(); -@@ -174,12 +229,14 @@ public class PalettedContainer implements PaletteResize { - public void read(ListTag paletteNbt, long[] data) { - try { - this.acquire(); -- int i = Math.max(4, Mth.ceillog2(paletteNbt.size())); -- if (i != this.bits) { -+ // Paper - Anti-Xray - TODO: Should this.presetValues.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)? -+ int i = Math.max(4, Mth.ceillog2(paletteNbt.size() + (this.presetValues == null ? 0 : this.presetValues.length))); // Paper - Anti-Xray - Calculate the size with preset values -+ if (true || i != this.bits) { // Paper - Anti-Xray - Not initialized yet - this.setBits(i); - } + } - this.palette.read(paletteNbt); -+ this.addPresetValues(); // Paper - Anti-Xray - Add preset values - int j = data.length * 64 / 4096; - if (this.palette == this.globalPalette) { - Palette palette = new HashMapPalette<>(this.registry, i, this.dummyPaletteResize, this.reader, this.writer); -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 670e4f65680ca36fba1c84cb334c470ea8fa9b60..79f2b3942a3ccccd8fe8719db12de458212e8659 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -134,7 +134,7 @@ public class ChunkSerializer { - byte b0 = nbttagcompound2.getByte("Y"); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 8d1cbefc82f64a120eeea8c6bdd6361ffa513099..e8cb57d79c73f115679ddc2e6f579b5e1b5e482b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -2204,7 +2204,7 @@ public final class CraftServer implements Server { + public ChunkGenerator.ChunkData createChunkData(World world) { + Validate.notNull(world, "World cannot be null"); + ServerLevel handle = ((CraftWorld) world).getHandle(); +- return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)); ++ return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY). world); // Paper - anti xray - add parameters + } - if (nbttagcompound2.contains("Palette", 9) && nbttagcompound2.contains("BlockStates", 12)) { -- LevelChunkSection chunksection = new LevelChunkSection(b0); -+ LevelChunkSection chunksection = new LevelChunkSection(b0, null, world, false); // Paper - Anti-Xray - Add parameters and don't initialize because it's done in the line below internally - - chunksection.getStates().read(nbttagcompound2.getList("Palette", 10), nbttagcompound2.getLongArray("BlockStates")); - chunksection.recalcBlockCounts(); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 7467de2da7cbe79df49d9bd95df1891810a1431b..46136c5daa1b4ea9103c736cc4b035195177368e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -51,7 +51,7 @@ public class CraftChunk implements Chunk { - private final ServerLevel worldServer; - private final int x; - private final int z; -- private static final PalettedContainer emptyBlockIDs = new LevelChunkSection(0).getStates(); -+ private static final PalettedContainer emptyBlockIDs = new LevelChunkSection(0, null, null, true).getStates(); // Paper - Anti-Xray - Add parameters - private static final byte[] emptyLight = new byte[2048]; - - public CraftChunk(net.minecraft.world.level.chunk.LevelChunk chunk) { -@@ -332,7 +332,7 @@ public class CraftChunk implements Chunk { - CompoundTag data = new CompoundTag(); - cs[i].getStates().write(data, "Palette", "BlockStates"); - -- PalettedContainer blockids = new PalettedContainer<>(LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE, net.minecraft.world.level.block.Block.BLOCK_STATE_REGISTRY, NbtUtils::readBlockState, NbtUtils::writeBlockState, Blocks.AIR.defaultBlockState()); // TODO: snapshot whole ChunkSection -+ PalettedContainer blockids = new PalettedContainer<>(LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE, net.minecraft.world.level.block.Block.BLOCK_STATE_REGISTRY, NbtUtils::readBlockState, NbtUtils::writeBlockState, Blocks.AIR.defaultBlockState(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no preset block states and don't initialize because it's done in the line below internally - blockids.read(data.getList("Palette", CraftMagicNumbers.NBT.TAG_COMPOUND), data.getLongArray("BlockStates")); - - sectionBlockIDs[i] = blockids; + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java -index 7bfd803d11976dba9ace79edc76bb083a2eccf38..a48c659c02c6c33a8efdac6daf9c9a0708f05071 100644 +index 960405935e395a31c0300773c41413801cf0d290..7acf5e6e7e038895d49a0d01d319eb7c8ba809bf 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java -@@ -25,9 +25,11 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData { - private final LevelChunkSection[] sections; +@@ -27,8 +27,13 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData { + private final Registry biomes; private Set tiles; private final Set lights = new HashSet<>(); + private World world; // Paper - Anti-Xray - Add parameters - public OldCraftChunkData(World world) { - this(world.getMinHeight(), world.getMaxHeight()); -+ this.world = world; // Paper - Anti-Xray - Add parameters - } - - /* pp for tests */ OldCraftChunkData(int minHeight, int maxHeight) { -@@ -177,7 +179,7 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData { +- public OldCraftChunkData(int minHeight, int maxHeight, Registry biomes) { ++// Paper start - Anti-Xray - Add parameters ++ @Deprecated OldCraftChunkData(int minHeight, int maxHeight, Registry biomes) { this(minHeight, maxHeight, biomes, null); } // Only used in tests ++ public OldCraftChunkData(int minHeight, int maxHeight, Registry biomes, World world) { ++ this.world = world; ++ // Paper end + this.minHeight = minHeight; + this.maxHeight = maxHeight; + this.biomes = biomes; +@@ -176,7 +181,11 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData { int offset = (y - this.minHeight) >> 4; LevelChunkSection section = this.sections[offset]; if (create && section == null) { -- this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4)); -+ this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4), null, world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) this.world).getHandle() : null, true); // Paper - Anti-Xray - Add parameters ++<<<<<<< HEAD + this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4), this.biomes); ++======= ++ this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4), this.biomes, null, world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) this.world).getHandle() : null, true); // Paper - Anti-Xray - Add parameters ++>>>>>>> Anti-Xray } return section; } diff --git a/patches/unapplied/server/0354-PlayerDeathEvent-shouldDropExperience.patch b/patches/server/0348-PlayerDeathEvent-shouldDropExperience.patch similarity index 85% rename from patches/unapplied/server/0354-PlayerDeathEvent-shouldDropExperience.patch rename to patches/server/0348-PlayerDeathEvent-shouldDropExperience.patch index 66374a57a5..c4f047485d 100644 --- a/patches/unapplied/server/0354-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/server/0348-PlayerDeathEvent-shouldDropExperience.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3e3582742792858c2b8328676faed68ddb6da674..363d86e4a35b87c3fabf7a0e4b6d9e6c2caaf3de 100644 +index ea73914ec8fb877de3f34cf7d5a0d60d547733fe..b193f8dfbe7b61c919ad5eb452d29885982e25e4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -846,7 +846,7 @@ public class ServerPlayer extends Player { +@@ -884,7 +884,7 @@ public class ServerPlayer extends Player { this.tellNeutralMobsThatIDied(); } // SPIGOT-5478 must be called manually now diff --git a/patches/unapplied/server/0355-Prevent-bees-loading-chunks-checking-hive-position.patch b/patches/server/0349-Prevent-bees-loading-chunks-checking-hive-position.patch similarity index 85% rename from patches/unapplied/server/0355-Prevent-bees-loading-chunks-checking-hive-position.patch rename to patches/server/0349-Prevent-bees-loading-chunks-checking-hive-position.patch index fe6a29860b..1a6db3ffe9 100644 --- a/patches/unapplied/server/0355-Prevent-bees-loading-chunks-checking-hive-position.patch +++ b/patches/server/0349-Prevent-bees-loading-chunks-checking-hive-position.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent bees loading chunks checking hive position diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index c5317683e6e78f2956637a6ca5fb9a477e85ed03..47be3e33f89bdd633aba381c8c3052cfebf64d48 100644 +index 4d335a725506cbf54604ea3e76ca39ef0f3ca013..d5d61129d72f061ef1e45d39778072ee1e51fc2d 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -495,6 +495,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -497,6 +497,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { if (!this.hasHive()) { return false; } else { diff --git a/patches/unapplied/server/0356-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/patches/server/0350-Don-t-load-Chunks-from-Hoppers-and-other-things.patch similarity index 100% rename from patches/unapplied/server/0356-Don-t-load-Chunks-from-Hoppers-and-other-things.patch rename to patches/server/0350-Don-t-load-Chunks-from-Hoppers-and-other-things.patch diff --git a/patches/unapplied/server/0357-Guard-against-serializing-mismatching-chunk-coordina.patch b/patches/server/0351-Guard-against-serializing-mismatching-chunk-coordina.patch similarity index 64% rename from patches/unapplied/server/0357-Guard-against-serializing-mismatching-chunk-coordina.patch rename to patches/server/0351-Guard-against-serializing-mismatching-chunk-coordina.patch index 391e5d38f6..9bbe141d96 100644 --- a/patches/unapplied/server/0357-Guard-against-serializing-mismatching-chunk-coordina.patch +++ b/patches/server/0351-Guard-against-serializing-mismatching-chunk-coordina.patch @@ -6,39 +6,36 @@ Subject: [PATCH] Guard against serializing mismatching chunk coordinate Should help if something dumb happens diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 83fa00de1a7cb690c763cec9c8d4b3fcd44e7c74..670e4f65680ca36fba1c84cb334c470ea8fa9b60 100644 +index 992a7d6c4372942711a1381ac08ee13910a62cb0..37855d2183212cb043b30418740c0fd047dbc07f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -67,6 +67,13 @@ public class ChunkSerializer { +@@ -75,6 +75,12 @@ public class ChunkSerializer { public ChunkSerializer() {} + // Paper start - guard against serializing mismatching coordinates + // TODO Note: This needs to be re-checked each update + public static ChunkPos getChunkCoordinate(CompoundTag chunkData) { -+ CompoundTag levelData = chunkData.getCompound("Level"); -+ return new ChunkPos(levelData.getInt("xPos"), levelData.getInt("zPos")); ++ return new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos")); + } + // Paper end // Paper start public static final class InProgressChunkHolder { -@@ -93,8 +100,8 @@ public class ChunkSerializer { +@@ -100,7 +106,7 @@ public class ChunkSerializer { + public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) { + java.util.ArrayDeque tasksToExecuteOnMain = new java.util.ArrayDeque<>(); // Paper end - ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator(); - BiomeSource worldchunkmanager = chunkgenerator.getBiomeSource(); -- CompoundTag nbttagcompound1 = nbt.getCompound("Level"); -- ChunkPos chunkcoordintpair1 = new ChunkPos(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos")); -+ CompoundTag nbttagcompound1 = nbt.getCompound("Level"); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate -+ ChunkPos chunkcoordintpair1 = new ChunkPos(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate +- ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); ++ ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate - if (!Objects.equals(pos, chunkcoordintpair1)) { - ChunkSerializer.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", pos, pos, chunkcoordintpair1); + if (!Objects.equals(chunkPos, chunkcoordintpair1)) { + ChunkSerializer.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", chunkPos, chunkPos, chunkcoordintpair1); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -index 6f13c7adce7d4b3d170045ea5ef2a841d34ae7b0..176610b31f66b890afe61f4de46c412382bb8d22 100644 +index 1fc202caf9051f12192ed479898b01b0a02eebbd..0631a5b1af38ace5ad167d1986271081bd2ee7a6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -@@ -117,6 +117,13 @@ public class ChunkStorage implements AutoCloseable { +@@ -132,6 +132,13 @@ public class ChunkStorage implements AutoCloseable { // Paper start - async chunk io public void write(ChunkPos chunkPos, CompoundTag nbt) throws IOException { diff --git a/patches/unapplied/server/0358-Optimise-IEntityAccess-getPlayerByUUID.patch b/patches/server/0352-Optimise-IEntityAccess-getPlayerByUUID.patch similarity index 90% rename from patches/unapplied/server/0358-Optimise-IEntityAccess-getPlayerByUUID.patch rename to patches/server/0352-Optimise-IEntityAccess-getPlayerByUUID.patch index d6d629d088..b218ba3778 100644 --- a/patches/unapplied/server/0358-Optimise-IEntityAccess-getPlayerByUUID.patch +++ b/patches/server/0352-Optimise-IEntityAccess-getPlayerByUUID.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise IEntityAccess#getPlayerByUUID Use the world entity map instead of iterating over all players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b3d54c90e87347cb7c709059c090371a40c7b047..fa5aa491c3ed6bf50b7f34c9f32a0b146e6c0aef 100644 +index 53067edd56a4b7571f693c593c0f103567d589ec..3b43e64766e7b9e0444ebee12deee7f12fe5ddb8 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -370,6 +370,14 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -382,6 +382,14 @@ public class ServerLevel extends Level implements WorldGenLevel { public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; // Paper end diff --git a/patches/unapplied/server/0359-Fix-items-not-falling-correctly.patch b/patches/server/0353-Fix-items-not-falling-correctly.patch similarity index 90% rename from patches/unapplied/server/0359-Fix-items-not-falling-correctly.patch rename to patches/server/0353-Fix-items-not-falling-correctly.patch index 8eba5c8d55..e5f37676a4 100644 --- a/patches/unapplied/server/0359-Fix-items-not-falling-correctly.patch +++ b/patches/server/0353-Fix-items-not-falling-correctly.patch @@ -15,10 +15,10 @@ This patch resolves the conflict by offsetting checking an item's move method from Spigot's entity activation range check. diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 82ffe3624943d2e931e2cc2f85ede94f369bd06b..9ee1dc89dd4c6b9453e1f6f92208d454877d23c9 100644 +index f3991a30f634122020ca6334bc6f2ca84e93ecac..1378c8ab35b3828f7c0ad504e64bb72484a1026d 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -135,7 +135,7 @@ public class ItemEntity extends Entity { +@@ -134,7 +134,7 @@ public class ItemEntity extends Entity { } } diff --git a/patches/unapplied/server/0360-Lag-compensate-eating.patch b/patches/server/0354-Lag-compensate-eating.patch similarity index 86% rename from patches/unapplied/server/0360-Lag-compensate-eating.patch rename to patches/server/0354-Lag-compensate-eating.patch index d8f5ced945..c33acb451f 100644 --- a/patches/unapplied/server/0360-Lag-compensate-eating.patch +++ b/patches/server/0354-Lag-compensate-eating.patch @@ -7,10 +7,10 @@ When the server is lagging, players will wait longer when eating. Change to also use a time check instead if it passes. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 55ac5e8cad4c7eee3d8b165698200e9afcd44594..50d180daff7258795d476b9cd43412fba2fba50f 100644 +index 077e5f4f787cdf4b8e7ba08dbc0c7bf04a6e5b93..8217a8e2c170aa78586ae0054a35fc9158f70bae 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3498,6 +3498,11 @@ public abstract class LivingEntity extends Entity { +@@ -3501,6 +3501,11 @@ public abstract class LivingEntity extends Entity { return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND; } @@ -22,7 +22,7 @@ index 55ac5e8cad4c7eee3d8b165698200e9afcd44594..50d180daff7258795d476b9cd43412fb private void updatingUsingItem() { if (this.isUsingItem()) { if (ItemStack.isSameIgnoreDurability(this.getItemInHand(this.getUsedItemHand()), this.useItem)) { -@@ -3515,8 +3520,12 @@ public abstract class LivingEntity extends Entity { +@@ -3518,8 +3523,12 @@ public abstract class LivingEntity extends Entity { if (this.shouldTriggerItemUseEffects()) { this.triggerItemUseEffects(stack, 5); } @@ -37,7 +37,7 @@ index 55ac5e8cad4c7eee3d8b165698200e9afcd44594..50d180daff7258795d476b9cd43412fb this.completeUsingItem(); } -@@ -3562,7 +3571,10 @@ public abstract class LivingEntity extends Entity { +@@ -3567,7 +3576,10 @@ public abstract class LivingEntity extends Entity { if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag this.useItem = itemstack; @@ -48,8 +48,8 @@ index 55ac5e8cad4c7eee3d8b165698200e9afcd44594..50d180daff7258795d476b9cd43412fb + // Paper end if (!this.level.isClientSide) { this.setLivingEntityFlag(1, true); - this.setLivingEntityFlag(2, enumhand == InteractionHand.OFF_HAND); -@@ -3586,7 +3598,10 @@ public abstract class LivingEntity extends Entity { + this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); +@@ -3591,7 +3603,10 @@ public abstract class LivingEntity extends Entity { } } else if (!this.isUsingItem() && !this.useItem.isEmpty()) { this.useItem = ItemStack.EMPTY; @@ -61,7 +61,7 @@ index 55ac5e8cad4c7eee3d8b165698200e9afcd44594..50d180daff7258795d476b9cd43412fb } } -@@ -3712,7 +3727,10 @@ public abstract class LivingEntity extends Entity { +@@ -3717,7 +3732,10 @@ public abstract class LivingEntity extends Entity { } this.useItem = ItemStack.EMPTY; diff --git a/patches/unapplied/server/0361-Optimize-call-to-getFluid-for-explosions.patch b/patches/server/0355-Optimize-call-to-getFluid-for-explosions.patch similarity index 87% rename from patches/unapplied/server/0361-Optimize-call-to-getFluid-for-explosions.patch rename to patches/server/0355-Optimize-call-to-getFluid-for-explosions.patch index d0ec9f2fef..cda154255f 100644 --- a/patches/unapplied/server/0361-Optimize-call-to-getFluid-for-explosions.patch +++ b/patches/server/0355-Optimize-call-to-getFluid-for-explosions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize call to getFluid for explosions diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 35ea80a18234d8125397edb5bab9e86ea526d3ca..a861b4b55862b1c5583101fe7f28a3a43c547468 100644 +index 32c8403d6a5f5fbd52679b12b07936147744b8a4..548f103e648d9670d7434182c6598dc29ae77b57 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java -@@ -174,7 +174,7 @@ public class Explosion { +@@ -173,7 +173,7 @@ public class Explosion { for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { BlockPos blockposition = new BlockPos(d4, d5, d6); BlockState iblockdata = this.level.getBlockState(blockposition); diff --git a/patches/unapplied/server/0362-Fix-last-firework-in-stack-not-having-effects-when-d.patch b/patches/server/0356-Fix-last-firework-in-stack-not-having-effects-when-d.patch similarity index 90% rename from patches/unapplied/server/0362-Fix-last-firework-in-stack-not-having-effects-when-d.patch rename to patches/server/0356-Fix-last-firework-in-stack-not-having-effects-when-d.patch index 50ec050594..602eb2b818 100644 --- a/patches/unapplied/server/0362-Fix-last-firework-in-stack-not-having-effects-when-d.patch +++ b/patches/server/0356-Fix-last-firework-in-stack-not-having-effects-when-d.patch @@ -9,10 +9,10 @@ dispensed. The resulting item would have size == 0 and therefore be convertered to air, hence why the effects disappeared. diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 442845d1aa26cf888c88536c6a7db510807b2855..c5c8a889b745f36c2dce9dbb5d0b6edaefafdd22 100644 +index ba28fdc1a7ed2bc9d55489a8aeb3f786d31c732e..89921ffeae7cc715aa18cbf8687e7c8e612e5612 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -513,7 +513,7 @@ public interface DispenseItemBehavior { +@@ -510,7 +510,7 @@ public interface DispenseItemBehavior { } itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); diff --git a/patches/unapplied/server/0363-Add-effect-to-block-break-naturally.patch b/patches/server/0357-Add-effect-to-block-break-naturally.patch similarity index 88% rename from patches/unapplied/server/0363-Add-effect-to-block-break-naturally.patch rename to patches/server/0357-Add-effect-to-block-break-naturally.patch index e639827b6e..ebb75c4859 100644 --- a/patches/unapplied/server/0363-Add-effect-to-block-break-naturally.patch +++ b/patches/server/0357-Add-effect-to-block-break-naturally.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add effect to block break naturally diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 71b5ef18e6b0ef48834c125d9503f70359a2dfd0..5f9f35c25a6247b6cd1ba31888a0afb8cea31da2 100644 +index 0408a72e801178375426edf3e1c1880774ca5478..00056d5b3426df121242de2ae01fca492d20089a 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -465,6 +465,18 @@ public class CraftBlock implements Block { +@@ -468,6 +468,18 @@ public class CraftBlock implements Block { @Override public boolean breakNaturally(ItemStack item) { @@ -27,7 +27,7 @@ index 71b5ef18e6b0ef48834c125d9503f70359a2dfd0..5f9f35c25a6247b6cd1ba31888a0afb8 // Order matters here, need to drop before setting to air so skulls can get their data net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS(); net.minecraft.world.level.block.Block block = iblockdata.getBlock(); -@@ -474,6 +486,7 @@ public class CraftBlock implements Block { +@@ -477,6 +489,7 @@ public class CraftBlock implements Block { // Modelled off EntityHuman#hasBlock if (block != Blocks.AIR && (item == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) { net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), position, this.world.getBlockEntity(position), null, nmsItem); diff --git a/patches/unapplied/server/0364-Entity-Activation-Range-2.0.patch b/patches/server/0358-Entity-Activation-Range-2.0.patch similarity index 92% rename from patches/unapplied/server/0364-Entity-Activation-Range-2.0.patch rename to patches/server/0358-Entity-Activation-Range-2.0.patch index 92ea7bcf6b..09d100bb3b 100644 --- a/patches/unapplied/server/0364-Entity-Activation-Range-2.0.patch +++ b/patches/server/0358-Entity-Activation-Range-2.0.patch @@ -14,7 +14,7 @@ Adds flying monsters to control ghast and phantoms Adds villagers as separate config diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6fb49058cd958a394870dc527342be4cd94135c9..4c45110320004eb1c6f8c73d5c67880110e6ef08 100644 +index 3b43e64766e7b9e0444ebee12deee7f12fe5ddb8..09deaa9badf53bdc1292796c643751d8d92ac585 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -33,15 +33,7 @@ index 6fb49058cd958a394870dc527342be4cd94135c9..4c45110320004eb1c6f8c73d5c678801 import it.unimi.dsi.fastutil.objects.ObjectIterator; import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -@@ -122,7 +120,6 @@ import net.minecraft.world.level.chunk.LevelChunkSection; - import net.minecraft.world.level.chunk.storage.EntityStorage; - import net.minecraft.world.level.dimension.DimensionType; - import net.minecraft.world.level.dimension.end.EndDragonFight; --import net.minecraft.world.level.entity.EntityAccess; - import net.minecraft.world.level.entity.EntityPersistentStorage; - import net.minecraft.world.level.entity.EntityTickList; - import net.minecraft.world.level.entity.EntityTypeTest; -@@ -943,17 +940,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -964,17 +962,17 @@ public class ServerLevel extends Level implements WorldGenLevel { ++TimingHistory.entityTicks; // Paper - timings // Spigot start co.aikar.timings.Timing timer; // Paper @@ -63,7 +55,7 @@ index 6fb49058cd958a394870dc527342be4cd94135c9..4c45110320004eb1c6f8c73d5c678801 try { // Paper end - timings entity.setOldPosAndRot(); -@@ -964,9 +961,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -985,9 +983,13 @@ public class ServerLevel extends Level implements WorldGenLevel { return Registry.ENTITY_TYPE.getKey(entity.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickNonPassenger"); @@ -77,7 +69,7 @@ index 6fb49058cd958a394870dc527342be4cd94135c9..4c45110320004eb1c6f8c73d5c678801 Iterator iterator = entity.getPassengers().iterator(); while (iterator.hasNext()) { -@@ -974,13 +975,18 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -995,13 +997,18 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } @@ -97,7 +89,7 @@ index 6fb49058cd958a394870dc527342be4cd94135c9..4c45110320004eb1c6f8c73d5c678801 passenger.setOldPosAndRot(); ++passenger.tickCount; ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -989,8 +995,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1010,8 +1017,17 @@ public class ServerLevel extends Level implements WorldGenLevel { return Registry.ENTITY_TYPE.getKey(passenger.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickPassenger"); @@ -115,7 +107,7 @@ index 6fb49058cd958a394870dc527342be4cd94135c9..4c45110320004eb1c6f8c73d5c678801 gameprofilerfiller.pop(); Iterator iterator = passenger.getPassengers().iterator(); -@@ -1000,6 +1015,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1021,6 +1037,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(passenger, entity2); } @@ -124,10 +116,10 @@ index 6fb49058cd958a394870dc527342be4cd94135c9..4c45110320004eb1c6f8c73d5c678801 } else { passenger.stopRiding(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8e30a0d42d422fea6bda77d16d5eae8bab01224d..3268187f77b78a04191628b06dc7693b08b8d642 100644 +index d9feae255354f5577b5fa2b202f33bbc7e645867..d789a9068353c8e7be774c275d4d099283bf826c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -327,6 +327,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -331,6 +331,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; @@ -136,7 +128,7 @@ index 8e30a0d42d422fea6bda77d16d5eae8bab01224d..3268187f77b78a04191628b06dc7693b public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one protected int numCollisions = 0; // Paper public void inactiveTick() { } -@@ -773,6 +775,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -779,6 +781,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } else { this.wasOnFire = this.isOnFire(); if (movementType == MoverType.PISTON) { @@ -145,7 +137,7 @@ index 8e30a0d42d422fea6bda77d16d5eae8bab01224d..3268187f77b78a04191628b06dc7693b movement = this.limitPistonMovement(movement); if (movement.equals(Vec3.ZERO)) { return; -@@ -785,6 +789,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -791,6 +795,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.stuckSpeedMultiplier = Vec3.ZERO; this.setDeltaMovement(Vec3.ZERO); } @@ -160,10 +152,10 @@ index 8e30a0d42d422fea6bda77d16d5eae8bab01224d..3268187f77b78a04191628b06dc7693b movement = this.maybeBackOffFromEdge(movement, movementType); Vec3 vec3d1 = this.collide(movement); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 6e5682fed08a41c7e573e6611fca93bf85019b9f..976dbf40292b10364f9e80bebe96ec9c4dfb657e 100644 +index ad2ef9460d85b2182f6af35733daadcedbd15e4c..63b0044a86e6830ccf9d6da8e29989de1402dff4 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -203,6 +203,19 @@ public abstract class Mob extends LivingEntity { +@@ -206,6 +206,19 @@ public abstract class Mob extends LivingEntity { return this.lookControl; } @@ -184,22 +176,22 @@ index 6e5682fed08a41c7e573e6611fca93bf85019b9f..976dbf40292b10364f9e80bebe96ec9c if (this.isPassenger() && this.getVehicle() instanceof Mob) { Mob entityinsentient = (Mob) this.getVehicle(); diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -index 920ae9af8985705a0ada7da5b7085a1ed8ca7f27..7c82d453388a27b69207d051dec316fc14715e2b 100644 +index ff458abb221daaddaa734811eaaa35ea43883343..d1ab31d03ae421e628448fe2492ff138dc57c00f 100644 --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -@@ -13,6 +13,7 @@ import org.bukkit.event.entity.EntityUnleashEvent; - public abstract class PathfinderMob extends Mob { +@@ -19,6 +19,7 @@ public abstract class PathfinderMob extends Mob { + } public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper + public BlockPos movingTarget = null; public BlockPos getMovingTarget() { return movingTarget; } // Paper - protected PathfinderMob(EntityType type, Level world) { - super(type, world); + public float getWalkTargetValue(BlockPos pos) { + return this.getWalkTargetValue(pos, this.level); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index dc7da3b806d1c759958d7c51b05efbc4b6c42653..69bf112655615337e0df3ea56b9e42fa5ff70430 100644 +index 30bf98ad7fad6c6fdc8bc48e9f4caa0443cdb31c..2bb32378b19a21c94ff3ec8ed32fc9d6f0ad0fdb 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -31,6 +31,7 @@ public class GoalSelector { +@@ -33,6 +33,7 @@ public class GoalSelector { private final EnumSet disabledFlags = EnumSet.noneOf(Goal.Flag.class); private int tickCount; private int newGoalRate = 3; @@ -207,7 +199,7 @@ index dc7da3b806d1c759958d7c51b05efbc4b6c42653..69bf112655615337e0df3ea56b9e42fa public GoalSelector(Supplier profiler) { this.profiler = profiler; -@@ -45,6 +46,20 @@ public class GoalSelector { +@@ -47,6 +48,20 @@ public class GoalSelector { this.availableGoals.clear(); } @@ -229,7 +221,7 @@ index dc7da3b806d1c759958d7c51b05efbc4b6c42653..69bf112655615337e0df3ea56b9e42fa this.availableGoals.stream().filter((wrappedGoal) -> { return wrappedGoal.getGoal() == goal; diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java -index 27ea9c10b7f66c2133b0829c0b1c37143dd80b56..c28ade67f6a59146064a57bf016a646197f47ac4 100644 +index 8d8cce87acc5a93afb4b8925a5a5dbf71d371fcd..7fc40bb5fb6265b283c7c611f63aae76302c0eaf 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java @@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal { @@ -255,7 +247,7 @@ index 27ea9c10b7f66c2133b0829c0b1c37143dd80b56..c28ade67f6a59146064a57bf016a6461 public MoveToBlockGoal(PathfinderMob mob, double speed, int range, int maxYDifference) { this.mob = mob; -@@ -109,6 +116,7 @@ public abstract class MoveToBlockGoal extends Goal { +@@ -114,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal { mutableBlockPos.setWithOffset(blockPos, m, k - 1, n); if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level, mutableBlockPos)) { this.blockPos = mutableBlockPos; @@ -264,10 +256,10 @@ index 27ea9c10b7f66c2133b0829c0b1c37143dd80b56..c28ade67f6a59146064a57bf016a6461 } } diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 206aee8bf14ffc4ddbb8a7001bc3baae6a2ea849..64d5ddb8ce06e17e1a4dee284ba4c6ecfcdae11e 100644 +index 55e4e7fcefc60e66239035e72ad44e0c796bf300..785fcb94d707b6790ef2191f7c9db77d253e9c6d 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -227,17 +227,29 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -223,17 +223,29 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public void inactiveTick() { // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( @@ -296,12 +288,12 @@ index 206aee8bf14ffc4ddbb8a7001bc3baae6a2ea849..64d5ddb8ce06e17e1a4dee284ba4c6ec + protected void customServerAiStep() { mobTick(false); } + protected void mobTick(boolean inactive) { this.level.getProfiler().push("villagerBrain"); -- this.getBrain().tick((ServerLevel) this.level, this); // CraftBukkit - decompile error -+ if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // CraftBukkit - decompile error // Paper +- this.getBrain().tick((ServerLevel) this.level, this); ++ if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper this.level.getProfiler().pop(); if (this.assignProfessionWhenSpawned) { this.assignProfessionWhenSpawned = false; -@@ -261,7 +273,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -257,7 +269,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.lastTradedPlayer = null; } @@ -310,7 +302,7 @@ index 206aee8bf14ffc4ddbb8a7001bc3baae6a2ea849..64d5ddb8ce06e17e1a4dee284ba4c6ec Raid raid = ((ServerLevel) this.level).getRaidAt(this.blockPosition()); if (raid != null && raid.isActive() && !raid.isOver()) { -@@ -272,6 +284,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -268,6 +280,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.isTrading()) { this.stopTrading(); } @@ -319,10 +311,10 @@ index 206aee8bf14ffc4ddbb8a7001bc3baae6a2ea849..64d5ddb8ce06e17e1a4dee284ba4c6ec super.customServerAiStep(); } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index f4163020d09b221625d9f49fddefe9544018cc17..13efcae91a863f9c7255472d1c45ce16be371c6d 100644 +index faaa93e77523fbb942690491687410df48899ddb..de7abae207b0a565a25fa4ed2f66b94c6b0cdcf9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -156,6 +156,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -157,6 +157,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public long ticksPerWaterAmbientSpawns; public long ticksPerWaterUndergroundCreatureSpawns; public long ticksPerAmbientSpawns; @@ -336,7 +328,7 @@ index f4163020d09b221625d9f49fddefe9544018cc17..13efcae91a863f9c7255472d1c45ce16 public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index 9b631698d1c736f61e07a5a1253127f4081dc90d..54020a3f2b18c4f42008f5d5f4541ef1a1efbcd7 100644 +index 03b82d12325d54b9e5ac66b357d7995970c4cd4b..e2ea913f9e5ae2351f10e0ebedba89d2a6e62d96 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java @@ -140,6 +140,10 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -698,10 +690,10 @@ index 84ce3d38d5decb4a2f9fae78e0ef5d715860dc7d..e0302f82356e8cba848aa8cec1e821e0 isActive = false; } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 45be7d1821497f13ab0da3c4bbff7585238e902e..769a492305a3ce83e0da0b3de4ebd73859d1e1d9 100644 +index ee8c84770b9b7fb9f3763e378f399da58f042b06..6d36aa5006d3adc3ff30d196bdfd287ad38a564a 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -180,13 +180,59 @@ public class SpigotWorldConfig +@@ -193,13 +193,59 @@ public class SpigotWorldConfig public int monsterActivationRange = 32; public int raiderActivationRange = 48; public int miscActivationRange = 16; diff --git a/patches/unapplied/server/0365-Increase-Light-Queue-Size.patch b/patches/server/0359-Increase-Light-Queue-Size.patch similarity index 85% rename from patches/unapplied/server/0365-Increase-Light-Queue-Size.patch rename to patches/server/0359-Increase-Light-Queue-Size.patch index 874192865f..a54324ffc2 100644 --- a/patches/unapplied/server/0365-Increase-Light-Queue-Size.patch +++ b/patches/server/0359-Increase-Light-Queue-Size.patch @@ -14,10 +14,10 @@ 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 e8746656ac12d3498e78cb603c14d4c31abbc023..ade858610c76be24576fe60d509e4a8f2531f442 100644 +index 1dba00531e909214119219e928b2875676c00e75..7a97a4a395f20680bc3b028586c9a17b84783d99 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -523,5 +523,10 @@ public class PaperWorldConfig { +@@ -513,5 +513,10 @@ public class PaperWorldConfig { hoppersIgnoreOccludingBlocks = getBoolean("hopper.ignore-occluding-blocks", hoppersIgnoreOccludingBlocks); log("Hopper Ignore Occluding Blocks: " + (hoppersIgnoreOccludingBlocks ? "enabled" : "disabled")); } @@ -29,15 +29,15 @@ index e8746656ac12d3498e78cb603c14d4c31abbc023..ade858610c76be24576fe60d509e4a8f } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bf08c45525cd898ad12d70bec5de3762063af2e0..28066e92531d2d8834686f075169007e25caa73d 100644 +index 4661d571cd4047c6b7d76de7ba0cb34ada348d63..758a972589b607447dc507c6c4f4b2a62f6a2832 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -845,7 +845,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> worldgenMailbox; public final ProcessorHandle> mainThreadMailbox; @@ -150,7 +150,7 @@ index 20a9d213b977cf8d8ada3815931bb0603d5571c9..2e17c387ca132c5ec7312a4f008d93d2 public final ChunkProgressListener progressListener; private final ChunkStatusUpdateListener chunkStatusListener; public final ChunkMap.ChunkDistanceManager distanceManager; -@@ -236,11 +242,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -240,11 +246,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.progressListener = worldGenerationProgressListener; this.chunkStatusListener = chunkStatusChangeListener;