Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void createNpc(Player p, String name){
- MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
- WorldServer nmsWorld = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();
- EntityPlayer npc = new EntityPlayer(nmsServer, nmsWorld, new GameProfile(UUID.randomUUID()),name), new PlayerInteractManager(nmsWorld));
- npc.setLocation(X, Y, Z, 0, 0);
- PlayerConnection connection = ((CraftPlayer)p).getHandle().playerConnection;
- connection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, npc));
- connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
- }
Advertisement
Add Comment
Please, Sign In to add comment