Add missing removed patches

This commit is contained in:
Owen1212055 2023-12-06 15:25:11 -05:00 committed by Jason Penilla
parent f10b36d7fc
commit a2b6275487
No known key found for this signature in database
GPG key ID: 0E75A301420E48F8
6 changed files with 140 additions and 0 deletions

View file

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
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) {

View file

@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
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
}

View file

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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<Slime> 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;

View file

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
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<LastSeenMessages> 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

View file

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
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;

View file

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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);