diff --git a/patches/unapplied/api/0171-Add-ItemStack-Recipe-API-helper-methods.patch b/patches/api/0171-Add-ItemStack-Recipe-API-helper-methods.patch similarity index 100% rename from patches/unapplied/api/0171-Add-ItemStack-Recipe-API-helper-methods.patch rename to patches/api/0171-Add-ItemStack-Recipe-API-helper-methods.patch diff --git a/patches/api/0171-BlockDestroyEvent.patch b/patches/api/0172-BlockDestroyEvent.patch similarity index 100% rename from patches/api/0171-BlockDestroyEvent.patch rename to patches/api/0172-BlockDestroyEvent.patch diff --git a/patches/unapplied/api/0172-Add-WhitelistToggleEvent.patch b/patches/api/0173-Add-WhitelistToggleEvent.patch similarity index 100% rename from patches/unapplied/api/0172-Add-WhitelistToggleEvent.patch rename to patches/api/0173-Add-WhitelistToggleEvent.patch diff --git a/patches/unapplied/api/0173-Annotation-Test-changes.patch b/patches/api/0174-Annotation-Test-changes.patch similarity index 100% rename from patches/unapplied/api/0173-Annotation-Test-changes.patch rename to patches/api/0174-Annotation-Test-changes.patch diff --git a/patches/unapplied/server/0312-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch b/patches/removed/1.18/0312-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch similarity index 100% rename from patches/unapplied/server/0312-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch rename to patches/removed/1.18/0312-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch diff --git a/patches/unapplied/server/0307-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch b/patches/server/0306-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch similarity index 96% rename from patches/unapplied/server/0307-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch rename to patches/server/0306-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch index 408be3ab4b..903ba48692 100644 --- a/patches/unapplied/server/0307-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch +++ b/patches/server/0306-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch @@ -10,7 +10,7 @@ This made the Bukkit RecipeChoice API not work for Shapeless. This reimplements vanilla logic using the same test logic as Shaped diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java -index 4e1159b3188d39c998e6887c2846209c10b701f9..6b960f0a31175bcfd8d477ee5b3c4d783303cdd5 100644 +index 56835129a63ed22677b7bbd9576c4bdcc8bf5ac7..ffe5476d8ed15ee4384b679c341688787205ce59 100644 --- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java @@ -76,16 +76,49 @@ public class ShapelessRecipe implements CraftingRecipe { diff --git a/patches/unapplied/server/0308-Limit-Client-Sign-length-more.patch b/patches/server/0307-Limit-Client-Sign-length-more.patch similarity index 92% rename from patches/unapplied/server/0308-Limit-Client-Sign-length-more.patch rename to patches/server/0307-Limit-Client-Sign-length-more.patch index bbf5fc414c..46f72c515b 100644 --- a/patches/unapplied/server/0308-Limit-Client-Sign-length-more.patch +++ b/patches/server/0307-Limit-Client-Sign-length-more.patch @@ -22,10 +22,10 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2ea1e58cf721a8ae339cbfd6192f3312061249ba..b9f9314befff581e70ae7d8d4eab9040e4e4d26d 100644 +index be5f7b5e8537aa3bf4088fa8c2e9d6cce17c64ac..5d0836c8bc38e3d29f47359b273c58330805b396 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -254,6 +254,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -253,6 +253,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private int aboveGroundVehicleTickCount; private int receivedMovePacketCount; private int knownMovePacketCount; @@ -33,7 +33,7 @@ index 2ea1e58cf721a8ae339cbfd6192f3312061249ba..b9f9314befff581e70ae7d8d4eab9040 private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { -@@ -2848,6 +2849,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2861,6 +2862,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser for (int i = 0; i < signText.size(); ++i) { TextFilter.FilteredText currentLine = signText.get(i); diff --git a/patches/unapplied/server/0309-Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/patches/server/0308-Don-t-check-ConvertSigns-boolean-every-sign-save.patch similarity index 85% rename from patches/unapplied/server/0309-Don-t-check-ConvertSigns-boolean-every-sign-save.patch rename to patches/server/0308-Don-t-check-ConvertSigns-boolean-every-sign-save.patch index 5032a2a1f6..1f80323016 100644 --- a/patches/unapplied/server/0309-Don-t-check-ConvertSigns-boolean-every-sign-save.patch +++ b/patches/server/0308-Don-t-check-ConvertSigns-boolean-every-sign-save.patch @@ -7,10 +7,10 @@ property lookups arent super cheap. they synchronize, validate and check security managers. diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index 589fbdd5c86655244aa92a42e5f45747b5c5026e..9b5d11ece006d7aa893360a84ba652c666517ac1 100644 +index 3a2e2adeefe73981b443216724270023408c1feb..615c4f9d9841f7ddc3e5c854e90f41c3905c2e8f 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -26,6 +26,7 @@ import net.minecraft.world.phys.Vec2; +@@ -25,6 +25,7 @@ import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements @@ -18,7 +18,7 @@ index 589fbdd5c86655244aa92a42e5f45747b5c5026e..9b5d11ece006d7aa893360a84ba652c6 public static final int LINES = 4; private static final String[] RAW_TEXT_FIELD_NAMES = new String[]{"Text1", "Text2", "Text3", "Text4"}; -@@ -66,7 +67,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C +@@ -65,7 +66,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C } // CraftBukkit start diff --git a/patches/unapplied/server/0310-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0309-Optimize-Network-Manager-and-add-advanced-packet-sup.patch similarity index 98% rename from patches/unapplied/server/0310-Optimize-Network-Manager-and-add-advanced-packet-sup.patch rename to patches/server/0309-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 2f21dd2316..8ae2ad20e3 100644 --- a/patches/unapplied/server/0310-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/0309-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -28,7 +28,7 @@ and then catch exceptions and close if they fire. Part of this commit was authored by: Spottedleaf diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index b96ef2374b689ad715ce3b3a7c0b599a56b4c2d1..a3bfc12e34754dc5f8f53b968451a07f3a0ab496 100644 +index 821f22b8fde2d76bfcb417138f9bd83af766dcd7..f13e24eede7f09ecc8f375df5e27e385f589005d 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -87,6 +87,10 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -143,7 +143,7 @@ index b96ef2374b689ad715ce3b3a7c0b599a56b4c2d1..a3bfc12e34754dc5f8f53b968451a07f private void sendPacket(Packet packet, @Nullable GenericFutureListener> callback) { @@ -226,33 +299,79 @@ public class Connection extends SimpleChannelInboundHandler> { - this.setProtocol(enumprotocol); + this.setProtocol(packetState); } + // Paper start @@ -297,7 +297,7 @@ index 74bfe0d3942259c45702b099efdc4e101a4e3022..e8fcd56906d26f6dc87959e32c4c7c78 return false; } diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index abcd335f5577dae6d613e5e0dd2656e1ab3ee9f0..4e08fdf47fd201c26223fc8efb0ef4f6e884f8c7 100644 +index 526e07d8ea21af42c271bee4da5bccd766227006..6bf39699700075e295a693b56d237391de4e4f58 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -63,10 +63,12 @@ public class ServerConnectionListener { diff --git a/patches/server/0310-Handle-Oversized-Tile-Entities-in-chunks.patch b/patches/server/0310-Handle-Oversized-Tile-Entities-in-chunks.patch new file mode 100644 index 0000000000..8ea5cf15b3 --- /dev/null +++ b/patches/server/0310-Handle-Oversized-Tile-Entities-in-chunks.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 6 May 2020 05:00:57 -0400 +Subject: [PATCH] Handle Oversized Tile Entities in chunks + +Splits out Extra Packets if too many TE's are encountered to prevent +creating too large of a packet to sed. + +Co authored by Spottedleaf + +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +index 4ed3b1291ac443502e9b99f83ecf02b22509451c..dba11f277f3703e1ee7f5a62f021d319e4ab18fc 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +@@ -24,6 +24,14 @@ public class ClientboundLevelChunkPacketData { + private final CompoundTag heightmaps; + private final byte[] buffer; + private final List blockEntitiesData; ++ // Paper start ++ private final java.util.List extraPackets = new java.util.ArrayList<>(); ++ private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); ++ ++ public List getExtraPackets() { ++ return this.extraPackets; ++ } ++ // Paper end + + public ClientboundLevelChunkPacketData(LevelChunk chunk) { + this.heightmaps = new CompoundTag(); +@@ -37,8 +45,18 @@ public class ClientboundLevelChunkPacketData { + this.buffer = new byte[calculateChunkSize(chunk)]; + extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk); + this.blockEntitiesData = Lists.newArrayList(); ++ int totalTileEntities = 0; // Paper + + for(Entry entry2 : chunk.getBlockEntities().entrySet()) { ++ // Paper start ++ if (++totalTileEntities > TE_LIMIT) { ++ var packet = entry2.getValue().getUpdatePacket(); ++ if (packet != null) { ++ this.extraPackets.add(packet); ++ continue; ++ } ++ } ++ // Paper end + this.blockEntitiesData.add(ClientboundLevelChunkPacketData.BlockEntityInfo.create(entry2.getValue())); + } + +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 ad1d33a251bb7dc68fffc85491cc68e64e7dda1c..079734654c0fd421561b5f9003cd318bad5787a9 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +@@ -57,4 +57,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet getExtraPackets() { ++ return this.chunkData.getExtraPackets(); ++ } ++ // Paper end + } diff --git a/patches/unapplied/server/0313-Set-Zombie-last-tick-at-start-of-drowning-process.patch b/patches/server/0311-Set-Zombie-last-tick-at-start-of-drowning-process.patch similarity index 85% rename from patches/unapplied/server/0313-Set-Zombie-last-tick-at-start-of-drowning-process.patch rename to patches/server/0311-Set-Zombie-last-tick-at-start-of-drowning-process.patch index 5663954325..493063668c 100644 --- a/patches/unapplied/server/0313-Set-Zombie-last-tick-at-start-of-drowning-process.patch +++ b/patches/server/0311-Set-Zombie-last-tick-at-start-of-drowning-process.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Set Zombie last tick at start of drowning process Fixes GH-1887 diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 96d172c428c6293b346201159422e2a581e350d9..4f328c3281663a55eef879604d713ff38d797298 100644 +index 8c7c621f09e8669a6874a2ce101972cb1c03f8ae..a54af7c5b970102e8ff7f46bf4dd34b19faf3b8a 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -225,6 +225,7 @@ public class Zombie extends Monster { +@@ -222,6 +222,7 @@ public class Zombie extends Monster { ++this.inWaterTime; if (this.inWaterTime >= 600) { this.startUnderWaterConversion(300); diff --git a/patches/unapplied/server/0314-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/patches/server/0312-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch similarity index 82% rename from patches/unapplied/server/0314-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch rename to patches/server/0312-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index 6d6b263d39..7bbdc05cc4 100644 --- a/patches/unapplied/server/0314-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/patches/server/0312-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b2e418db3b8b1b88b92234a9fc913a09d1325793..bc73d5052611dba90c2d9c86854447be6a31fdac 100644 +index e9447ac47a858fbc9e16559c18e377517b8089ac..601eb789e19efe4a2fa697c0b5e7c28b245f0990 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1124,6 +1124,7 @@ public abstract class PlayerList { +@@ -1123,6 +1123,7 @@ public abstract class PlayerList { } public void setUsingWhiteList(boolean whitelistEnabled) { diff --git a/patches/unapplied/server/0315-Use-proper-max-length-when-serialising-BungeeCord-te.patch b/patches/server/0313-Use-proper-max-length-when-serialising-BungeeCord-te.patch similarity index 86% rename from patches/unapplied/server/0315-Use-proper-max-length-when-serialising-BungeeCord-te.patch rename to patches/server/0313-Use-proper-max-length-when-serialising-BungeeCord-te.patch index bb182f5de4..613efe3d5b 100644 --- a/patches/unapplied/server/0315-Use-proper-max-length-when-serialising-BungeeCord-te.patch +++ b/patches/server/0313-Use-proper-max-length-when-serialising-BungeeCord-te.patch @@ -6,19 +6,18 @@ Subject: [PATCH] Use proper max length when serialising BungeeCord text diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -index a64780b4b49d01322d8f755ff540a9622c89e983..26a229f7aa3f4425ed572e2d50730b4e978bf33e 100644 +index a64780b4b49d01322d8f755ff540a9622c89e983..4047e177e3f336aa089ad7645ba8bd9e0863178e 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -@@ -8,7 +8,7 @@ import net.minecraft.network.chat.Component; - import net.minecraft.network.protocol.Packet; +@@ -9,6 +9,7 @@ import net.minecraft.network.protocol.Packet; public class ClientboundChatPacket implements Packet { -- + + private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper private final Component message; public net.kyori.adventure.text.Component adventure$message; // Paper public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot -@@ -39,9 +39,9 @@ public class ClientboundChatPacket implements Packet { +@@ -39,9 +40,9 @@ public class ClientboundChatPacket implements Packet { // buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below // Paper start - don't nest if we don't need to so that we can preserve formatting if (this.components.length == 1) { diff --git a/patches/unapplied/server/0311-Handle-Oversized-Tile-Entities-in-chunks.patch b/patches/unapplied/server/0311-Handle-Oversized-Tile-Entities-in-chunks.patch deleted file mode 100644 index f02716ec0e..0000000000 --- a/patches/unapplied/server/0311-Handle-Oversized-Tile-Entities-in-chunks.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 6 May 2020 05:00:57 -0400 -Subject: [PATCH] Handle Oversized Tile Entities in chunks - -Splits out Extra Packets if too many TE's are encountered to prevent -creating too large of a packet to sed. - -Co authored by Spottedleaf - -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 96626835fee3c0fdb452acacdc9f737ad90c08de..c28879f32b004f36ff746ea2274f91ddd9501e71 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java -@@ -27,6 +27,15 @@ public class ClientboundLevelChunkPacket implements Packet blockEntitiesTags; -+ // Paper start -+ private final java.util.List extraPackets = new java.util.ArrayList<>(); -+ private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); -+ -+ @Override -+ public java.util.List getExtraPackets() { -+ return extraPackets; -+ } -+ // Paper end - - public ClientboundLevelChunkPacket(LevelChunk chunk) { - ChunkPos chunkPos = chunk.getPos(); -@@ -44,9 +53,19 @@ public class ClientboundLevelChunkPacket implements Packet entry2 : chunk.getBlockEntities().entrySet()) { - BlockEntity blockEntity = entry2.getValue(); -+ // Paper start - improve oversized chunk data packet handling -+ if (++totalTileEntities > TE_LIMIT) { -+ ClientboundBlockEntityDataPacket updatePacket = blockEntity.getUpdatePacket(); -+ if (updatePacket != null) { -+ this.extraPackets.add(updatePacket); -+ continue; -+ } -+ } -+ // Paper end - CompoundTag compoundTag = blockEntity.getUpdateTag(); - if (blockEntity instanceof net.minecraft.world.level.block.entity.SkullBlockEntity) { net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeTileEntityUUID(compoundTag); } // Paper - this.blockEntitiesTags.add(compoundTag); diff --git a/todo.txt b/todo.txt index c8b02579e5..add4ec4078 100644 --- a/todo.txt +++ b/todo.txt @@ -4,3 +4,4 @@ Check if PlayerNaturallySpawnedEvent is called correctly Make sure fluids aren't completly fucked, there may be more sync loads to nuke there as well Improve Server Thread Pool and Thread Priorities: mojang added a max thread count property Use Vanilla Minecart Speeds: is this needed? +Handle Oversized Tile Entities: make sure impl is correct