Esempio n. 1
0
  public void uncheckedTryHarvestBlock(int par1, int par2, int par3) {
    if (par1 == this.partiallyDestroyedBlockX
        && par2 == this.partiallyDestroyedBlockY
        && par3 == this.partiallyDestroyedBlockZ) {
      int var4 = this.curblockDamage - this.initialDamage;
      int var5 = this.theWorld.getBlockId(par1, par2, par3);

      if (var5 != 0) {
        Block var6 = Block.blocksList[var5];
        float var7 =
            var6.getPlayerRelativeBlockHardness(
                    this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3)
                * (float) (var4 + 1);

        if (var7 >= 0.7F) {
          this.isDestroyingBlock = false;
          this.theWorld.destroyBlockInWorldPartially(
              this.thisPlayerMP.entityId, par1, par2, par3, -1);
          this.tryHarvestBlock(par1, par2, par3);
        } else if (!this.receivedFinishDiggingPacket) {
          this.isDestroyingBlock = false;
          this.receivedFinishDiggingPacket = true;
          this.posX = par1;
          this.posY = par2;
          this.posZ = par3;
          this.field_73093_n = this.initialDamage;
        }
      }
    }
  }
  public void blockRemoving(int par1, int par2, int par3) {
    if (par1 == this.curBlockX && par2 == this.curBlockY && par3 == this.curBlockZ) {
      int var4 = this.curblockDamage - this.initialDamage;
      int var5 = this.theWorld.getBlockId(par1, par2, par3);

      if (var5 != 0) {
        Block var6 = Block.blocksList[var5];
        float var7 =
            var6.getPlayerRelativeBlockHardness(
                    this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3)
                * (float) (var4 + 1);

        if (var7 >= 0.7F) {
          this.field_73088_d = false;
          this.theWorld.destroyBlockInWorldPartially(
              this.thisPlayerMP.entityId, par1, par2, par3, -1);
          this.tryHarvestBlock(par1, par2, par3);
        } else if (!this.field_73097_j) {
          this.field_73088_d = false;
          this.field_73097_j = true;
          this.field_73098_k = par1;
          this.field_73095_l = par2;
          this.field_73096_m = par3;
          this.field_73093_n = this.initialDamage;
        }
      }
    }
  }
Esempio n. 3
0
  public void updateBlockRemoving() {
    ++this.curblockDamage;
    int var1;
    float var4;
    int var5;

    if (this.receivedFinishDiggingPacket) {
      var1 = this.curblockDamage - this.field_73093_n;
      int var2 = this.theWorld.getBlockId(this.posX, this.posY, this.posZ);

      if (var2 == 0) {
        this.receivedFinishDiggingPacket = false;
      } else {
        Block var3 = Block.blocksList[var2];
        var4 =
            var3.getPlayerRelativeBlockHardness(
                    this.thisPlayerMP, this.thisPlayerMP.worldObj, this.posX, this.posY, this.posZ)
                * (float) (var1 + 1);
        var5 = (int) (var4 * 10.0F);

        if (var5 != this.durabilityRemainingOnBlock) {
          this.theWorld.destroyBlockInWorldPartially(
              this.thisPlayerMP.entityId, this.posX, this.posY, this.posZ, var5);
          this.durabilityRemainingOnBlock = var5;
        }

        if (var4 >= 1.0F) {
          this.receivedFinishDiggingPacket = false;
          this.tryHarvestBlock(this.posX, this.posY, this.posZ);
        }
      }
    } else if (this.isDestroyingBlock) {
      var1 =
          this.theWorld.getBlockId(
              this.partiallyDestroyedBlockX,
              this.partiallyDestroyedBlockY,
              this.partiallyDestroyedBlockZ);
      Block var6 = Block.blocksList[var1];

      if (var6 == null) {
        this.theWorld.destroyBlockInWorldPartially(
            this.thisPlayerMP.entityId,
            this.partiallyDestroyedBlockX,
            this.partiallyDestroyedBlockY,
            this.partiallyDestroyedBlockZ,
            -1);
        this.durabilityRemainingOnBlock = -1;
        this.isDestroyingBlock = false;
      } else {
        int var7 = this.curblockDamage - this.initialDamage;
        var4 =
            var6.getPlayerRelativeBlockHardness(
                    this.thisPlayerMP,
                    this.thisPlayerMP.worldObj,
                    this.partiallyDestroyedBlockX,
                    this.partiallyDestroyedBlockY,
                    this.partiallyDestroyedBlockZ)
                * (float) (var7 + 1);
        var5 = (int) (var4 * 10.0F);

        if (var5 != this.durabilityRemainingOnBlock) {
          this.theWorld.destroyBlockInWorldPartially(
              this.thisPlayerMP.entityId,
              this.partiallyDestroyedBlockX,
              this.partiallyDestroyedBlockY,
              this.partiallyDestroyedBlockZ,
              var5);
          this.durabilityRemainingOnBlock = var5;
        }
      }
    }
  }
  public void updateBlockRemoving() {
    ++this.curblockDamage;
    int var1;
    float var4;
    int var5;

    if (this.field_73097_j) {
      var1 = this.curblockDamage - this.field_73093_n;
      int var2 =
          this.theWorld.getBlockId(this.field_73098_k, this.field_73095_l, this.field_73096_m);

      if (var2 == 0) {
        this.field_73097_j = false;
      } else {
        Block var3 = Block.blocksList[var2];
        var4 =
            var3.getPlayerRelativeBlockHardness(
                    this.thisPlayerMP,
                    this.thisPlayerMP.worldObj,
                    this.field_73098_k,
                    this.field_73095_l,
                    this.field_73096_m)
                * (float) (var1 + 1);
        var5 = (int) (var4 * 10.0F);

        if (var5 != this.field_73094_o) {
          this.theWorld.destroyBlockInWorldPartially(
              this.thisPlayerMP.entityId,
              this.field_73098_k,
              this.field_73095_l,
              this.field_73096_m,
              var5);
          this.field_73094_o = var5;
        }

        if (var4 >= 1.0F) {
          this.field_73097_j = false;
          this.tryHarvestBlock(this.field_73098_k, this.field_73095_l, this.field_73096_m);
        }
      }
    } else if (this.field_73088_d) {
      var1 = this.theWorld.getBlockId(this.curBlockX, this.curBlockY, this.curBlockZ);
      Block var6 = Block.blocksList[var1];

      if (var6 == null) {
        this.theWorld.destroyBlockInWorldPartially(
            this.thisPlayerMP.entityId, this.curBlockX, this.curBlockY, this.curBlockZ, -1);
        this.field_73094_o = -1;
        this.field_73088_d = false;
      } else {
        int var7 = this.curblockDamage - this.initialDamage;
        var4 =
            var6.getPlayerRelativeBlockHardness(
                    this.thisPlayerMP,
                    this.thisPlayerMP.worldObj,
                    this.curBlockX,
                    this.curBlockY,
                    this.curBlockZ)
                * (float) (var7 + 1);
        var5 = (int) (var4 * 10.0F);

        if (var5 != this.field_73094_o) {
          this.theWorld.destroyBlockInWorldPartially(
              this.thisPlayerMP.entityId, this.curBlockX, this.curBlockY, this.curBlockZ, var5);
          this.field_73094_o = var5;
        }
      }
    }
  }