mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 10:57:43 +01:00
it compiles \o/
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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
|
||||
|
||||
https://modrinth.com/mod/know-my-name
|
||||
|
||||
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 4ea15e17a1393864422edb6d5c57962651abf69a..a78ed43288cfefaeb2592ed0a33fd11565dea2b2 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
|
||||
@@ -256,10 +256,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(HolderLookup.Provider registryLookup) {
|
||||
+ // 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