Repository navigation
API Tools and Armor
Lua API / Items / Tools and armor
On this page
Registers a tool and returns an item reference. Requires the common item identity fields, type and material. Type must select sword, pickaxe, axe, shovel or hoe.
local pick = betamoon.tools:add {
id = 5002, key = "mymod:item/example_pick", type = "pickaxe",
material = betamoon.mc.toolMaterials.iron,
icon = { x = 2, y = 6 }
}Required tool-material handle returned by Materials, or native name: wood, stone, iron, emerald/diamond, gold.
Optional top-level number changing native mining efficiency for pickaxes, axes and shovels. Cannot be combined with tool.efficiency.
Optional integer changing native attack damage for pickaxes, axes, shovels and swords.
| Property | Item kinds |
|---|---|
maxStackSize, hasSubtypes
|
Ordinary item, food. |
maxDamage |
Ordinary item, food, pickaxe, axe, shovel, sword, hoe. |
Top-level efficiency
|
Pickaxe, axe, shovel. |
damageVsEntity |
Pickaxe, axe, shovel, sword. |
appearance |
All item kinds; inventory, held, and dropped model presentation. |
The separate tool policy table is documented in Items.
Registers armor and returns an item reference. Supplies type = "armor" when omitted. Requires common item identity fields, material and slot.
local helmet = betamoon.armor:add {
id = 5008, key = "mymod:item/example_helmet",
material = "iron", slot = "helmet", renderIndex = "iron",
icon = { x = 2, y = 0 }
}Custom armor-material handle, native material string, or nonnegative numeric material value. Native names map leather/cloth = 0, chain/chainmail = 1, iron = 2, diamond/emerald = 3, gold/golden = 4.
Required string: helmet/head, chestplate/chest, leggings/legs, boots/feet.
Optional texture asset reference/key or PNG path for the worn model. Helmet, chestplate and boots use layer 1; leggings use layer 2. This is separate from the inventory texture. Cannot be combined with renderIndex. An item's appearance does not replace worn armor geometry or this texture.
Optional vanilla worn-texture selector. Accepts integer 0–4 or the native material names/aliases above. Omitted retains the material's initial render index; native numeric/string materials initially use render index 0, so explicitly choose the desired worn texture.
Tools and armor are also items. Use the corresponding betamoon.tools or betamoon.armor registry's get,
getRequired, find, first, or one method to retrieve an item reference. The shared lookup contracts are
documented in References and stacks.
Tool and armor lookups return item references. Their shared properties and reference:override(definition) behavior
are documented in References and stacks.
- Installation
- Install scripts
- Getting started
- VS Code and LuaLS
- Examples
- Reload and compatibility
- Troubleshooting
- Changelog
Scripts and shared values
- Script lifecycle
- Packaged Lua mods
- Modules
- References and stacks
- Queries
- Overrides
- Minecraft constants
- Chat and positions
- Structured data
- Script configuration
- Particles
Blocks and items
- Multiblocks
- Blocks
- Block state and placement
- Block shapes and rendering
- Block callbacks
- Block ticks and redstone
- Items
- Fluids
- Item callbacks
- Tools and armor
- Materials
- Textures
Entities
- Entities
- Entity access and movement
- Entity lifecycle and data
- Entity health and loot
- Entity inventories and relationships
- Projectiles and pickups
- Entity presentation and sounds
- Living entities and AI
- Entity parts and sensors
Assets and audio
- Assets
- Models and animations
- Built-in Minecraft models
- Model appearances
- Blockbench workflow
- Audio
- Texture-pack overrides
Events and world actions
World generation
World systems
Inventories and screens
Recipes