tutorial:tools
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:tools [2020/07/24 07:58] – [Creating the tool objects] minor change to constructor warning boogiemonster1o1 | tutorial:tools [2020/07/30 11:03] – Fixed an incorrect method name boogiemonster1o1 | ||
---|---|---|---|
Line 13: | Line 13: | ||
<code java [enable_line_numbers=true]> | <code java [enable_line_numbers=true]> | ||
public enum CustomToolMaterial implements ToolMaterial {; | public enum CustomToolMaterial implements ToolMaterial {; | ||
- | CustomToolMaterial(int miningLevel, | + | CustomToolMaterial(int miningLevel, |
} | } | ||
Line 22: | Line 22: | ||
1. `miningLevel` refers to the strength of the tool necessary to mine any material. Wood is 1, Stone is 2, Iron is 3, Diamond is 4. | 1. `miningLevel` refers to the strength of the tool necessary to mine any material. Wood is 1, Stone is 2, Iron is 3, Diamond is 4. | ||
2. `itemDurability` refers to the initial durability of a tool. Gold is 32, Iron is 250, Netherite is 2031. | 2. `itemDurability` refers to the initial durability of a tool. Gold is 32, Iron is 250, Netherite is 2031. | ||
- | 3. `miningSpeed` refers to how fast your tools can break blocks. Gold is 12.0f, Diamond is 8.0f, Iron is 6.0f. | + | 3. `miningSpeedMultiplier |
4. `attackDamage` refers to the melee damage that your tools perform. Wood is 0.0f, Stone is 1.0f, Diamond is 3.0f | 4. `attackDamage` refers to the melee damage that your tools perform. Wood is 0.0f, Stone is 1.0f, Diamond is 3.0f | ||
- | 5. `enchantability` refers to the chance of getting high level enchantments on your tools. Wood is 15, Stone is 5, Gold is 22, Iron is 14. | + | 5. `enchantability` refers to the chance of getting high-level enchantments on your tools. Wood is 15, Stone is 5, Gold is 22, Iron is 14. |
6. `repairIngredient` refers to the item that can repair your tools in an anvil. This will not be stored in an `Ingredient`, | 6. `repairIngredient` refers to the item that can repair your tools in an anvil. This will not be stored in an `Ingredient`, | ||
Line 32: | Line 32: | ||
private final int miningLevel; | private final int miningLevel; | ||
private final int itemDurability; | private final int itemDurability; | ||
- | private final float miningSpeed; | + | private final float miningSpeedMultiplier; |
private final float attackDamage; | private final float attackDamage; | ||
private final int enchantability; | private final int enchantability; | ||
private final Lazy< | private final Lazy< | ||
- | CustomToolMaterial(int miningLevel, | + | CustomToolMaterial(int miningLevel, |
this.miningLevel = miningLevel; | this.miningLevel = miningLevel; | ||
this.itemDurability = itemDurability; | this.itemDurability = itemDurability; | ||
- | this.miningSpeed | + | this. miningSpeedMultiplier |
this.attackDamage = attackDamage; | this.attackDamage = attackDamage; | ||
this.enchantability = enchantability; | this.enchantability = enchantability; | ||
Line 54: | Line 54: | ||
private final int miningLevel; | private final int miningLevel; | ||
private final int itemDurability; | private final int itemDurability; | ||
- | private final float miningSpeed; | + | private final float miningSpeedMultiplier; |
private final float attackDamage; | private final float attackDamage; | ||
private final int enchantability; | private final int enchantability; | ||
private final Lazy< | private final Lazy< | ||
- | CustomToolMaterial(int miningLevel, | + | CustomToolMaterial(int miningLevel, |
this.miningLevel = miningLevel; | this.miningLevel = miningLevel; | ||
this.itemDurability = itemDurability; | this.itemDurability = itemDurability; | ||
- | this.miningSpeed | + | this.miningSpeedMultiplier |
this.attackDamage = attackDamage; | this.attackDamage = attackDamage; | ||
this.enchantability = enchantability; | this.enchantability = enchantability; | ||
Line 74: | Line 74: | ||
@Override | @Override | ||
- | public float getMiningSpeed() { | + | public float getMiningSpeedMultiplier() { |
- | return this.miningSpeed; | + | return this.miningSpeedMultiplier; |
} | } | ||
Line 105: | Line 105: | ||
<code java [enable_line_numbers=true]> | <code java [enable_line_numbers=true]> | ||
public enum CustomToolMaterial implements ToolMaterial { | public enum CustomToolMaterial implements ToolMaterial { | ||
- | POTATO(1, 167, 4.8F, 1.1F, 11, () -> Ingredient.ofItems(Items.POTATO)); | + | POTATO(1, 167, 4.8F, 1.1F, 11, () -> { |
+ | return | ||
+ | }); | ||
| | ||
[...] | [...] | ||
Line 132: | Line 134: | ||
public static ToolItem POTATO_PICKAXE = new PickaxeSubclass(CustomToolMaterial.POTATO, | public static ToolItem POTATO_PICKAXE = new PickaxeSubclass(CustomToolMaterial.POTATO, | ||
public static ToolItem POTATO_AXE = new AxeSubclass(CustomToolMaterial.POTATO, | public static ToolItem POTATO_AXE = new AxeSubclass(CustomToolMaterial.POTATO, | ||
- | public static ToolItem POTATO_HOE = new HoeSubclass(CustomToolMaterial.POTATO, | + | public static ToolItem POTATO_HOE = new HoeSubclass(CustomToolMaterial.POTATO, |
</ | </ | ||
tutorial/tools.txt · Last modified: 2023/09/07 05:32 by drakonkinst