EaglerForgeInjector/examplemods/CustomItemsDemo.js
2024-09-08 11:53:05 +08:00

28 lines
791 B
JavaScript

//This mod also requires lib.customitems.js
ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
console.log("Registered my cool custom item.");
LibCustomItems.registerItem({
tag: "mymod:test_item_1",
base: "magma_cream",
name: "Custom Item",
qty: 32,
recipe: [
"###",
"# #",
"###"
],
recipeLegend: {
"#": {
"type": "block",
"id": "dirt"
}
},
onRightClickGround: `/*/user, world, itemstack, blockpos/*/
itemstack.stackSize -= 1;
if (itemstack.stackSize < 1) {
user.inventory.mainInventory[user.inventory.currentItem] = null;
}
user.setHealth(2);
`
});
});