User Tools

Site Tools


tutorial:items_docs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial:items_docs [2020/04/01 19:23]
draylar clarify max count limits
tutorial:items_docs [2020/04/01 19:45] (current)
draylar finish Item.Settings method docs
Line 21: Line 21:
 public Item.Settings food(FoodComponent foodComponent) public Item.Settings food(FoodComponent foodComponent)
 </​code>​ </​code>​
-''​foodComponent''​ - instance of ''​FoodComponent''​. When set, the Item will be edible based on the settings provided by the ''​FoodComponent'' ​builder. For an in-depth explanation of the available options, view the FoodComponent Overview page.+''​foodComponent''​ - instance of'​FoodComponent. When set, the Item will be edible based on the settings provided by the FoodComponent builder. For an in-depth explanation of the available options, view the FoodComponent Overview page.
  
 ---- ----
Line 29: Line 29:
 public Item.Settings maxCount(int maxCount) public Item.Settings maxCount(int maxCount)
 </​code>​ </​code>​
-''​maxCount''​ - the maximum count of an ''​ItemStack'' ​for the given ''​Item''​. If ''​maxDamage''​ has already been called, a ''​RuntimeException'' ​is thrown, as an Item cannot have both damage and count. Keeping the max count at or below 64 is recommended,​ as any value above that can lead to various issues.+''​maxCount''​ - the maximum count of an ItemStack for the given Item. If ''​maxDamage()''​ has already been called, a RuntimeException is thrown, as an Item cannot have both damage and count. Keeping the max count at or below 64 is recommended,​ as any value above that can lead to various issues.
  
 +----
  
 +==== Max Damage if Absent ====
 +<code java>
 +public Item.Settings maxDamageIfAbsent(int maxDamage)
 +</​code>​
 +''​maxDamage''​ - max durability of the given ''​Item''​ when in ''​ItemStack''​ form. 
 +
 +If ''​maxDamage()''​ has not been called yet, the max durability of the Item is set to the value passed in. This is used for cases such as tools and armor, where the Item's durability is only set to the ToolMaterial'​s durability //if// it has not been set yet.
 +
 +----
 +
 +==== Max Damage ====
 +<code java>
 +public Item.Settings maxDamage(int maxDamage)
 +</​code>​
 +''​maxDamage''​ - max durability of the given Item when in ItemStack form. 
 +
 +----
 +
 +==== Recipe Remainder ====
 +<code java>
 +public Item.Settings recipeRemainder(Item recipeRemainder)
 +</​code>​
 +''​recipeRemainder''​ - Item to return as a remainder when the base Item is used in a crafting recipe.
 +
 +When a recipe remainder is set on an Item, any recipe using that Item will return the remainder on craft. This is used for buckets (Water, Lava, Milk) and bottles (Dragon Breath, Honey) returning their respective empty items when used in recipes.
 +
 +----
 +
 +==== Group ====
 +<code java>
 +public Item.Settings group(ItemGroup group)
 +</​code>​
 +''​group''​ - ItemGroup to add Item in.
 +
 +Each ItemGroup appears as a tab in the creative inventory. Adding an Item to this group will add it to the tab. The order of the group is based on registry order. For more information on creating a group, see the [[tutorial:​itemgroup|ItemGroups page]].
 +
 +----
 +
 +==== Rarity ====
 +<code java>
 +public Item.Settings rarity(Rarity rarity)
 +</​code>​
 +''​rarity''​ - Rarity of the given Item.
  
 +If Rarity is set, the given Item will have a custom name color. An Item's Rarity defaults to common.
 +^ Rarity ^ Color ^
 +| Common | White |
 +| Uncommon | Yellow |
 +| Rare | Aqua |
 +| Epic | Light Purple |
tutorial/items_docs.txt ยท Last modified: 2020/04/01 19:45 by draylar