mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
avoid using CustomData#getUnsafe()
This commit is contained in:
@@ -141,16 +141,18 @@ index 1a2a05160ba51d9c75f1ae6ae61d944d81428722..3beb26ad2ef0fded49a8da8c5dec64f9
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/entity/PurpurStoredBee.java b/src/main/java/org/purpurmc/purpur/entity/PurpurStoredBee.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..25d718489a1a589d9754b8a02340cec819eec6d8
|
||||
index 0000000000000000000000000000000000000000..7608bf0981fa0d37031e51e57e4086cb5ec4c88b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/entity/PurpurStoredBee.java
|
||||
@@ -0,0 +1,103 @@
|
||||
@@ -0,0 +1,106 @@
|
||||
+package org.purpurmc.purpur.entity;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.nbt.Tag;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.world.item.component.CustomData;
|
||||
+import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
|
||||
+import org.bukkit.block.EntityBlockStorage;
|
||||
+import org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer;
|
||||
@@ -176,12 +178,13 @@ index 0000000000000000000000000000000000000000..25d718489a1a589d9754b8a02340cec8
|
||||
+ this.handle = data;
|
||||
+ this.blockStorage = blockStorage;
|
||||
+
|
||||
+ this.customName = handle.occupant.entityData().contains("CustomName")
|
||||
+ ? PaperAdventure.asAdventure(net.minecraft.network.chat.Component.Serializer.fromJson(handle.occupant.entityData().getUnsafe().getString("CustomName"), MinecraftServer.getDefaultRegistryAccess()))
|
||||
+ CompoundTag customData = handle.occupant.entityData().copyTag();
|
||||
+ this.customName = customData.contains("CustomName")
|
||||
+ ? PaperAdventure.asAdventure(net.minecraft.network.chat.Component.Serializer.fromJson(customData.getString("CustomName"), MinecraftServer.getDefaultRegistryAccess()))
|
||||
+ : null;
|
||||
+
|
||||
+ if(handle.occupant.entityData().getUnsafe().contains("BukkitValues", Tag.TAG_COMPOUND)) {
|
||||
+ this.persistentDataContainer.putAll(handle.occupant.entityData().getUnsafe().getCompound("BukkitValues"));
|
||||
+ if(customData.contains("BukkitValues", Tag.TAG_COMPOUND)) {
|
||||
+ this.persistentDataContainer.putAll(customData.getCompound("BukkitValues"));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user