Interface FabricItem.Properties

Enclosing interface:
FabricItem

public static interface FabricItem.Properties
Fabric-provided extensions for Item.Properties. This interface is automatically implemented on all item properties via Mixin and interface injection.
  • Method Summary

    Modifier and Type
    Method
    Description
    default net.minecraft.world.item.Item.Properties
    Sets the custom damage handler of the item.
    default net.minecraft.world.item.Item.Properties
    equipmentSlot(EquipmentSlotProvider equipmentSlotProvider)
    Sets the equipment slot provider of the item.
    default @Nullable net.minecraft.resources.ResourceKey<net.minecraft.world.item.Item>
    Return the id of item that was defined by Item.Properties.setId(ResourceKey).
    default net.minecraft.world.item.Item.Properties
    modelId(net.minecraft.resources.Identifier modelId)
    Sets the model of the item to static Identifier.
    default <T> net.minecraft.world.item.Item.Properties
    modifyComponent(net.minecraft.core.component.DataComponentType<T> type, org.apache.commons.lang3.function.TriFunction<@Nullable T, net.minecraft.core.HolderLookup.Provider, net.minecraft.resources.ResourceKey<net.minecraft.world.item.Item>, @Nullable T> modifier)
    Modifies the value of a component.
    default net.minecraft.world.item.Item.Properties
    modifyComponents(net.minecraft.core.component.DataComponentInitializers.Initializer<net.minecraft.world.item.Item> modifier)
    Modifies the value of all components initialized by initializers up to this point.
  • Method Details

    • modifyComponent

      default <T> net.minecraft.world.item.Item.Properties modifyComponent(net.minecraft.core.component.DataComponentType<T> type, org.apache.commons.lang3.function.TriFunction<@Nullable T, net.minecraft.core.HolderLookup.Provider, net.minecraft.resources.ResourceKey<net.minecraft.world.item.Item>, @Nullable T> modifier)
      Modifies the value of a component. The original value may be null if no initializer for this component type was registered, or the initializer for this component type was registered after the modifier. Returning null will remove the value for this component type.
      Type Parameters:
      T - the type of the component
      Parameters:
      type - the DataComponentType of the component to modify
      modifier - the modifier to run on the component
      Returns:
      this builder
    • modifyComponents

      default net.minecraft.world.item.Item.Properties modifyComponents(net.minecraft.core.component.DataComponentInitializers.Initializer<net.minecraft.world.item.Item> modifier)
      Modifies the value of all components initialized by initializers up to this point.
      Parameters:
      modifier - the modifier to apply
      Returns:
      this builder
    • equipmentSlot

      default net.minecraft.world.item.Item.Properties equipmentSlot(EquipmentSlotProvider equipmentSlotProvider)
      Sets the equipment slot provider of the item.
      Parameters:
      equipmentSlotProvider - the equipment slot provider
      Returns:
      this builder
    • customDamage

      default net.minecraft.world.item.Item.Properties customDamage(CustomDamageHandler handler)
      Sets the custom damage handler of the item. Note that this is only called on an ItemStack if ItemStack.isDamageableItem() returns true.
      See Also:
    • modelId

      default net.minecraft.world.item.Item.Properties modelId(net.minecraft.resources.Identifier modelId)
      Sets the model of the item to static Identifier.
      Parameters:
      modelId - the model id item should use
      Returns:
      this builder
    • itemId

      default @Nullable net.minecraft.resources.ResourceKey<net.minecraft.world.item.Item> itemId()
      Return the id of item that was defined by Item.Properties.setId(ResourceKey).
      Returns:
      currently stored item id or null, if not set