コード例 #1
0
ファイル: EntityZombie.java プロジェクト: ppypp/CanaryMod
 protected void a(int i0) {
   this.bm = i0;
   this.H().b(14, Byte.valueOf((byte) 1));
   this.m(Potion.t.H);
   this.c(new PotionEffect(Potion.g.H, i0, Math.min(this.o.aa().a() - 1, 0)));
   this.o.a((Entity) this, (byte) 16);
 }
コード例 #2
0
ファイル: EntityZombie.java プロジェクト: ppypp/CanaryMod
  public void m() {
    if (this.o.w() && !this.o.D && !this.i_()) {
      float f0 = this.c(1.0F);
      BlockPos blockpos = new BlockPos(this.s, (double) Math.round(this.t), this.u);

      if (f0 > 0.5F && this.V.nextFloat() * 30.0F < (f0 - 0.4F) * 2.0F && this.o.i(blockpos)) {
        boolean flag0 = true;
        ItemStack itemstack = this.p(4);

        if (itemstack != null) {
          if (itemstack.e()) {
            itemstack.b(itemstack.h() + this.V.nextInt(2));
            if (itemstack.h() >= itemstack.j()) {
              this.b(itemstack);
              this.c(4, (ItemStack) null);
            }
          }

          flag0 = false;
        }

        if (flag0) {
          this.e(8);
        }
      }
    }

    if (this.av() && this.u() != null && this.m instanceof EntityChicken) {
      ((EntityLiving) this.m).s().a(this.s().j(), 1.5D);
    }

    super.m();
  }
コード例 #3
0
 @Override
 public void readEntityFromNBT(NBTTagCompound nbt) {
   super.readEntityFromNBT(nbt);
   this.fuseTicks = nbt.getShort("Fuse");
   if (nbt.hasKey("ex")) {
     ex = ExplosiveRegistry.get(nbt.getString("ex"));
     ex_size = Math.max(nbt.getDouble("size"), 1.0);
     if (nbt.hasKey("ex_data")) ex_data = nbt.getCompoundTag("ex_data");
   }
 }
コード例 #4
0
  @Override
  public void attackEntityWithRangedAttack(EntityLivingBase var1, float var2) {
    EntityArrow entityarrow =
        new EntityArrow(
            this.worldObj, this, var1, Math.max(1F, getDistanceToEntity(var1) / 10F), 1);
    entityarrow.posX = this.posX;
    entityarrow.posY = this.posY + this.getEyeHeight();
    entityarrow.posZ = this.posZ;

    int power =
        EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());
    int punch =
        EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());
    double damage = (double) (var2 * 3.0F) + this.rand.nextGaussian() * 0.25D;
    entityarrow.setDamage(damage);

    if (power > 0) entityarrow.setDamage(entityarrow.getDamage() + (double) power * 0.5D + 0.5D);
    if (punch > 0) entityarrow.setKnockbackStrength(punch);
    if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0)
      entityarrow.setFire(100);

    this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.worldObj.spawnEntityInWorld(entityarrow);
  }