mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
send the client custom name of block entities
This commit is contained in:
35
patches/server/0286-Send-client-custom-name-of-BE.patch
Normal file
35
patches/server/0286-Send-client-custom-name-of-BE.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
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<ClientGamePacketListener> 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user