Beispiel #1
0
 public static HumanNPC spawnNPC(
     int UID,
     String name,
     World world,
     double x,
     double y,
     double z,
     float yaw,
     float pitch,
     CreatureNPCType type) {
   try {
     WorldServer ws = getWorldServer(world);
     MinecraftServer ms = getMinecraftServer(ws.getServer());
     CraftNPC eh =
         (CraftNPC)
             type.getEntityClass()
                 .getConstructors()[0]
                 .newInstance(ms, ws, name, new ItemInWorldManager(ws));
     ws.addEntity(eh);
     eh.setLocation(x, y, z, yaw, pitch);
     ws.players.remove(eh);
     return new HumanNPC(eh, UID, name);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }