diff options
author | Shane Freeder <[email protected]> | 2024-10-20 18:29:13 +0100 |
---|---|---|
committer | Bjarne Koll <[email protected]> | 2024-10-21 00:18:25 +0200 |
commit | 80055697aae814783c77b60cf1741fb68e624f33 (patch) | |
tree | 303c62101c90c4c5025d7e7c776ae17cba60740a | |
parent | 3b9db2b19422c8cd6f4c01cc0bdf40974712b744 (diff) | |
download | Paper-80055697aae814783c77b60cf1741fb68e624f33.tar.gz Paper-80055697aae814783c77b60cf1741fb68e624f33.zip |
Always send Banner patterns to the client (Fixes #11487)
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.
-rw-r--r-- | patches/server/1068-Always-send-Banner-patterns-to-the-client.patch | 42 |
1 files changed, 42 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..a94cb24ca6 --- /dev/null +++ b/patches/server/1068-Always-send-Banner-patterns-to-the-client.patch @@ -0,0 +1,42 @@ +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..91352f49fba00481027824a87d30b5f5974c09d4 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) { // Paper - always send patterns to client + nbt.put("patterns", (Tag) BannerPatternLayers.CODEC.encodeStart(registryLookup.createSerializationContext(NbtOps.INSTANCE), this.patterns).getOrThrow()); + } + +@@ -95,9 +95,17 @@ public class BannerBlockEntity extends BlockEntity implements Nameable { + return ClientboundBlockEntityDataPacket.create(this); + } + ++ // Paper start ++ boolean serialisingForNetwork = false; // paper - always send patterns to client + @Override + public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) { +- return this.saveWithoutMetadata(registryLookup); ++ boolean wasSerialisingForNetwork = serialisingForNetwork; ++ try { ++ serialisingForNetwork = true; ++ return this.saveWithoutMetadata(registryLookup); ++ } finally { ++ serialisingForNetwork = wasSerialisingForNetwork; ++ } + } + + public BannerPatternLayers getPatterns() { |