3
3
import io .papermc .paper .adventure .PaperAdventure ;
4
4
import net .kyori .adventure .text .Component ;
5
5
import net .minecraft .nbt .CompoundTag ;
6
- import net .minecraft .nbt .NbtOps ;
7
- import net .minecraft .network .chat .ComponentSerialization ;
8
- import net .minecraft .server .MinecraftServer ;
9
6
import net .minecraft .world .level .block .entity .BeehiveBlockEntity ;
7
+ import net .minecraft .world .level .block .entity .BlockEntity ;
10
8
import org .bukkit .block .EntityBlockStorage ;
9
+ import org .bukkit .craftbukkit .CraftWorld ;
11
10
import org .bukkit .craftbukkit .persistence .CraftPersistentDataContainer ;
12
11
import org .bukkit .craftbukkit .persistence .CraftPersistentDataTypeRegistry ;
13
12
import org .bukkit .entity .Bee ;
@@ -32,7 +31,7 @@ public PurpurStoredBee(BeehiveBlockEntity.BeeData data, EntityBlockStorage<Bee>
32
31
this .blockStorage = blockStorage ;
33
32
34
33
CompoundTag customData = handle .occupant .entityData ().copyTag ();
35
- net .minecraft .network .chat .Component customNameMinecraft = customData .read ("CustomName" , ComponentSerialization . CODEC , MinecraftServer . getDefaultRegistryAccess (). createSerializationContext ( NbtOps . INSTANCE )). orElse ( null );
34
+ net .minecraft .network .chat .Component customNameMinecraft = BlockEntity . parseCustomNameSafe ( customData .get ("CustomName" ), (( CraftWorld ) blockStorage . getWorld ()). getHandle (). registryAccess () );
36
35
this .customName = customNameMinecraft == null ? null : PaperAdventure .asAdventure (customNameMinecraft );
37
36
38
37
if (customData .get ("BukkitValues" ) instanceof CompoundTag compoundTag ) {
@@ -99,7 +98,7 @@ public void update() {
99
98
if (customName == null ) {
100
99
handle .occupant .entityData ().copyTag ().remove ("CustomName" );
101
100
} else {
102
- handle .occupant .entityData ().copyTag ().putString ("CustomName" , net .minecraft .network .chat .Component .Serializer .toJson (PaperAdventure .asVanilla (customName ), MinecraftServer . getDefaultRegistryAccess ()));
101
+ handle .occupant .entityData ().copyTag ().putString ("CustomName" , net .minecraft .network .chat .Component .Serializer .toJson (PaperAdventure .asVanilla (customName ), (( CraftWorld ) blockStorage . getWorld ()). getHandle (). registryAccess ()));
103
102
}
104
103
}
105
104
}
0 commit comments