@SubscribeEvent
  public void onEntityUpdate(LivingUpdateEvent event) {
    if (event.entityLiving.isPotionActive(AbyssalCraft.Cplague)) {
      if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {
        event.entityLiving.attackEntityFrom(DamageSource.magic, 2);
        if (event.entityLiving instanceof CoraliumMob) {
          event.entityLiving.removePotionEffect(AbyssalCraft.Cplague.id);
        }
        if (event.entityLiving instanceof EntityZombie) {
          if (!event.entityLiving.isEntityAlive()) {
            EntityDepthsZombie entityzombie = new EntityDepthsZombie(event.entityLiving.worldObj);
            if (event.entityLiving.worldObj.difficultySetting == EnumDifficulty.HARD
                && event.entityLiving.worldObj.rand.nextBoolean()) {
              entityzombie.copyLocationAndAnglesFrom(event.entityLiving);
              entityzombie.onSpawnWithEgg((IEntityLivingData) null);
              entityzombie.setIsZombie(true);
            } else if (event.entityLiving.worldObj.rand.nextInt(8) == 0) {
              entityzombie.copyLocationAndAnglesFrom(event.entityLiving);
              entityzombie.onSpawnWithEgg((IEntityLivingData) null);
              entityzombie.setIsZombie(true);
            }

            event.entityLiving.worldObj.removeEntity(event.entityLiving);
            event.entityLiving.worldObj.spawnEntityInWorld(entityzombie);
          }
          if (event.entityLiving.worldObj.getWorldInfo().isHardcoreModeEnabled()) {
            if (!event.entityLiving.isEntityAlive()
                && event.entityLiving.worldObj.rand.nextInt(10) == 0) {
              EntityDepthsghoul ghoul = new EntityDepthsghoul(event.entityLiving.worldObj);
              ghoul.copyLocationAndAnglesFrom(event.entityLiving);
              ghoul.onSpawnWithEgg((IEntityLivingData) null);
              event.entityLiving.worldObj.removeEntity(event.entityLiving);
              ghoul.setGhoulType(0);
              event.entityLiving.worldObj.spawnEntityInWorld(ghoul);
            }
          }
        }
      }
    }
    if (event.entityLiving.isPotionActive(AbyssalCraft.Dplague)) {
      if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {
        event.entityLiving.attackEntityFrom(DamageSource.magic, 1);
        if (event.entityLiving instanceof DreadMob) {
          event.entityLiving.removePotionEffect(AbyssalCraft.Dplague.id);
        }
      }
    }
  }
Пример #2
0
 protected ResourceLocation getGhoulTexture(EntityDepthsghoul par1EntityLiving) {
   switch (par1EntityLiving.getGhoulType()) {
     case 0:
       defaultResource = ghoulResource;
       break;
     case 1:
       defaultResource = peteResource;
       break;
     case 2:
       defaultResource = wilsonResource;
       break;
     case 3:
       defaultResource = orangeResource;
   }
   return defaultResource;
 }