Skip to content

Commit

Permalink
Merge pull request #2 from OeildeLynx31/main
Browse files Browse the repository at this point in the history
Bettered the worldedit mod
  • Loading branch information
radmanplays authored Sep 19, 2024
2 parents 4accf85 + 7c584b6 commit 61a4a06
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examplemods/Worldedit.js
Original file line number Diff line number Diff line change
@@ -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({
Expand Down Expand Up @@ -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"));

Expand Down

0 comments on commit 61a4a06

Please sign in to comment.