From a2b6275487f8a9915d4654be76f1c734600afc86 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Wed, 6 Dec 2023 15:25:11 -0500 Subject: [PATCH] Add missing removed patches --- ...-don-t-need-to-when-cerealising-text.patch | 35 +++++++++++++++++++ .../0130-Do-not-let-armorstands-drown.patch | 23 ++++++++++++ ...rs-not-spawning-outside-slime-chunks.patch | 24 +++++++++++++ ...-debug-information-to-chat-packet-er.patch | 20 +++++++++++ ...random-in-ServerLoginPacketListenerI.patch | 18 ++++++++++ ...pack-loot-table-for-TEs-not-in-world.patch | 20 +++++++++++ 6 files changed, 140 insertions(+) create mode 100644 patches/removed/1.20.3/0061-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch create mode 100644 patches/removed/1.20.3/0130-Do-not-let-armorstands-drown.patch create mode 100644 patches/removed/1.20.3/0795-Fix-slime-spawners-not-spawning-outside-slime-chunks.patch create mode 100644 patches/removed/1.20.3/0827-Add-some-minimal-debug-information-to-chat-packet-er.patch create mode 100644 patches/removed/1.20.3/0841-Use-thread-safe-random-in-ServerLoginPacketListenerI.patch create mode 100644 patches/removed/1.20.3/1047-Don-t-unpack-loot-table-for-TEs-not-in-world.patch diff --git a/patches/removed/1.20.3/0061-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch b/patches/removed/1.20.3/0061-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch new file mode 100644 index 000000000..2150c56cd --- /dev/null +++ b/patches/removed/1.20.3/0061-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: kashike +Date: Tue, 8 Mar 2016 18:28:43 -0800 +Subject: [PATCH] Don't nest if we don't need to when cerealising text + components + + +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java +index 55e21c7b13826f60e3c656f76e1507e0242e0af3..1387e3597c43fd652f2fc82ca6fc2e83039604e2 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java +@@ -14,7 +14,7 @@ public record ClientboundSystemChatPacket(@javax.annotation.Nullable net.kyori.a + } + + public ClientboundSystemChatPacket(net.md_5.bungee.api.chat.BaseComponent[] content, boolean overlay) { +- this(null, net.md_5.bungee.chat.ComponentSerializer.toString(content), overlay); // Paper - Adventure ++ this(null, improveBungeeComponentSerialization(content), overlay); // Paper - Adventure + } + // Spigot end + // Paper start +@@ -25,6 +25,14 @@ public record ClientboundSystemChatPacket(@javax.annotation.Nullable net.kyori.a + public ClientboundSystemChatPacket(net.kyori.adventure.text.Component content, boolean overlay) { + this(content, null, overlay); + } ++ ++ private static String improveBungeeComponentSerialization(net.md_5.bungee.api.chat.BaseComponent[] content) { ++ if (content.length == 1) { ++ return net.md_5.bungee.chat.ComponentSerializer.toString(content[0]); ++ } else { ++ return net.md_5.bungee.chat.ComponentSerializer.toString(content); ++ } ++ } + // Paper end + + public ClientboundSystemChatPacket(FriendlyByteBuf buf) { diff --git a/patches/removed/1.20.3/0130-Do-not-let-armorstands-drown.patch b/patches/removed/1.20.3/0130-Do-not-let-armorstands-drown.patch new file mode 100644 index 000000000..21cc9d4ed --- /dev/null +++ b/patches/removed/1.20.3/0130-Do-not-let-armorstands-drown.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Sat, 18 Feb 2017 19:29:58 -0600 +Subject: [PATCH] Do not let armorstands drown + + +diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +index d79fbc3e1cab0d4ec38ae25325e55eb23a1b5a19..37c19685049ef6b267a74a4323dc4ec33159c3d2 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +@@ -959,5 +959,12 @@ public class ArmorStand extends LivingEntity { + super.move(type, movement); + } + } ++ ++ // Paper start ++ @Override ++ public boolean canBreatheUnderwater() { // Skips a bit of damage handling code, probably a micro-optimization ++ return true; ++ } ++ // Paper end + // Paper end + } diff --git a/patches/removed/1.20.3/0795-Fix-slime-spawners-not-spawning-outside-slime-chunks.patch b/patches/removed/1.20.3/0795-Fix-slime-spawners-not-spawning-outside-slime-chunks.patch new file mode 100644 index 000000000..7f78aa076 --- /dev/null +++ b/patches/removed/1.20.3/0795-Fix-slime-spawners-not-spawning-outside-slime-chunks.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 15 Apr 2022 17:09:28 -0700 +Subject: [PATCH] Fix slime spawners not spawning outside slime chunks + +Fixes MC-50647 by just checking if the spawn type is a SPAWNER +and then bypassing the spawn check logic if on slimes if it is. + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java +index 48a420b7455f872c351e04be3918808e51b192ed..b14979ab7bed34a37fceff5589ecb789bab31318 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java +@@ -329,6 +329,11 @@ public class Slime extends Mob implements Enemy { + + public static boolean checkSlimeSpawnRules(EntityType type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) { + if (world.getDifficulty() != Difficulty.PEACEFUL) { ++ // Paper start - fix slime spawners; Fixes MC-50647 ++ if (spawnReason == MobSpawnType.SPAWNER) { ++ return random.nextInt(10) == 0; ++ } ++ // Paper end + // Paper start - Replace rules for Height in Swamp Biome + final double maxHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.surfaceBiome.maximum; + final double minHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.surfaceBiome.minimum; diff --git a/patches/removed/1.20.3/0827-Add-some-minimal-debug-information-to-chat-packet-er.patch b/patches/removed/1.20.3/0827-Add-some-minimal-debug-information-to-chat-packet-er.patch new file mode 100644 index 000000000..7ae9ebbdd --- /dev/null +++ b/patches/removed/1.20.3/0827-Add-some-minimal-debug-information-to-chat-packet-er.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Wed, 6 Jul 2022 05:52:22 +0100 +Subject: [PATCH] Add some minimal debug information to chat packet errors + +TODO: potentially add some kick leeway + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index ac87735ff07ee0833727cdf8b62f443ce16a3216..c518f78af7612f59af7f02fcf2ba5ef274f9694d 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2149,7 +2149,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + + private Optional tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { + if (!this.updateChatOrder(timestamp)) { +- ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message); ++ ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper + this.server.scheduleOnMain(() -> { // Paper - push to main + this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes + }); // Paper - push to main diff --git a/patches/removed/1.20.3/0841-Use-thread-safe-random-in-ServerLoginPacketListenerI.patch b/patches/removed/1.20.3/0841-Use-thread-safe-random-in-ServerLoginPacketListenerI.patch new file mode 100644 index 000000000..c067fd1ea --- /dev/null +++ b/patches/removed/1.20.3/0841-Use-thread-safe-random-in-ServerLoginPacketListenerI.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Thu, 11 Aug 2022 14:37:33 +0100 +Subject: [PATCH] Use thread safe random in ServerLoginPacketListenerImpl + + +diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +index aac84898d2563bfb45c7d0884d65be2346d2911e..1c4f272219e68373eaae93fc5ea9af7d8f3fd6f9 100644 +--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +@@ -50,6 +50,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + static final Logger LOGGER = LogUtils.getLogger(); + private static final int MAX_TICKS_BEFORE_LOGIN = 600; + private static final Component DISCONNECT_UNEXPECTED_QUERY = Component.translatable("multiplayer.disconnect.unexpected_query_response"); ++ private static final RandomSource RANDOM = new org.bukkit.craftbukkit.util.RandomSourceWrapper(new java.util.Random()); // Paper - This is called across threads, make safe + private final byte[] challenge; + final MinecraftServer server; + public final Connection connection; diff --git a/patches/removed/1.20.3/1047-Don-t-unpack-loot-table-for-TEs-not-in-world.patch b/patches/removed/1.20.3/1047-Don-t-unpack-loot-table-for-TEs-not-in-world.patch new file mode 100644 index 000000000..2c7310b07 --- /dev/null +++ b/patches/removed/1.20.3/1047-Don-t-unpack-loot-table-for-TEs-not-in-world.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 7 Nov 2023 18:59:04 -0800 +Subject: [PATCH] Don't unpack loot table for TEs not in world + +Fixed by 23w44a/1.20.3. Remove it then + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +index 081691f9710ff1115e4308f79ed49fbc38941193..3e638f12956e57548f76c7e2403ba370f7baa249 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +@@ -70,7 +70,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc + } + + public void unpackLootTable(@Nullable Player player) { +- if (this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper ++ if (this.level != null && this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper - don't unpack loot table if not in world + LootTable lootTable = this.level.getServer().getLootData().getLootTable(this.lootTable); + if (player instanceof ServerPlayer) { + CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.lootTable);