mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-26 07:19:26 -09:00
Increase LCI featureset
This commit is contained in:
parent
8d4a8152be
commit
df75615ea7
@ -6,6 +6,7 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
base: "magma_cream",
|
base: "magma_cream",
|
||||||
name: "Custom Item",
|
name: "Custom Item",
|
||||||
qty: 32,
|
qty: 32,
|
||||||
|
useRecipe: true,
|
||||||
recipe: [
|
recipe: [
|
||||||
"###",
|
"###",
|
||||||
"# #",
|
"# #",
|
||||||
@ -17,6 +18,7 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
"id": "dirt"
|
"id": "dirt"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//Optional: onRightClickGround
|
||||||
onRightClickGround: `/*/user, world, itemstack, blockpos/*/
|
onRightClickGround: `/*/user, world, itemstack, blockpos/*/
|
||||||
itemstack.stackSize -= 1;
|
itemstack.stackSize -= 1;
|
||||||
if (itemstack.stackSize < 1) {
|
if (itemstack.stackSize < 1) {
|
||||||
@ -25,6 +27,7 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
user.setHealth(2);
|
user.setHealth(2);
|
||||||
return true; //PreventDefault
|
return true; //PreventDefault
|
||||||
`,
|
`,
|
||||||
|
//Optional: onLeftClickGround
|
||||||
onLeftClickGround: `/*/user, world, itemstack, blockpos/*/
|
onLeftClickGround: `/*/user, world, itemstack, blockpos/*/
|
||||||
itemstack.stackSize -= 1;
|
itemstack.stackSize -= 1;
|
||||||
if (itemstack.stackSize < 1) {
|
if (itemstack.stackSize < 1) {
|
||||||
@ -32,6 +35,11 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
}
|
}
|
||||||
user.setHealth(20);
|
user.setHealth(20);
|
||||||
return true; //PreventDefault
|
return true; //PreventDefault
|
||||||
`
|
`,
|
||||||
|
//Optional: craftingExtra
|
||||||
|
craftingExtra: `/*/itemstack/*/
|
||||||
|
let enchant = ModAPI.reflect.getClassByName("Enchantment").staticMethods.getEnchantmentById.method(5); //ENCHANTMENT_OXYGEN (respiration)
|
||||||
|
itemstack.addEnchantment(enchant);
|
||||||
|
`,
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -142,8 +142,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var craftingManager = ModAPI.reflect.getClassById("net.minecraft.item.crafting.CraftingManager").staticMethods.getInstance.method();
|
var craftingManager = ModAPI.reflect.getClassById("net.minecraft.item.crafting.CraftingManager").staticMethods.getInstance.method();
|
||||||
|
if((data.useRecipe !== false) || (data.useRecipe !== "false")) {
|
||||||
ModAPI.hooks.methods.nmic_CraftingManager_addRecipe(craftingManager, testItem, recipe);
|
ModAPI.hooks.methods.nmic_CraftingManager_addRecipe(craftingManager, testItem, recipe);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ModAPI.dedicatedServer.appendCode(libServerside);
|
ModAPI.dedicatedServer.appendCode(libServerside);
|
||||||
ModAPI.dedicatedServer.appendCode("globalThis.LCI_registerItem = " + LCI_registerItem.toString());
|
ModAPI.dedicatedServer.appendCode("globalThis.LCI_registerItem = " + LCI_registerItem.toString());
|
||||||
window.LibCustomItems = {};
|
window.LibCustomItems = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user