public static boolean removeModifier(
     EntityLivingBase entity, IAttribute attribute, AttributeModifier modifier) {
   if (entity.getEntityAttribute(attribute).getModifier(modifier.getID()) != null) {
     entity.getEntityAttribute(attribute).removeModifier(modifier);
     return true;
   } else return false;
 }
Пример #2
0
  public void upgradeMob(EntityLivingBase mob) {
    int diff = mob.worldObj.difficultySetting.getDifficultyId();

    if (ConfigHardcore.upgradeZombieWep) {
      if (mob instanceof EntitySkeleton) {
        if (((EntitySkeleton) mob).getSkeletonType() == 1) {
          giveEntityWeapon(mob, 5, rand.nextInt(7));
        }
      }
      if (mob instanceof EntityZombie) {
        int tier = 2;
        if (mob instanceof EntityPigZombie) {
          tier = 7;
          giveEntityWeapon(mob, tier, rand.nextInt(4));
        } else {
          if (mob.getHeldItem() != null && mob.getHeldItem().getItem() == Items.iron_sword) {
            giveEntityWeapon(mob, tier, 0);
          } else {
            if (rand.nextFloat() * (zombieWepChance * ConfigHardcore.zombieWepChance) < diff) {
              giveEntityWeapon(mob, tier, rand.nextInt(4));
            }
          }
        }
        if (rand.nextFloat() * (zombieKnightChance * ConfigHardcore.zombieWepChance) < diff) {
          createZombieKnight((EntityZombie) mob);
        } else if (rand.nextFloat() * (zombieBruteChance * ConfigHardcore.zombieWepChance) < diff) {
          createZombieBrute((EntityZombie) mob);
        }
      }
    }
    if (mob instanceof EntitySpider) {
      if (mob.riddenByEntity == null) {
        if (rand.nextFloat() * (skeletalRiderChance * ConfigHardcore.zombieWepChance) < diff) {
          EntitySkeleton rider = new EntitySkeleton(mob.worldObj);
          rider.setPosition(mob.posX, mob.posY, mob.posZ);
          mob.worldObj.spawnEntityInWorld(rider);
          rider.setCurrentItemOrArmor(0, new ItemStack(ToolListMF.lances[2]));
          rider.mountEntity(mob);
          mob.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(64.0D);
          mob.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, Integer.MAX_VALUE, 10));
        } else if (rand.nextFloat() * (witchRiderChance * ConfigHardcore.zombieWepChance) < diff) {
          EntityWitch rider = new EntityWitch(mob.worldObj);
          rider.setPosition(mob.posX, mob.posY, mob.posZ);
          mob.worldObj.spawnEntityInWorld(rider);
          rider.mountEntity(mob);
        } else if (rand.nextFloat() * (creeperJockeyChance * ConfigHardcore.zombieWepChance)
            < diff) {
          EntityCreeper rider = new EntityCreeper(mob.worldObj);
          rider.setPosition(mob.posX, mob.posY, mob.posZ);
          mob.worldObj.spawnEntityInWorld(rider);
          rider.mountEntity(mob);
        }
      }
    }
  }
 public static boolean hasModifier(
     EntityLivingBase entity, IAttribute attribute, AttributeModifier modifier) {
   return entity.getEntityAttribute(attribute).getModifier(modifier.getID()) != null;
 }
 public static double getValue(EntityLivingBase entity, IAttribute attribute) {
   return entity.getEntityAttribute(attribute).getAttributeValue();
 }
 public static void setValue(EntityLivingBase entity, IAttribute attribute, double baseValue) {
   entity.getEntityAttribute(attribute).setBaseValue(baseValue);
 }
Пример #6
0
 public static float getMcBonusDmg(EntityLivingBase entity) {
   IAttributeInstance attackDamage =
       entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
   return (float) Math.max(attackDamage.getAttributeValue() - attackDamage.getBaseValue(), 0);
 }
Пример #7
0
 public static float getAttackCooldown(EntityLivingBase entity) {
   IAttributeInstance attr = entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED);
   double val = null != attr ? attr.getAttributeValue() : 4;
   return (float) (1 / val * 20);
 }