mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
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
This commit is contained in:
parent
75f88df856
commit
9ad769150f
1 changed files with 43 additions and 0 deletions
|
@ -0,0 +1,43 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||
@@ -0,0 +0,0 @@ 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());
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ 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() {
|
Loading…
Reference in a new issue