mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-26 23:39:25 -09:00
Merge branch 'main' of https://github.com/eaglerforge/EaglerForgeInjector
This commit is contained in:
commit
c348e74ce8
@ -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"));
|
||||
|
||||
|
@ -9,14 +9,16 @@
|
||||
|
||||
// Create a fake player GameProfile
|
||||
const GameProfileClass = ModAPI.reflect.getClassById("net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile");
|
||||
const fakeProfile = GameProfileClass.constructors[2](
|
||||
ModAPI.reflect.getClassById("java.util.UUID").staticMethods.randomUUID(), ModAPI.util.str("Steve")
|
||||
);
|
||||
const fakeProfile = GameProfileClass.constructors[1](null, ModAPI.util.str("Steve"));
|
||||
|
||||
// Get the PlayerInteractionManager class
|
||||
const PlayerInteractionManagerClass = ModAPI.reflect.getClassById("net.minecraft.server.management.ItemInWorldManager");
|
||||
const playerInteractionManager = PlayerInteractionManagerClass.constructors[0](world.getRef());
|
||||
|
||||
// Get the EntityPlayerMP class to spawn the fake player
|
||||
const EntityPlayerMPClass = ModAPI.reflect.getClassById("net.minecraft.entity.player.EntityPlayerMP");
|
||||
const fakePlayer = EntityPlayerMPClass.constructors[1](
|
||||
world.getMinecraftServer(), world.getRef(), fakeProfile, world.getPlayerInteractionManager()
|
||||
const fakePlayer = EntityPlayerMPClass.constructors[0](
|
||||
world.getMinecraftServer(), world.getRef(), fakeProfile, playerInteractionManager
|
||||
);
|
||||
|
||||
// Set the fake player position to be near the command sender
|
||||
|
@ -105,11 +105,6 @@ var main;(function(){`
|
||||
\<script id="libserverside"\>{"._|_libserverside_|_."}\<\/script\>`
|
||||
);
|
||||
|
||||
patchedFile = patchedFile.replace(
|
||||
`document.getElementById("launch_countdown_screen").remove(); main();`,
|
||||
`document.getElementById("launch_countdown_screen").remove(); window.modapi_displayModGui();`
|
||||
)
|
||||
|
||||
const extractConstructorRegex =
|
||||
/^\s*function (\S*?)__init_\d*?\((?!\$)/gm;
|
||||
const extractConstructorFullNameRegex =
|
||||
|
Loading…
x
Reference in New Issue
Block a user