java.lang.Object
io.github.thecsdev.tcdcommons.api.hooks.entity.EntityHooks

public final class EntityHooks extends Object
  • Method Details

    • getCustomData

      public static GenericProperties<net.minecraft.util.Identifier> getCustomData(net.minecraft.entity.Entity entity)
      Returns a HashMap containing the custom data for a given Entity. This feature is introduced through the tcdcommons mod, as Vanilla Minecraft does not support a "custom data" feature as of 1.19.x.
      Parameters:
      entity - The target Entity.
      Returns:
      The HashMap containing the custom data for the given Entity.
      Throws:
      NullPointerException - When the argument is null.
    • getCustomDataEntryG

      @Deprecated public static <T> T getCustomDataEntryG(net.minecraft.entity.Entity entity, net.minecraft.util.Identifier entryId)
      Deprecated.
      Retrieves a custom data entry for a given Entity and key.
      The method attempts to cast the value to the provided type, returning null if the cast fails.
      The "G" in the method name stands for "Generic".
      Type Parameters:
      T - The generic type of custom data entry to retrieve.
      Parameters:
      entity - The target Entity.
      entryId - The unique identifier for the custom data entry.
      Returns:
      The custom data entry associated with the given key, cast to the provided type, or null if the cast fails.
      Throws:
      NullPointerException - When the Identifier is null.
    • setCustomDataEntryG

      @Deprecated public static <T> T setCustomDataEntryG(net.minecraft.entity.Entity entity, net.minecraft.util.Identifier entryId, T entryValue)
      Deprecated.
      Sets a custom data entry for a given Entity and key, then returns the value that was set.
      This method allows for method chaining during assignment due to its return value.
      The "G" in the method name stands for "Generic".
      Type Parameters:
      T - The type of the value to be stored in the custom data entry.
      Parameters:
      entity - The target Entity.
      entryId - The unique identifier for the custom data entry.
      entryValue - The value to be stored in the custom data entry.
      Returns:
      The value that was set in the custom data entry.
      Throws:
      NullPointerException - When the Identifier is null.