From 31b2f4d0b473c9c19c03ca11576aa6b423ac8b90 Mon Sep 17 00:00:00 2001 From: Ben Kerllenevich Date: Wed, 13 Jul 2022 16:28:28 -0400 Subject: [PATCH] send the client custom name of block entities --- .../0286-Send-client-custom-name-of-BE.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 patches/server/0286-Send-client-custom-name-of-BE.patch diff --git a/patches/server/0286-Send-client-custom-name-of-BE.patch b/patches/server/0286-Send-client-custom-name-of-BE.patch new file mode 100644 index 000000000..711ca1d72 --- /dev/null +++ b/patches/server/0286-Send-client-custom-name-of-BE.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ben Kerllenevich +Date: Wed, 13 Jul 2022 16:27:43 -0400 +Subject: [PATCH] Send client custom name of BE + + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +index d3de829a4ab5f5a127fb026a8cb4ef4ed6b9c394..cb81086c8fe78321b157aa7d107f215c0d8fc410 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +@@ -206,10 +206,24 @@ public abstract class BlockEntity { + + @Nullable + public Packet getUpdatePacket() { ++ // Purpur start ++ if (this instanceof net.minecraft.world.Nameable nameable && nameable.hasCustomName()) { ++ CompoundTag nbt = this.saveWithoutMetadata(); ++ nbt.remove("Items"); ++ return net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket.create(this, $ -> nbt); ++ } ++ // Purpur end + return null; + } + + public CompoundTag getUpdateTag() { ++ // Purpur start ++ if (this instanceof net.minecraft.world.Nameable nameable && nameable.hasCustomName()) { ++ CompoundTag nbt = this.saveWithoutMetadata(); ++ nbt.remove("Items"); ++ return nbt; ++ } ++ // Purpur end + return new CompoundTag(); + } +