mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-24 22:51:18 -09:00
Update Worldedit.js
This commit is contained in:
parent
359ecc0506
commit
3f2f312a97
@ -1,11 +1,28 @@
|
|||||||
//WIP worldedit by radmanplays
|
//WIP worldedit by radmanplays
|
||||||
|
|
||||||
|
ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
||||||
|
console.log("Registered worldedit custom items.");
|
||||||
|
LibCustomItems.registerItem({
|
||||||
|
tag: "worledit:wand",
|
||||||
|
base: "wooden_axe",
|
||||||
|
name: "Wand",
|
||||||
|
qty: 1,
|
||||||
|
onRightClickGround: `/*/user, world, itemstack, blockpos/*/
|
||||||
|
itemstack.stackSize -= 1;
|
||||||
|
if (itemstack.stackSize < 1) {
|
||||||
|
user.inventory.mainInventory[user.inventory.currentItem] = null;
|
||||||
|
}
|
||||||
|
user.setHealth(2);
|
||||||
|
`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
const prefix = "[worldedit] "
|
const prefix = "[worldedit] "
|
||||||
PluginAPI.dedicatedServer.appendCode(function () {
|
PluginAPI.dedicatedServer.appendCode(function () {
|
||||||
PluginAPI.addEventListener("processcommand", (event) => {
|
PluginAPI.addEventListener("processcommand", (event) => {
|
||||||
if (event.command.toLowerCase().startsWith("//wand")) {
|
if (event.command.toLowerCase().startsWith("//wand")) {
|
||||||
event.sender.sendChatMessage(ModAPI.util.str("/give @s wooden_axe"))
|
event.sender.sendChatMessage(ModAPI.util.str("/give @p wooden_axe 1 0 {display:{Name:"Wand",Lore:["worledit:wand"]}}"))
|
||||||
event.sender.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str(prefix + "a wand has been added to your inventory")));
|
event.sender.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str(prefix + "a wand has been added to your inventory")));
|
||||||
event.preventDefault = true;
|
event.preventDefault = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user