Appearance
helix / ItemModifier
Class: ItemModifier
Defined in: core/values/item-modifier.ts:18
A registerable item modifier - the JSON written to data/<ns>/<item_modifier folder>/<name>.json (via Datapack.itemModifier) and applied with /item modify ... <ref> or a loot set_loot. An item modifier is a sequence of LootFunctions, so it shares the exact loot-function vocabulary used inside loot tables rather than re-modelling it.
dp.itemModifier("sharpen", new ItemModifier().apply(LootFunction.of("set_name", { name: "Sharpened" })));
A single-function modifier emits the bare function object; multiple emit the JSON array form Minecraft also accepts.
Constructors
Constructor
new ItemModifier():
ItemModifier
Returns
ItemModifier
Methods
apply()
apply(
fn):this
Defined in: core/values/item-modifier.ts:22
Append a function to the modifier chain (applied in order).
Parameters
fn
Returns
this
toJson()
toJson(
version):unknown
Defined in: core/values/item-modifier.ts:28
The item-modifier JSON: a single function object, or an array of them.
Parameters
version
Returns
unknown