User Tools

Site Tools


tutorial:tools

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:tools [2020/09/14 01:50] – fix constructor draylartutorial:tools [2021/10/31 09:43] – Updated to fix sentence that said attackDamage was int, while it's float for AxeItem metaltxus
Line 92: Line 92:
 ==== Creating Tools ==== ==== Creating Tools ====
  
-All base tool classes (''PickaxeItem'', ''ShovelItem'', ''HoeItem'', ''AxeItem'', ''SwordItem'') require a ''ToolMaterial'', an attack speed (float), an additional attack damage amount (int), and an ''Item.Settings'' instance.+All base tool classes (''PickaxeItem'', ''ShovelItem'', ''HoeItem'', ''AxeItem'', ''SwordItem'') require a ''ToolMaterial'', an attack speed (float), an additional attack damage amount (float for AxeItem; int for the rest), and an ''Item.Settings'' instance.
  
 <code java [enable_line_numbers=true]> <code java [enable_line_numbers=true]>
Line 99: Line 99:
 </code> </code>
  
-`PickaxeItem` , `HoeItem` and `AxeItem` have protected constructors, which means you will need to create your own sub-class with public constructor+`PickaxeItem` , `HoeItem` and `AxeItem` have protected constructors, which means you will need to create your own classes with public constructors
 <code java [enable_line_numbers=true]> <code java [enable_line_numbers=true]>
 public class CustomPickaxeItem extends PickaxeItem { public class CustomPickaxeItem extends PickaxeItem {
Line 108: Line 108:
 </code> </code>
  
-Using the custom subclass:+Using the public classes:
 <code java> <code java>
 public static ToolItem POTATO_PICKAXE = new CustomPickaxeItem(PotatoToolMaterial.INSTANCE, 1, -2.8F, new Item.Settings().group(ItemGroup.TOOLS)); public static ToolItem POTATO_PICKAXE = new CustomPickaxeItem(PotatoToolMaterial.INSTANCE, 1, -2.8F, new Item.Settings().group(ItemGroup.TOOLS));
tutorial/tools.txt · Last modified: 2023/09/07 05:32 by drakonkinst