Package com.faux.customentitydata.api
Class CustomDataHelper
java.lang.Object
com.faux.customentitydata.api.CustomDataHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.nbt.CompoundTaggetCustomData(net.minecraft.world.entity.Entity entity) Gets the custom data on the given Entity.static net.minecraft.nbt.CompoundTaggetPersistentData(net.minecraft.server.level.ServerPlayer player) Gets the persistent data of the given ServerPlayer.static voidsetCustomData(net.minecraft.world.entity.Entity entity, net.minecraft.nbt.CompoundTag data) Sets the custom data on the given Entity.static voidsetPersistentData(net.minecraft.server.level.ServerPlayer player, net.minecraft.nbt.CompoundTag data) Sets the persistent data on the given ServerPlayer.
-
Constructor Details
-
CustomDataHelper
public CustomDataHelper()
-
-
Method Details
-
getCustomData
public static net.minecraft.nbt.CompoundTag getCustomData(net.minecraft.world.entity.Entity entity) Gets the custom data on the given Entity.- Parameters:
entity- The entity to get the custom data of.- Returns:
- The custom data stored on the given entity, or null if the entity is not a ICustomDataHolder.
-
setCustomData
public static void setCustomData(net.minecraft.world.entity.Entity entity, net.minecraft.nbt.CompoundTag data) Sets the custom data on the given Entity.- Parameters:
entity- The entity to set the custom data of.data- The custom data to set.
-
getPersistentData
public static net.minecraft.nbt.CompoundTag getPersistentData(net.minecraft.server.level.ServerPlayer player) Gets the persistent data of the given ServerPlayer.- Parameters:
player- The player to get the persistent data of.- Returns:
- The persistent data stored on the given player, or null if the player is not a IPersistentDataHolder.
-
setPersistentData
public static void setPersistentData(net.minecraft.server.level.ServerPlayer player, net.minecraft.nbt.CompoundTag data) Sets the persistent data on the given ServerPlayer.- Parameters:
player- The player to set the persistent data of.data- The custom data to set.
-