Skip to content

API Tools and Armor

Piggo41 edited this page Oct 12, 2026 · 10 revisions

Tools and armor

Lua API / Items / Tools and armor

On this page

betamoon.tools:add(definition)

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 }
}

material

Required tool-material handle returned by Materials, or native name: wood, stone, iron, emerald/diamond, gold.

efficiency

Optional top-level number changing native mining efficiency for pickaxes, axes and shovels. Cannot be combined with tool.efficiency.

damageVsEntity

Optional integer changing native attack damage for pickaxes, axes, shovels and swords.

Supported declaration properties

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.

betamoon.armor:add(definition)

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 }
}

material

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.

slot

Required string: helmet/head, chestplate/chest, leggings/legs, boots/feet.

modelTexture

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.

renderIndex

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.

Tool and armor lookup

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 references and overrides

Tool and armor lookups return item references. Their shared properties and reference:override(definition) behavior are documented in References and stacks.

Examples: Tools, armor.

Clone this wiki locally