Пример #1
0
 @SubscribeEvent
 public void onHorseSpawn(EntityJoinWorldEvent event) {
   if (event.entity instanceof EntityHorse) {
     if (event.entity.getClass() == EntityHorse.class) {
       event.setCanceled(true);
     } else {
       if (event.entity.getClass() == EntityBaseHorse.class) {
         System.out.println(
             event.entity.posX + ", " + event.entity.posY + ", " + event.entity.posZ);
       }
     }
   }
 }
Пример #2
0
  @SubscribeEvent
  public void PlayerJoinWorld(EntityJoinWorldEvent evt) {
    if (evt.entity instanceof IPokemob) {
      if (evt.entity.getEntityData().getBoolean("isPlayer")) {
        UUID uuid = UUID.fromString(evt.entity.getEntityData().getString("playerID"));
        EntityPlayer player = evt.world.getPlayerEntityByUUID(uuid);
        IPokemob evo = (IPokemob) evt.entity;
        proxy.setPokemob(player, evo);
        evt.setCanceled(true);
      }
    }

    if (!(evt.entity instanceof EntityPlayer)) return;
    EntityPlayer player = (EntityPlayer) evt.entity;
    if (!player.worldObj.isRemote) {
      new SendPacket(player);
      new SendExsistingPacket(player);
    }
  }