From 488ad68f0f71c9dc0e6069933f450f13b9e2dc4a Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 23 Nov 2021 17:53:24 -0800 Subject: [PATCH] and here's some more patches --- ...-ItemStack-Recipe-API-helper-methods.patch | 0 .../api/Add-WhitelistToggleEvent.patch | 0 .../api/Annotation-Test-changes.patch | 0 ...oggleEvent-when-whitelist-is-toggled.patch | 0 ...ConvertSigns-boolean-every-sign-save.patch | 0 ...om-Shapeless-Custom-Crafting-Recipes.patch | 0 ...le-Oversized-Tile-Entities-in-chunks.patch | 64 +++++++++++++++++++ .../Limit-Client-Sign-length-more.patch | 0 ...-Manager-and-add-advanced-packet-sup.patch | 2 +- ...st-tick-at-start-of-drowning-process.patch | 0 ...ength-when-serialising-BungeeCord-te.patch | 5 +- ...le-Oversized-Tile-Entities-in-chunks.patch | 50 --------------- ...0-Fix-Whitelist-On-Off-inconsistency.patch | 36 ----------- todo.txt | 1 + 14 files changed, 68 insertions(+), 90 deletions(-) rename patches/{unapplied => }/api/Add-ItemStack-Recipe-API-helper-methods.patch (100%) rename patches/{unapplied => }/api/Add-WhitelistToggleEvent.patch (100%) rename patches/{unapplied => }/api/Annotation-Test-changes.patch (100%) rename patches/{unapplied => }/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch (100%) rename patches/{unapplied => }/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch (100%) rename patches/{unapplied => }/server/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch (100%) create mode 100644 patches/server/Handle-Oversized-Tile-Entities-in-chunks.patch rename patches/{unapplied => }/server/Limit-Client-Sign-length-more.patch (100%) rename patches/{unapplied => }/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch (99%) rename patches/{unapplied => }/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch (100%) rename patches/{unapplied => }/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch (94%) delete mode 100644 patches/unapplied/server/Handle-Oversized-Tile-Entities-in-chunks.patch delete mode 100644 patches/unapplied/server/MC-145260-Fix-Whitelist-On-Off-inconsistency.patch diff --git a/patches/unapplied/api/Add-ItemStack-Recipe-API-helper-methods.patch b/patches/api/Add-ItemStack-Recipe-API-helper-methods.patch similarity index 100% rename from patches/unapplied/api/Add-ItemStack-Recipe-API-helper-methods.patch rename to patches/api/Add-ItemStack-Recipe-API-helper-methods.patch diff --git a/patches/unapplied/api/Add-WhitelistToggleEvent.patch b/patches/api/Add-WhitelistToggleEvent.patch similarity index 100% rename from patches/unapplied/api/Add-WhitelistToggleEvent.patch rename to patches/api/Add-WhitelistToggleEvent.patch diff --git a/patches/unapplied/api/Annotation-Test-changes.patch b/patches/api/Annotation-Test-changes.patch similarity index 100% rename from patches/unapplied/api/Annotation-Test-changes.patch rename to patches/api/Annotation-Test-changes.patch diff --git a/patches/unapplied/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/patches/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch similarity index 100% rename from patches/unapplied/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch rename to patches/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch diff --git a/patches/unapplied/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/patches/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch similarity index 100% rename from patches/unapplied/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch rename to patches/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch diff --git a/patches/unapplied/server/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch b/patches/server/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch similarity index 100% rename from patches/unapplied/server/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch rename to patches/server/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch diff --git a/patches/server/Handle-Oversized-Tile-Entities-in-chunks.patch b/patches/server/Handle-Oversized-Tile-Entities-in-chunks.patch new file mode 100644 index 0000000000..9c0b1578d9 --- /dev/null +++ b/patches/server/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +@@ -0,0 +0,0 @@ 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(); +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +@@ -0,0 +0,0 @@ public class ClientboundLevelChunkWithLightPacket implements Packet getExtraPackets() { ++ return this.chunkData.getExtraPackets(); ++ } ++ // Paper end + } diff --git a/patches/unapplied/server/Limit-Client-Sign-length-more.patch b/patches/server/Limit-Client-Sign-length-more.patch similarity index 100% rename from patches/unapplied/server/Limit-Client-Sign-length-more.patch rename to patches/server/Limit-Client-Sign-length-more.patch diff --git a/patches/unapplied/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch similarity index 99% rename from patches/unapplied/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch rename to patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 81b4cad7b2..9e69f9ba3c 100644 --- a/patches/unapplied/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void sendPacket(Packet packet, @Nullable GenericFutureListener> callback) { @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { - this.setProtocol(enumprotocol); + this.setProtocol(packetState); } + // Paper start diff --git a/patches/unapplied/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch b/patches/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch similarity index 100% rename from patches/unapplied/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch rename to patches/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch diff --git a/patches/unapplied/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch b/patches/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch similarity index 94% rename from patches/unapplied/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch rename to patches/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch index dc7d33890a..b75aae5187 100644 --- a/patches/unapplied/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch +++ b/patches/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch @@ -9,11 +9,10 @@ diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPa index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -@@ -0,0 +0,0 @@ import net.minecraft.network.chat.Component; - import net.minecraft.network.protocol.Packet; +@@ -0,0 +0,0 @@ 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 diff --git a/patches/unapplied/server/Handle-Oversized-Tile-Entities-in-chunks.patch b/patches/unapplied/server/Handle-Oversized-Tile-Entities-in-chunks.patch deleted file mode 100644 index 080cde99cd..0000000000 --- a/patches/unapplied/server/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java -@@ -0,0 +0,0 @@ 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(); -@@ -0,0 +0,0 @@ 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/patches/unapplied/server/MC-145260-Fix-Whitelist-On-Off-inconsistency.patch b/patches/unapplied/server/MC-145260-Fix-Whitelist-On-Off-inconsistency.patch deleted file mode 100644 index fb0b1b1815..0000000000 --- a/patches/unapplied/server/MC-145260-Fix-Whitelist-On-Off-inconsistency.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 2 Mar 2019 16:12:35 -0500 -Subject: [PATCH] MC-145260: Fix Whitelist On/Off inconsistency - -mojang stored whitelist state in 2 places (Whitelist Object, PlayerList) - -some things checked PlayerList, some checked object. This moves -everything to the Whitelist object. - -https://github.com/PaperMC/Paper/issues/1880 - -diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/players/PlayerList.java -+++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket; - import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket; - import net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket; - import net.minecraft.resources.ResourceKey; -+import net.minecraft.server.MCUtil; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.PlayerAdvancements; - import net.minecraft.server.ServerScoreboard; -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } - public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) { - boolean isOp = this.ops.contains(gameprofile); -- boolean isWhitelisted = !this.doWhiteList || isOp || this.whitelist.contains(gameprofile); -+ boolean isWhitelisted = !this.isUsingWhitelist() || isOp || this.whitelist.contains(gameprofile); // Paper - use isUsingWhitelist() - final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event; -- event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(net.minecraft.server.MCUtil.toBukkit(gameprofile), this.doWhiteList, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage); -+ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(net.minecraft.server.MCUtil.toBukkit(gameprofile), this.isUsingWhitelist(), isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage); // Paper - use isUsingWhitelist() - event.callEvent(); - if (!event.isWhitelisted()) { - if (loginEvent != null) { 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