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
03f62846cc
commit
310b73bdf9
@ -20,10 +20,15 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
},
|
},
|
||||||
onRightClickGround: `/*/user, world, itemstack, blockpos/*/
|
onRightClickGround: `/*/user, world, itemstack, blockpos/*/
|
||||||
const prefix = "§7[§4worldedit§7] ";
|
const prefix = "§7[§4worldedit§7] ";
|
||||||
|
var username = user.getName();
|
||||||
|
|
||||||
globalThis.pos2x = blockpos.x
|
globalThis.pos2x = {}
|
||||||
globalThis.pos2y = blockpos.y
|
globalThis.pos2y = {}
|
||||||
globalThis.pos2z = blockpos.z
|
globalThis.pos2z = {}
|
||||||
|
|
||||||
|
globalThis.pos2x[username] = blockpos.x
|
||||||
|
globalThis.pos2y[username] = blockpos.y
|
||||||
|
globalThis.pos2z[username] = blockpos.z
|
||||||
console.log("rightclick: " + blockpos.x + ", " + blockpos.y + ", " + blockpos.z)
|
console.log("rightclick: " + blockpos.x + ", " + blockpos.y + ", " + blockpos.z)
|
||||||
// Send chat message to player
|
// Send chat message to player
|
||||||
user.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str(prefix + "Pos #2 set to: " + blockpos.x + ", " + blockpos.y + ", " + blockpos.z)))
|
user.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str(prefix + "Pos #2 set to: " + blockpos.x + ", " + blockpos.y + ", " + blockpos.z)))
|
||||||
@ -31,12 +36,16 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
`,
|
`,
|
||||||
onLeftClickGround: `/*/user, world, itemstack, blockpos/*/
|
onLeftClickGround: `/*/user, world, itemstack, blockpos/*/
|
||||||
const prefix = "§7[§4worldedit§7] ";
|
const prefix = "§7[§4worldedit§7] ";
|
||||||
|
var username = user.getName();
|
||||||
|
|
||||||
globalThis.posx = blockpos.x
|
globalThis.posx = {}
|
||||||
globalThis.posy = blockpos.y
|
globalThis.posy = {}
|
||||||
globalThis.posz = blockpos.z
|
globalThis.posz = {}
|
||||||
|
|
||||||
|
globalThis.posx[username] = blockpos.x
|
||||||
|
globalThis.posy[username] = blockpos.y
|
||||||
|
globalThis.posz[username] = blockpos.z
|
||||||
|
|
||||||
console.log("leftclick: " + blockpos.x + ", " + blockpos.y + ", " + blockpos.z)
|
|
||||||
// Send chat message to player
|
// Send chat message to player
|
||||||
user.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str(prefix + "Pos #1 set to: " + blockpos.x + ", " + blockpos.y + ", " + blockpos.z)))
|
user.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str(prefix + "Pos #1 set to: " + blockpos.x + ", " + blockpos.y + ", " + blockpos.z)))
|
||||||
return true;
|
return true;
|
||||||
@ -84,11 +93,12 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
var blockPosConstructor = ModAPI.reflect.getClassById("net.minecraft.util.BlockPos").constructors.find((x) => { return x.length === 3 });
|
var blockPosConstructor = ModAPI.reflect.getClassById("net.minecraft.util.BlockPos").constructors.find((x) => { return x.length === 3 });
|
||||||
if (event.command.toLowerCase().startsWith("//set")) {
|
if (event.command.toLowerCase().startsWith("//set")) {
|
||||||
const args = event.command.substring("//set ".length);
|
const args = event.command.substring("//set ".length);
|
||||||
|
var username = event.sender.getName();
|
||||||
|
|
||||||
if (args) {
|
if (args) {
|
||||||
const blockTypeName = args
|
const blockTypeName = args
|
||||||
const x1 = globalThis.posx, y1 = globalThis.posy, z1 = globalThis.posz;
|
const x1 = globalThis.posx[username], y1 = globalThis.posy[username], z1 = globalThis.posz[username];
|
||||||
const x2 = globalThis.pos2x, y2 = globalThis.pos2y, z2 = globalThis.pos2z;
|
const x2 = globalThis.pos2x[username], y2 = globalThis.pos2y[username], z2 = globalThis.pos2z[username];
|
||||||
|
|
||||||
// Validate block and get block type
|
// Validate block and get block type
|
||||||
const blockType = ModAPI.blocks[blockTypeName];
|
const blockType = ModAPI.blocks[blockTypeName];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user