Class Item.Settings

java.lang.Object
net.minecraft.item.Item.Settings
Enclosing class:
Item

public static class Item.Settings extends Object
Item settings configure behaviors common to all items, such as the stack's max count. An instance of this must be passed to the constructor of Item (or most of its subclasses).
Mappings:
Namespace Name
named net/minecraft/item/Item$Settings
intermediary net/minecraft/class_1792$class_1793
official cum$a
  • Field Details

    • COMPONENT_MAP_INTERNER

      private static final Interner<ComponentMap> COMPONENT_MAP_INTERNER
      Mappings:
      Namespace Name Mixin selector
      named COMPONENT_MAP_INTERNER Lnet/minecraft/item/Item$Settings;COMPONENT_MAP_INTERNER:Lcom/google/common/collect/Interner;
      intermediary field_49264 Lnet/minecraft/class_1792$class_1793;field_49264:Lcom/google/common/collect/Interner;
      official a Lcum$a;a:Lcom/google/common/collect/Interner;
    • components

      @Nullable private ComponentMap.Builder components
      Mappings:
      Namespace Name Mixin selector
      named components Lnet/minecraft/item/Item$Settings;components:Lnet/minecraft/component/ComponentMap$Builder;
      intermediary field_49265 Lnet/minecraft/class_1792$class_1793;field_49265:Lnet/minecraft/class_9323$class_9324;
      official b Lcum$a;b:Lki$a;
    • recipeRemainder

      @Nullable @Nullable Item recipeRemainder
      Mappings:
      Namespace Name Mixin selector
      named recipeRemainder Lnet/minecraft/item/Item$Settings;recipeRemainder:Lnet/minecraft/item/Item;
      intermediary field_8018 Lnet/minecraft/class_1792$class_1793;field_8018:Lnet/minecraft/class_1792;
      official c Lcum$a;c:Lcum;
    • requiredFeatures

      FeatureSet requiredFeatures
      Mappings:
      Namespace Name Mixin selector
      named requiredFeatures Lnet/minecraft/item/Item$Settings;requiredFeatures:Lnet/minecraft/resource/featuretoggle/FeatureSet;
      intermediary field_40210 Lnet/minecraft/class_1792$class_1793;field_40210:Lnet/minecraft/class_7699;
      official d Lcum$a;d:Lcpn;
  • Constructor Details

    • Settings

      public Settings()
  • Method Details

    • food

      public Item.Settings food(FoodComponent foodComponent)
      When set, any item configured with this Settings instance will be edible based on the provided FoodComponent.
      Parameters:
      foodComponent - configured food properties for any item using this Settings instance
      Returns:
      this instance
      Mappings:
      Namespace Name Mixin selector
      named food Lnet/minecraft/item/Item$Settings;food(Lnet/minecraft/component/type/FoodComponent;)Lnet/minecraft/item/Item$Settings;
      intermediary method_19265 Lnet/minecraft/class_1792$class_1793;method_19265(Lnet/minecraft/class_4174;)Lnet/minecraft/class_1792$class_1793;
      official a Lcum$a;a(Lcpt;)Lcum$a;
    • maxCount

      public Item.Settings maxCount(int maxCount)
      Sets the maximum stack count of any ItemStack with an Item using this Settings instance.

      Note that a count over 64 leads to unreliable behavior in GUIs. Damageable items can not have a maximum stack count (they default to 1). An Item.Settings' max count defaults to 64.

      Parameters:
      maxCount - maximum stack count of any ItemStack with an item using this Settings instance
      Returns:
      this instance
      Throws:
      RuntimeException - if this Settings instance also has a max damage value set
      Mappings:
      Namespace Name Mixin selector
      named maxCount Lnet/minecraft/item/Item$Settings;maxCount(I)Lnet/minecraft/item/Item$Settings;
      intermediary method_7889 Lnet/minecraft/class_1792$class_1793;method_7889(I)Lnet/minecraft/class_1792$class_1793;
      official a Lcum$a;a(I)Lcum$a;
    • maxDamage

      public Item.Settings maxDamage(int maxDamage)
      Sets the maximum durability of any item configured with this Settings instance.

      Note that max stack count is set to 1 when this method is called.

      Parameters:
      maxDamage - maximum durability of an ItemStack using an item with this Item.Settings instance
      Returns:
      this instance
      Mappings:
      Namespace Name Mixin selector
      named maxDamage Lnet/minecraft/item/Item$Settings;maxDamage(I)Lnet/minecraft/item/Item$Settings;
      intermediary method_7895 Lnet/minecraft/class_1792$class_1793;method_7895(I)Lnet/minecraft/class_1792$class_1793;
      official b Lcum$a;b(I)Lcum$a;
    • recipeRemainder

      public Item.Settings recipeRemainder(Item recipeRemainder)
      Sets the recipe remainder for any item configured with this Settings instance. When an item with a recipe remainder is used in a crafting recipe, the remainder is left in the table or returned to the player.
      Returns:
      this instance
      Mappings:
      Namespace Name Mixin selector
      named recipeRemainder Lnet/minecraft/item/Item$Settings;recipeRemainder(Lnet/minecraft/item/Item;)Lnet/minecraft/item/Item$Settings;
      intermediary method_7896 Lnet/minecraft/class_1792$class_1793;method_7896(Lnet/minecraft/class_1792;)Lnet/minecraft/class_1792$class_1793;
      official a Lcum$a;a(Lcum;)Lcum$a;
    • rarity

      public Item.Settings rarity(Rarity rarity)
      Sets the Rarity of any item configured with this Settings instance, which changes the color of its name.

      An item's rarity defaults to Rarity.COMMON.

      Parameters:
      rarity - rarity to apply to items using this Settings instance
      Returns:
      this instance
      Mappings:
      Namespace Name Mixin selector
      named rarity Lnet/minecraft/item/Item$Settings;rarity(Lnet/minecraft/util/Rarity;)Lnet/minecraft/item/Item$Settings;
      intermediary method_7894 Lnet/minecraft/class_1792$class_1793;method_7894(Lnet/minecraft/class_1814;)Lnet/minecraft/class_1792$class_1793;
      official a Lcum$a;a(Lcvl;)Lcum$a;
    • fireproof

      public Item.Settings fireproof()
      If called, any item with this Settings instance is immune to fire and lava damage.
      Returns:
      this instance
      Mappings:
      Namespace Name Mixin selector
      named fireproof Lnet/minecraft/item/Item$Settings;fireproof()Lnet/minecraft/item/Item$Settings;
      intermediary method_24359 Lnet/minecraft/class_1792$class_1793;method_24359()Lnet/minecraft/class_1792$class_1793;
      official a Lcum$a;a()Lcum$a;
    • requires

      public Item.Settings requires(FeatureFlag[] features)
      Mappings:
      Namespace Name Mixin selector
      named requires Lnet/minecraft/item/Item$Settings;requires([Lnet/minecraft/resource/featuretoggle/FeatureFlag;)Lnet/minecraft/item/Item$Settings;
      intermediary method_45434 Lnet/minecraft/class_1792$class_1793;method_45434([Lnet/minecraft/class_7696;)Lnet/minecraft/class_1792$class_1793;
      official a Lcum$a;a([Lcpl;)Lcum$a;
    • component

      public <T> Item.Settings component(DataComponentType<T> type, T value)
      Mappings:
      Namespace Name Mixin selector
      named component Lnet/minecraft/item/Item$Settings;component(Lnet/minecraft/component/DataComponentType;Ljava/lang/Object;)Lnet/minecraft/item/Item$Settings;
      intermediary method_57349 Lnet/minecraft/class_1792$class_1793;method_57349(Lnet/minecraft/class_9331;Ljava/lang/Object;)Lnet/minecraft/class_1792$class_1793;
      official a Lcum$a;a(Lkl;Ljava/lang/Object;)Lcum$a;
    • attributeModifiers

      public Item.Settings attributeModifiers(AttributeModifiersComponent attributeModifiersComponent)
      Mappings:
      Namespace Name Mixin selector
      named attributeModifiers Lnet/minecraft/item/Item$Settings;attributeModifiers(Lnet/minecraft/component/type/AttributeModifiersComponent;)Lnet/minecraft/item/Item$Settings;
      intermediary method_57348 Lnet/minecraft/class_1792$class_1793;method_57348(Lnet/minecraft/class_9285;)Lnet/minecraft/class_1792$class_1793;
      official a Lcum$a;a(Lcxm;)Lcum$a;
    • getValidatedComponents

      ComponentMap getValidatedComponents()
      Mappings:
      Namespace Name Mixin selector
      named getValidatedComponents Lnet/minecraft/item/Item$Settings;getValidatedComponents()Lnet/minecraft/component/ComponentMap;
      intermediary method_58406 Lnet/minecraft/class_1792$class_1793;method_58406()Lnet/minecraft/class_9323;
      official b Lcum$a;b()Lki;
    • getComponents

      private ComponentMap getComponents()
      Mappings:
      Namespace Name Mixin selector
      named getComponents Lnet/minecraft/item/Item$Settings;getComponents()Lnet/minecraft/component/ComponentMap;
      intermediary method_57350 Lnet/minecraft/class_1792$class_1793;method_57350()Lnet/minecraft/class_9323;
      official c Lcum$a;c()Lki;