Class CustomDataHelper

java.lang.Object
com.faux.customentitydata.api.CustomDataHelper

public class CustomDataHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.nbt.CompoundTag
    getCustomData(net.minecraft.world.entity.Entity entity)
    Gets the custom data on the given Entity.
    static net.minecraft.nbt.CompoundTag
    getPersistentData(net.minecraft.server.level.ServerPlayer player)
    Gets the persistent data of the given ServerPlayer.
    static void
    setCustomData(net.minecraft.world.entity.Entity entity, net.minecraft.nbt.CompoundTag data)
    Sets the custom data on the given Entity.
    static void
    setPersistentData(net.minecraft.server.level.ServerPlayer player, net.minecraft.nbt.CompoundTag data)
    Sets the persistent data on the given ServerPlayer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.