From ff68512997ab3f4c01516f1bd95f62681c026b95 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Thu, 8 Jun 2023 11:18:51 +0200 Subject: [PATCH] Update fluid chunk loading patch --- ...arseException-in-Entity-and-TE-names.patch | 0 .../server/Chunk-Save-Reattempt.patch | 0 ...-allowed-colored-signs-to-be-created.patch | 22 +++++++++++++++++++ ...-data-to-disk-if-it-serializes-witho.patch | 4 ++-- ...ent-chunk-loading-from-Fluid-Flowing.patch | 12 +++++----- ...-allowed-colored-signs-to-be-created.patch | 22 ------------------- 6 files changed, 30 insertions(+), 30 deletions(-) rename patches/{unapplied => }/server/Catch-JsonParseException-in-Entity-and-TE-names.patch (100%) rename patches/{unapplied => }/server/Chunk-Save-Reattempt.patch (100%) create mode 100644 patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch rename patches/{unapplied => }/server/Prevent-chunk-loading-from-Fluid-Flowing.patch (89%) delete mode 100644 patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch diff --git a/patches/unapplied/server/Catch-JsonParseException-in-Entity-and-TE-names.patch b/patches/server/Catch-JsonParseException-in-Entity-and-TE-names.patch similarity index 100% rename from patches/unapplied/server/Catch-JsonParseException-in-Entity-and-TE-names.patch rename to patches/server/Catch-JsonParseException-in-Entity-and-TE-names.patch diff --git a/patches/unapplied/server/Chunk-Save-Reattempt.patch b/patches/server/Chunk-Save-Reattempt.patch similarity index 100% rename from patches/unapplied/server/Chunk-Save-Reattempt.patch rename to patches/server/Chunk-Save-Reattempt.patch diff --git a/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch new file mode 100644 index 0000000000..c71073d261 --- /dev/null +++ b/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: 0x22 <0x22@futureclient.net> +Date: Thu, 26 Apr 2018 04:41:11 -0400 +Subject: [PATCH] Fix exploit that allowed colored signs to be created + + +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C + Style chatmodifier = text.getMessage(i, player.isTextFilteringEnabled()).getStyle(); + + if (player.isTextFilteringEnabled()) { +- text = text.setMessage(i, Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier)); ++ text = text.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only + } else { +- text = text.setMessage(i, Component.literal(filteredtext.raw()).setStyle(chatmodifier), Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier)); ++ text = text.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.raw())).setStyle(chatmodifier), Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only + } + + // CraftBukkit start diff --git a/patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch b/patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch index 4b981a7e51..c1082a5a44 100644 --- a/patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch +++ b/patches/server/Only-write-chunk-data-to-disk-if-it-serializes-witho.patch @@ -79,8 +79,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } + // Paper - move into try block to only write if successfully serialized } - - } finally { // Paper start + // Paper start + return; @@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { } diff --git a/patches/unapplied/server/Prevent-chunk-loading-from-Fluid-Flowing.patch b/patches/server/Prevent-chunk-loading-from-Fluid-Flowing.patch similarity index 89% rename from patches/unapplied/server/Prevent-chunk-loading-from-Fluid-Flowing.patch rename to patches/server/Prevent-chunk-loading-from-Fluid-Flowing.patch index 9fb4af40fa..61be1af566 100644 --- a/patches/unapplied/server/Prevent-chunk-loading-from-Fluid-Flowing.patch +++ b/patches/server/Prevent-chunk-loading-from-Fluid-Flowing.patch @@ -30,13 +30,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (fluid.getType().isSame(this) && this.canPassThroughWall(enumdirection, world, pos, state, blockposition1, iblockdata1)) { @@ -0,0 +0,0 @@ public abstract class FlowingFluid extends Fluid { - if (enumdirection1 != enumdirection) { - BlockPos blockposition2 = blockposition.relative(enumdirection1); - short short0 = FlowingFluid.getCacheKey(blockposition1, blockposition2); -- Pair pair = (Pair) short2objectmap.computeIfAbsent(short0, (short1) -> { + if (enumdirection1 != direction) { + BlockPos blockposition2 = pos.relative(enumdirection1); + short short0 = FlowingFluid.getCacheKey(fromPos, blockposition2); +- Pair pair = (Pair) stateCache.computeIfAbsent(short0, (short1) -> { - BlockState iblockdata1 = world.getBlockState(blockposition2); + // Paper start - avoid loading chunks -+ Pair pair = short2objectmap.get(short0); ++ Pair pair = stateCache.get(short0); + if (pair == null) { + BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition2); + if (iblockdatax == null) { @@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - return Pair.of(iblockdata1, iblockdata1.getFluidState()); - }); + pair = Pair.of(iblockdatax, iblockdatax.getFluidState()); -+ short2objectmap.put(short0, pair); ++ stateCache.put(short0, pair); + } + // Paper end BlockState iblockdata1 = (BlockState) pair.getFirst(); diff --git a/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch deleted file mode 100644 index e9dbf06018..0000000000 --- a/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: 0x22 <0x22@futureclient.net> -Date: Thu, 26 Apr 2018 04:41:11 -0400 -Subject: [PATCH] Fix exploit that allowed colored signs to be created - - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - FilteredText filteredtext = (FilteredText) signText.get(i); - - if (this.player.isTextFilteringEnabled()) { -- lines.add(net.kyori.adventure.text.Component.text(filteredtext.filteredOrEmpty())); // Paper - adventure -+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(filteredtext.filteredOrEmpty()))); // Paper - adventure - } else { -- lines.add(net.kyori.adventure.text.Component.text(filteredtext.raw())); // Paper - adventure -+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(filteredtext.raw()))); // Paper - adventure - } - } - SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);