Tools
Creating Tools
To create a custom tool, apply the Tool
item behavior:
# The tool level
tool_level: minecraft:iron
# The tool category
tool_category: minecraft:sword
# The block breaking speed
break_speed: 1.5
# The attack damage
attack_damage: 6
# The attack speed
attack_speed: 2.0
# The knockback bonus
knockback_bonus: 1
# If sweep attacks can be performed with this tool
can_sweep_attack: true
# If this tool can break blocks in creative
can_break_blocks_in_creative: false
Tool Tiers
Each tool tier maps to a numerical tool level. Those tool levels are then used to determine whether a tool tier is good enough to break a block.
Tool Type | Level | ToolTier (Nova) | |
---|---|---|---|
No Tool | 0 | null |
|
Wooden | 0 | VanillaToolTiers.WOOD |
|
Golden | 0 | VanillaToolTiers.GOLD |
|
Stone | 1 | VanillaToolTiers.STONE |
|
Iron | 2 | VanillaToolTiers.IRON |
|
Diamond | 3 | VanillaToolTiers.DIAMOND |
|
Netherite | 3 | VanillaToolTiers.NETHERITE |
The numerical level values are assigned to the tool tiers in the tool_levels.yml
config file:
Registering a custom tool tier
To register custom tool tiers, create a new ToolTierRegistry
and annotate it with @Init
to load it during addon initialization:
@Init(stage = InitStage.PRE_PACK) // (1)!
object ToolTiers : ToolTierRegistry by ExampleAddon.registry {
val EXAMPLE_TIER = registerToolTier("example_tier")
}
- Nova will load this class during addon initialization, causing your tool levels to be registered.
Then, assign a numerical tool level value to your registered tier in the tool_levels.yml
config file:
The specified level of 4
would give your custom tool the ability to break all blocks that DIAMOND
or NETHERITE
tools
could break and would also be able to break custom blocks that have a tool tier configured which resolves to a tool level of
4
. This way, your tool can even break blocks that require a custom tool tier of another addon, as long as your
tool level is high enough.
Tool Categories
Tool Categories define what type of tool your item is. They determine which blocks can be broken with which item.
By default, there are six tool categories available:
Tool Type | ToolCategory (Nova) | |
---|---|---|
Sword | VanillaToolCategories.SWORD |
|
Pickaxe | VanillaToolCategories.PICKAXE |
|
Axe | VanillaToolCategories.AXE |
|
Shovel | VanillaToolCategories.SHOVEL |
|
Hoe | VanillaToolCategories.HOE |
|
Shears | VanillaToolCategories.SHEARS |
Registering a custom tool category
To register custom tool categories, create a new ToolCategoryRegistry
and annotate it with @Init
to load it during addon initialization:
@Init(stage = InitStage.PRE_PACK) // (1)!
object ToolCategories : ToolCategoryRegistry by ExampleAddon.registry {
val EXAMPLE_CATEGORY = registerToolCategory("example_category")
}
- Nova will load this class during addon initialization, causing your tool categories to be registered.
You can then use your new tool category in the Breakable
behavior of your custom block.