Update npcspawner.js

This commit is contained in:
radmanplays 2024-09-19 23:14:47 +03:30 committed by GitHub
parent b683b5d40c
commit 2adc025d3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,10 +11,14 @@
const GameProfileClass = ModAPI.reflect.getClassById("net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile");
const fakeProfile = GameProfileClass.constructors[1](null, ModAPI.util.str("Steve"));
// Get the PlayerInteractionManager class
const PlayerInteractionManagerClass = ModAPI.reflect.getClassById("net.minecraft.server.management.PlayerInteractionManager");
const playerInteractionManager = PlayerInteractionManagerClass.constructors[1](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()
world.getMinecraftServer(), world.getRef(), fakeProfile, playerInteractionManager
);
// Set the fake player position to be near the command sender