@SuppressWarnings("unchecked")
 private void pop() {
   List<EntityLivingBase> ents =
       worldObj.getEntitiesWithinAABB(
           EntityLivingBase.class,
           AxisAlignedBB.getBoundingBox(
               xCoord + 1.0,
               yCoord + 1.0,
               zCoord + 1.0,
               xCoord + xLength - 1,
               yCoord + 3.0,
               zCoord + zLength - 1));
   for (EntityLivingBase ent : ents) {
     if (ent instanceof EntityPlayer) {
       EntityPlayerMP player = (EntityPlayerMP) ent;
       if (!player.capabilities.isCreativeMode) {
         player.playerNetServerHandler.sendPacket(
             new S12PacketEntityVelocity(
                 player.getEntityId(), 0.0, MathHelper.randomDoubleInRange(0.5, 2), 0.0));
       }
     } else {
       if (!ent.isDead) {
         ent.addVelocity(0.0, MathHelper.randomDoubleInRange(0.5, 2), 0);
       }
     }
   }
 }
예제 #2
0
 public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase player) {
   target.addVelocity(0, 1, 0);
   player.addPotionEffect(new PotionEffect(1, 10, 150));
   // EntityLightningBolt lightning = new EntityLightningBolt(target.worldObj, target.posX,
   // target.posY, target.posZ);
   // player.worldObj.addWeatherEffect(lightning);
   // target.worldObj.createExplosion(null, target.posX, target.posY, target.posZ, 4.0f, true);
   target.setFire(4);
   return true;
 }
예제 #3
0
  @Override
  public boolean hitEntity(
      ItemStack par1ItemStack,
      EntityLivingBase par2EntityLivingBase,
      EntityLivingBase par3EntityLivingBase) {
    if (par1ItemStack.getItem().equals(RioVItems.axeOfAunTun)) {
      par2EntityLivingBase.setFire(30);
    }

    if (par1ItemStack.getItem().equals(RioVItems.swordOfFlame)) {
      par2EntityLivingBase.setFire(10);
    }

    if (par1ItemStack.getItem().equals(RioVItems.daetoriSword)) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.wither.id, 100, 3));
    }

    if (par1ItemStack.getItem().equals(RioVItems.alerisSword)) {
      par2EntityLivingBase.motionY = 1;
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.kanuutu.effectId, par1ItemStack) == 2) {
      par2EntityLivingBase.motionY = 0.8;
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.kanuutu.effectId, par1ItemStack) == 1) {
      par2EntityLivingBase.motionY = 0.7;
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.frost.effectId, par1ItemStack) == 2) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 4));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.frost.effectId, par1ItemStack) == 1) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.venom.effectId, par1ItemStack) == 2) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.poison.id, 100, 4));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.venom.effectId, par1ItemStack) == 1) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.poison.id, 100, 2));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.confusion.effectId, par1ItemStack)
        == 2) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.wither.id, 100, 4));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.confusion.effectId, par1ItemStack)
        == 1) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.wither.id, 100, 2));
    }

    if (TheMistsOfRioV.getInstance().aether) {
      if (par1ItemStack.getItem().equals(RioVItems.infusedGravititeSword)) {
        if (par3EntityLivingBase != null
            && par3EntityLivingBase instanceof EntityPlayer
            && (par2EntityLivingBase.hurtTime > 0 || par2EntityLivingBase.deathTime > 0)) {
          par2EntityLivingBase.addVelocity(0.0D, 1.0D, 0.0D);
          par1ItemStack.damageItem(1, par3EntityLivingBase);
        }
      }
    }
    par1ItemStack.damageItem(1, par3EntityLivingBase);
    return true;
  }
  @Override
  public void updateTask() {
    EntityLivingBase entitylivingbase = attacker.getAttackTarget();
    attacker.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F);
    if ((longMemory && attacker.getHealth() <= 150
            || attacker.getEntitySenses().canSee(entitylivingbase))
        && --findAttemptCount <= 0
        && attacker.getHealth() <= 150) {
      findAttemptCount = failedPathFindingPenalty + 4 + attacker.getRNG().nextInt(7);
      attacker.getNavigator().tryMoveToEntityLiving(entitylivingbase, speedTowardsTarget);
      if (attacker.getNavigator().getPath() != null) {
        PathPoint finalPathPoint = attacker.getNavigator().getPath().getFinalPathPoint();
        if (finalPathPoint != null
            && entitylivingbase.getDistanceSq(
                    finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord)
                < 1D) failedPathFindingPenalty = 0;
        else failedPathFindingPenalty += 10;
      } else failedPathFindingPenalty += 10;
    }
    attackTick = Math.max(attackTick - 1, 0);
    double d0 = attacker.width * 1F * attacker.width * 1F + entitylivingbase.width;
    if (attacker.getDistanceSq(
            entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ)
        <= d0)
      if (attackTick <= 0) {
        attackTick = 10;
        attacker.attackEntityAsMob(entitylivingbase);
        entitylivingbase.attackEntityFrom(DamageSource.causeMobDamage(attacker), 4.0F);
        entitylivingbase.addVelocity(
            -MathHelper.sin(attacker.rotationYaw * 3.141593F / 180.0F) * 0.5F,
            0.1D,
            MathHelper.cos(attacker.rotationYaw * 3.141593F / 180.0F) * 0.5F);
      }

    if (attacker.getDistanceSq(
                entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ)
            > d0 + 1D
        && attacker.getDistanceSq(
                entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ)
            < d0 + 256.0D
        && attacker.getHealth() < 150)
      if (attackTick <= 0) {
        ++shouldDo;
        if (shouldDo == 1) attackTick = 40;
        else if (shouldDo <= 2) attackTick = 20;
        else {
          attackTick = 20;
          shouldDo = 0;
        }
        if (shouldDo == 1) {
          Vec3 look = attacker.getLookVec();
          double direction = Math.toRadians(attacker.renderYawOffset);
          EntityPoisonJet jet = new EntityPoisonJet(worldObj, attacker);
          jet.setPosition(
              attacker.posX + -Math.sin(direction) * 3.5D,
              attacker.posY + attacker.height * 0.5,
              attacker.posZ + Math.cos(direction) * 3.5D);
          jet.motionX = look.xCoord * 1.0;
          jet.motionY = look.yCoord * 2.2;
          jet.motionZ = look.zCoord * 1.0;
          worldObj.spawnEntityInWorld(jet);
        }
      }

    if (attacker.getDistanceSq(
                entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ)
            > d0 + 9D
        && attacker.getDistanceSq(
                entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ)
            < d0 + 256.0D
        && attacker.getHealth() > 150) {
      if (attackTick <= 0) {
        ++shouldDo;
        if (shouldDo == 1) attackTick = 200;
        else if (shouldDo <= 2) attackTick = 20;
        else {
          attackTick = 40;
          shouldDo = 0;
        }
        if (shouldDo == 1) {
          Vec3 look = attacker.getLookVec();
          double direction = Math.toRadians(attacker.renderYawOffset);
          EntityTarantulaEgg babyEgg = new EntityTarantulaEgg(worldObj, attacker);
          babyEgg.setPosition(
              attacker.posX + -Math.sin(direction) * 3.5D,
              attacker.posY + attacker.height,
              attacker.posZ + Math.cos(direction) * 3.5D);
          babyEgg.motionX = look.xCoord * 1.0;
          babyEgg.motionY = look.yCoord * 2.2;
          babyEgg.motionZ = look.zCoord * 1.0;
          worldObj.spawnEntityInWorld(babyEgg);
        }

        if (worldObj.rand.nextInt(3) == 1) {
          attackTick = 30;
          attacker.motionY = 0.61999998688697815D;
          jumpAttack = true;
        }
      }
      if (jumpAttack && attacker.motionY == -0.0784000015258789D) {
        areaOfEffect();
        ((EntityTarantulaMiniboss) attacker).spawnBlamParticles();
        jumpAttack = false;
      }
    }
  }