aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorShane Freeder <[email protected]>2024-10-21 00:02:00 +0100
committerGitHub <[email protected]>2024-10-21 01:02:00 +0200
commit260c3bbec0fdaf2e25b52cd1cd56533812efb32f (patch)
tree54146f672f100f35328c391e85951d6a0228b1f9
parentc13f9fd06a1d47ca163f5896528210f71dcc770e (diff)
downloadPaper-260c3bbec0fdaf2e25b52cd1cd56533812efb32f.tar.gz
Paper-260c3bbec0fdaf2e25b52cd1cd56533812efb32f.zip
Always send Banner patterns to the client (#11506)
The mojang client will not remove patterns from a Banner when none are sent inside of an update packet, given that this is not an expected flow for them, this is not all too surprising. So, we shall resort to always sending the patterns over the network for update packets. Fixes: #11487
-rw-r--r--patches/server/1068-Always-send-Banner-patterns-to-the-client.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/patches/server/1068-Always-send-Banner-patterns-to-the-client.patch b/patches/server/1068-Always-send-Banner-patterns-to-the-client.patch
new file mode 100644
index 0000000000..8672bed6d3
--- /dev/null
+++ b/patches/server/1068-Always-send-Banner-patterns-to-the-client.patch
@@ -0,0 +1,43 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Shane Freeder <[email protected]>
+Date: Sun, 20 Oct 2024 18:23:59 +0100
+Subject: [PATCH] Always send Banner patterns to the client
+
+The mojang client will not remove patterns from a Banner when none
+are sent inside of an update packet, given that this is not an expected
+flow for them, this is not all too surprising. So, we shall resort to always
+sending the patterns over the network for update packets.
+
+diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
+index 60c26076e7acf869fa0e20fdc14eeec341387d99..60a9f3c7f007d268f24a4fe9e87029fdbc8360f9 100644
+--- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
++++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
+@@ -63,7 +63,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
+ @Override
+ protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
+ super.saveAdditional(nbt, registryLookup);
+- if (!this.patterns.equals(BannerPatternLayers.EMPTY)) {
++ if (!this.patterns.equals(BannerPatternLayers.EMPTY) || serialisingForNetwork.get()) { // Paper - always send patterns to client
+ nbt.put("patterns", (Tag) BannerPatternLayers.CODEC.encodeStart(registryLookup.createSerializationContext(NbtOps.INSTANCE), this.patterns).getOrThrow());
+ }
+
+@@ -95,9 +95,18 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
+ return ClientboundBlockEntityDataPacket.create(this);
+ }
+
++ // Paper start - always send patterns to client
++ ThreadLocal<Boolean> serialisingForNetwork = ThreadLocal.withInitial(() -> Boolean.FALSE);
+ @Override
+ public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) {
+- return this.saveWithoutMetadata(registryLookup);
++ final Boolean wasSerialisingForNetwork = serialisingForNetwork.get();
++ try {
++ serialisingForNetwork.set(Boolean.TRUE);
++ return this.saveWithoutMetadata(registryLookup);
++ } finally {
++ serialisingForNetwork.set(wasSerialisingForNetwork);
++ }
++ // Paper end - always send patterns to client
+ }
+
+ public BannerPatternLayers getPatterns() {