diff --git a/examplemods/Worldedit.js b/examplemods/Worldedit.js index 227b67e..6d9a637 100644 --- a/examplemods/Worldedit.js +++ b/examplemods/Worldedit.js @@ -1,5 +1,7 @@ -//WIP worldedit by radmanplays - +ModAPI.meta.title("WorldEdit"); +ModAPI.meta.credits("By radmanplays"); +ModAPI.meta.icon("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAcUlEQVR42mNgoAcw1xT4D8Jka25LVQNjkg2Bac4OlP9fGqFImgHImmHY00z0f4af3H+SDADZDNIc6SwJpjXkuP+THHggm5ENIckrMGeDbIZ5hWgDQJo709XhziYpOpFtJjnuKdaM7OwhYjMIkG0zpQAAtFpjWIvu2dwAAAAASUVORK5CYII="); +ModAPI.meta.description("Use //wand, //set and //walls in singleplayer worlds."); ModAPI.addEventListener("lib:libcustomitems:loaded", () => { console.log("Registered worldedit custom items."); LibCustomItems.registerItem({ @@ -71,6 +73,11 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => { const displayTag = NBTTagCompoundClass.constructors[0](); itemStack.$stackTagCompound.$setTag(ModAPI.util.str("display"), displayTag); + // Add the enchant effect to the item + let enchant = ModAPI.hooks._classMap.nme_Enchantment.staticMethods.getEnchantmentById.method(0); + enchant.$effectId = -1; + itemStack.$addEnchantment(enchant); + // Set item name displayTag.$setString(ModAPI.util.str("Name"), ModAPI.util.str("Wand"));