Interface Customized

All Known Implementing Classes:
PlaceholderItem, PlaceholderMimicItem

public interface Customized
Provides common functionality for items that are expected to contain the "CustomModelData" NBT key.
Since:
1.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The NBT key corresponding to an item's custom model identifier.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Optional<Integer>
    getCustomModelData(net.minecraft.item.ItemStack stack)
    Returns the given stack's assigned custom model data.
    default void
    setCustomModelData(net.minecraft.item.ItemStack stack, int data)
    Sets the given stack's custom model data.
  • Field Details

    • CUSTOM_MODEL_DATA_KEY

      static final String CUSTOM_MODEL_DATA_KEY
      The NBT key corresponding to an item's custom model identifier.

      This is directly taken from ModelPredicateProviderRegistry.CUSTOM_MODEL_DATA_KEY, where it is defined as a private static constant.

      Since:
      1.4.0
      See Also:
  • Method Details

    • getCustomModelData

      default Optional<Integer> getCustomModelData(net.minecraft.item.ItemStack stack)
      Returns the given stack's assigned custom model data.

      If the key is present but is not assigned to a valid number, Optional.of(0) is returned.

      Parameters:
      stack - The item stack.
      Returns:
      The custom model data.
      Since:
      1.0.0
    • setCustomModelData

      default void setCustomModelData(net.minecraft.item.ItemStack stack, int data)
      Sets the given stack's custom model data.
      Parameters:
      stack - The item stack.
      data - The custom model data.
      Since:
      1.0.0