mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-26 15:29:26 -09:00
Merge branch 'main' of https://github.com/eaglerforge/EaglerForgeInjector
This commit is contained in:
commit
f7475bab21
@ -20,31 +20,29 @@ 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] ";
|
||||||
const player = user;
|
|
||||||
const pos = blockpos;
|
const pos = blockpos;
|
||||||
const positions = globalThis.playerPositions[player.getName()] ||= {};
|
const positions = globalThis.playerPositions[user.getName()] ||= {};
|
||||||
|
|
||||||
// Save position #2
|
// Save position #2
|
||||||
positions.pos2 = pos;
|
positions.pos2 = pos;
|
||||||
|
|
||||||
// Send chat message to player
|
// Send chat message to player
|
||||||
player.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](
|
user.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str(
|
||||||
ModAPI.util.str(prefix + "Pos #2 selected at: " + pos.$x + ", " + pos.$y + ", " + pos.$z)
|
ModAPI.util.str(prefix + "Pos #2 selected at: " + pos.$x + ", " + pos.$y + ", " + pos.$z))
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
`,
|
`,
|
||||||
onLeftClickGround: `/*/user, world, itemstack, blockpos/*/
|
onLeftClickGround: `/*/user, world, itemstack, blockpos/*/
|
||||||
const prefix = "§7[§4worldedit§7] ";
|
const prefix = "§7[§4worldedit§7] ";
|
||||||
const player = user;
|
|
||||||
const pos = blockpos;
|
const pos = blockpos;
|
||||||
const positions = globalThis.playerPositions[player.getName()] ||= {};
|
const positions = globalThis.playerPositions[user.getName()] ||= {};
|
||||||
|
|
||||||
// Save position #1
|
// Save position #1
|
||||||
positions.pos1 = pos;
|
positions.pos1 = pos;
|
||||||
|
|
||||||
// Send chat message to player
|
// Send chat message to player
|
||||||
player.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](
|
user.addChatMessage(ModAPI.reflect.getClassById("net.minecraft.util.ChatComponentText").constructors[0](ModAPI.util.str(
|
||||||
ModAPI.util.str(prefix + "Pos #1 selected at: " + pos.$x + ", " + pos.$y + ", " + pos.$z)
|
ModAPI.util.str(prefix + "Pos #1 selected at: " + pos.$x + ", " + pos.$y + ", " + pos.$z))
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
`
|
`
|
||||||
@ -89,28 +87,28 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
event.preventDefault = true;
|
event.preventDefault = true;
|
||||||
}
|
}
|
||||||
if (event.command.toLowerCase().startsWith("//set")) {
|
if (event.command.toLowerCase().startsWith("//set")) {
|
||||||
|
const player = event.sender;
|
||||||
// Parse command parameters
|
// Parse command parameters
|
||||||
const params = event.command.split(" ");
|
const params = event.command.substring("//set ".length);
|
||||||
if (params.length !== 2) {
|
if (!params) {
|
||||||
event.sender.addChatMessage(prefix + "§cUsage: //set <block_type>");
|
player.addChatMessage(ChatComponentTextClass.constructors[0](ModAPI.util.str(prefix + "§cUsage: //set <block_type>")));
|
||||||
event.preventDefault = true;
|
event.preventDefault = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const blockType = params[1];
|
const blockType = params;
|
||||||
const player = event.sender;
|
|
||||||
const positions = globalThis.playerPositions[player.getName()];
|
const positions = globalThis.playerPositions[player.getName()];
|
||||||
|
|
||||||
// Validate block type and positions
|
// Validate block type and positions
|
||||||
const block = ModAPI.blocks[blockType];
|
if (typeof ModAPI.blocks[blockType] !== 'undefined') {
|
||||||
if (!block) {
|
player.addChatMessage(ChatComponentTextClass.constructors[0](ModAPI.util.str(prefix + "§cInvalid block type.")));
|
||||||
player.addChatMessage(prefix + "§cInvalid block type.");
|
|
||||||
event.preventDefault = true;
|
event.preventDefault = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const block = ModAPI.blocks[blockType];
|
||||||
|
|
||||||
if (!positions || !positions.pos1 || !positions.pos2) {
|
if (!positions || !positions.pos1 || !positions.pos2) {
|
||||||
player.addChatMessage(prefix + "§cPositions not set. Use left and right click to set positions.");
|
player.addChatMessage(ChatComponentTextClass.constructors[0](ModAPI.util.str(prefix + "§cPositions not set. Use left and right click to set positions.")));
|
||||||
event.preventDefault = true;
|
event.preventDefault = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -137,7 +135,7 @@ ModAPI.addEventListener("lib:libcustomitems:loaded", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Notify the sender
|
// Notify the sender
|
||||||
player.addChatMessage(prefix + "§aBlocks set successfully.");
|
player.addChatMessage(ChatComponentTextClass.constructors[0](ModAPI.util.str(prefix + "§aBlocks set successfully.")));
|
||||||
|
|
||||||
event.preventDefault = true;
|
event.preventDefault = true;
|
||||||
}
|
}
|
||||||
|
@ -61,12 +61,16 @@
|
|||||||
var statusTag = Object.keys(packet.$status).find(x => { return x.startsWith("$name") });
|
var statusTag = Object.keys(packet.$status).find(x => { return x.startsWith("$name") });
|
||||||
var positionTag = Object.keys(packet).filter(x => { return x.startsWith("$position") })[0];
|
var positionTag = Object.keys(packet).filter(x => { return x.startsWith("$position") })[0];
|
||||||
var stat = ModAPI.util.unstr(packet.$status[statusTag]);
|
var stat = ModAPI.util.unstr(packet.$status[statusTag]);
|
||||||
if (stat !== "START_DESTROY_BLOCK") {
|
if (stat === "START_DESTROY_BLOCK") {
|
||||||
if (stat === "STOP_DESTROY_BLOCK") {
|
|
||||||
sendPacket($this, packetblockchange($this.$serverController.$worldServerForDimension($this.$playerEntity.$dimension), packet[positionTag]));
|
sendPacket($this, packetblockchange($this.$serverController.$worldServerForDimension($this.$playerEntity.$dimension), packet[positionTag]));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (stat !== "START_DESTROY_BLOCK") {
|
||||||
|
if (stat === "STOP_DESTROY_BLOCK") {
|
||||||
|
sendPacket($this, packetblockchange($this.$serverController.$worldServerForDimension($this.$playerEntity.$dimension), packet[positionTag]));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
var r = globalThis.LCI_LMBEVENTS[cid].call(globalThis,
|
var r = globalThis.LCI_LMBEVENTS[cid].call(globalThis,
|
||||||
new Proxy($this.$playerEntity, ModAPI.util.TeaVM_to_Recursive_BaseData_ProxyConf),
|
new Proxy($this.$playerEntity, ModAPI.util.TeaVM_to_Recursive_BaseData_ProxyConf),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user