コード例 #1
0
  public void func_70071_h_() {
    super.func_70071_h_();
    if (this.field_94106_a > 0) {
      --this.field_94106_a;
      this.field_70170_p.func_72869_a(
          "smoke",
          this.field_70165_t,
          this.field_70163_u + 0.5D,
          this.field_70161_v,
          0.0D,
          0.0D,
          0.0D);
    } else if (this.field_94106_a == 0) {
      this.func_94103_c(
          this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y);
    }

    if (this.field_70123_F) {
      double var1 =
          this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y;
      if (var1 >= 0.009999999776482582D) {
        this.func_94103_c(var1);
      }
    }
  }
コード例 #2
0
  protected void func_70069_a(float p_70069_1_) {
    if (p_70069_1_ >= 3.0F) {
      float var2 = p_70069_1_ / 10.0F;
      this.func_94103_c((double) (var2 * var2));
    }

    super.func_70069_a(p_70069_1_);
  }
コード例 #3
0
  public void func_94095_a(DamageSource p_94095_1_) {
    super.func_94095_a(p_94095_1_);
    double var2 = this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y;
    if (!p_94095_1_.func_94541_c()) {
      this.func_70099_a(new ItemStack(Block.field_72091_am, 1), 0.0F);
    }

    if (p_94095_1_.func_76347_k() || p_94095_1_.func_94541_c() || var2 >= 0.009999999776482582D) {
      this.func_94103_c(var2);
    }
  }
コード例 #4
0
 protected void func_70014_b(NBTTagCompound p_70014_1_) {
   super.func_70014_b(p_70014_1_);
   p_70014_1_.func_74768_a("TNTFuse", this.field_94106_a);
 }
コード例 #5
0
 protected void func_70037_a(NBTTagCompound p_70037_1_) {
   super.func_70037_a(p_70037_1_);
   if (p_70037_1_.func_74764_b("TNTFuse")) {
     this.field_94106_a = p_70037_1_.func_74762_e("TNTFuse");
   }
 }
コード例 #6
0
  /** Called when the entity is attacked. */
  public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) {
    if (worldObj.isRemote || isDead) {
      return true;
    }

    func_41016_d(-func_41021_q());
    func_41014_b(10);
    setBeenAttacked();
    func_41018_e_(func_41020_o() + par2 * 10);

    if (func_41020_o() > 40) {
      if (riddenByEntity != null) {
        riddenByEntity.mountEntity(this);
      }

      setEntityDead();
      dropItemWithOffset(Item.minecartEmpty.shiftedIndex, 1, 0.0F);

      if (minecartType == 1) {
        EntityMinecart entityminecart = this;
        label0:
        for (int i = 0; i < entityminecart.getSizeInventory(); i++) {
          ItemStack itemstack = entityminecart.getStackInSlot(i);

          if (itemstack == null) {
            continue;
          }

          float f = rand.nextFloat() * 0.8F + 0.1F;
          float f1 = rand.nextFloat() * 0.8F + 0.1F;
          float f2 = rand.nextFloat() * 0.8F + 0.1F;

          do {
            if (itemstack.stackSize <= 0) {
              continue label0;
            }

            int j = rand.nextInt(21) + 10;

            if (j > itemstack.stackSize) {
              j = itemstack.stackSize;
            }

            itemstack.stackSize -= j;
            EntityItem entityitem =
                new EntityItem(
                    worldObj,
                    posX + (double) f,
                    posY + (double) f1,
                    posZ + (double) f2,
                    new ItemStack(itemstack.itemID, j, itemstack.getItemDamage()));
            float f3 = 0.05F;
            entityitem.motionX = (float) rand.nextGaussian() * f3;
            entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F;
            entityitem.motionZ = (float) rand.nextGaussian() * f3;
            worldObj.spawnEntityInWorld(entityitem);
          } while (true);
        }

        dropItemWithOffset(Block.chest.blockID, 1, 0.0F);
      } else if (minecartType == 2) {
        dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F);
      }
    }

    return true;
  }
コード例 #7
0
  /** Called when the entity is attacked. */
  public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) {
    if (!this.worldObj.isRemote && !this.isDead) {
      if (this.func_85032_ar()) {
        return false;
      } else {
        this.func_70494_i(-this.func_70493_k());
        this.func_70497_h(10);
        this.setBeenAttacked();
        this.setDamage(this.getDamage() + par2 * 10);

        if (par1DamageSource.getEntity() instanceof EntityPlayer
            && ((EntityPlayer) par1DamageSource.getEntity()).capabilities.isCreativeMode) {
          this.setDamage(100);
        }

        if (this.getDamage() > 40) {
          if (this.riddenByEntity != null) {
            this.riddenByEntity.mountEntity(this);
          }

          this.setDead();
          this.dropItemWithOffset(Item.minecartEmpty.shiftedIndex, 1, 0.0F);

          if (this.minecartType == 1) {
            EntityMinecart var3 = this;

            for (int var4 = 0; var4 < var3.getSizeInventory(); ++var4) {
              ItemStack var5 = var3.getStackInSlot(var4);

              if (var5 != null) {
                float var6 = this.rand.nextFloat() * 0.8F + 0.1F;
                float var7 = this.rand.nextFloat() * 0.8F + 0.1F;
                float var8 = this.rand.nextFloat() * 0.8F + 0.1F;

                while (var5.stackSize > 0) {
                  int var9 = this.rand.nextInt(21) + 10;

                  if (var9 > var5.stackSize) {
                    var9 = var5.stackSize;
                  }

                  var5.stackSize -= var9;
                  EntityItem var10 =
                      new EntityItem(
                          this.worldObj,
                          this.posX + (double) var6,
                          this.posY + (double) var7,
                          this.posZ + (double) var8,
                          new ItemStack(var5.itemID, var9, var5.getItemDamage()));
                  float var11 = 0.05F;
                  var10.motionX = (double) ((float) this.rand.nextGaussian() * var11);
                  var10.motionY = (double) ((float) this.rand.nextGaussian() * var11 + 0.2F);
                  var10.motionZ = (double) ((float) this.rand.nextGaussian() * var11);
                  this.worldObj.spawnEntityInWorld(var10);
                }
              }
            }

            this.dropItemWithOffset(Block.chest.blockID, 1, 0.0F);
          } else if (this.minecartType == 2) {
            this.dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F);
          }
        }

        return true;
      }
    } else {
      return true;
    }
  }