Ejemplo n.º 1
0
  /** Called when a player damages a block and updates damage counters */
  public void onPlayerDamageBlock(int par1, int par2, int par3, int par4) {
    syncCurrentPlayItem();

    if (blockHitDelay > 0) {
      blockHitDelay--;
      return;
    }

    if (creativeMode) {
      /** VANITY * */
      blockHitDelay = Vanity.speedmine ? 0 : 5;
      netClientHandler.addToSendQueue(new Packet14BlockDig(0, par1, par2, par3, par4));
      PlayerControllerCreative.clickBlockCreative(mc, this, par1, par2, par3, par4);
      return;
    }

    if (par1 == currentBlockX && par2 == currentBlockY && par3 == currentblockZ) {
      int i = mc.theWorld.getBlockId(par1, par2, par3);

      if (i == 0) {
        isHittingBlock = false;
        return;
      }

      Block block = Block.blocksList[i];
      /** VANITY * */
      if (Vanity.freecam) {
        curBlockDamageMP = 1.0F;
      }
      curBlockDamageMP += block.blockStrength(mc.thePlayer);

      if (stepSoundTickCounter % 4F == 0.0F && block != null) {
        mc.sndManager.playSound(
            block.stepSound.getStepSound(),
            (float) par1 + 0.5F,
            (float) par2 + 0.5F,
            (float) par3 + 0.5F,
            (block.stepSound.getVolume() + 1.0F) / 8F,
            block.stepSound.getPitch() * 0.5F);
      }

      stepSoundTickCounter++;
      /** VANITY * */
      if (curBlockDamageMP >= (Vanity.speedmine ? 0.65F : 1.0F)) {
        isHittingBlock = false;
        netClientHandler.addToSendQueue(new Packet14BlockDig(2, par1, par2, par3, par4));
        onPlayerDestroyBlock(par1, par2, par3, par4);
        curBlockDamageMP = 0.0F;
        prevBlockDamageMP = 0.0F;
        stepSoundTickCounter = 0.0F;
        blockHitDelay = Vanity.speedmine ? 0 : 5;
      }
    } else {
      clickBlock(par1, par2, par3, par4);
    }
  }
  /** Called when a player damages a block and updates damage counters */
  public void onPlayerDamageBlock(int par1, int par2, int par3, int par4) {
    this.syncCurrentPlayItem();

    if (this.blockHitDelay > 0) {
      --this.blockHitDelay;
    } else if (this.creativeMode) {
      this.blockHitDelay = 5;
      this.netClientHandler.addToSendQueue(new Packet14BlockDig(0, par1, par2, par3, par4));
      PlayerControllerCreative.clickBlockCreative(this.mc, this, par1, par2, par3, par4);
    } else {
      if (par1 == this.currentBlockX && par2 == this.currentBlockY && par3 == this.currentblockZ) {
        int var5 = this.mc.theWorld.getBlockId(par1, par2, par3);

        if (var5 == 0) {
          this.isHittingBlock = false;
          return;
        }

        Block var6 = Block.blocksList[var5];
        this.curBlockDamageMP += var6.blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3);

        if (this.stepSoundTickCounter % 4.0F == 0.0F && var6 != null) {
          this.mc.sndManager.playSound(
              var6.stepSound.getStepSound(),
              (float) par1 + 0.5F,
              (float) par2 + 0.5F,
              (float) par3 + 0.5F,
              (var6.stepSound.getVolume() + 1.0F) / 8.0F,
              var6.stepSound.getPitch() * 0.5F);
        }

        ++this.stepSoundTickCounter;

        if (this.curBlockDamageMP >= 1.0F) {
          this.isHittingBlock = false;
          this.netClientHandler.addToSendQueue(new Packet14BlockDig(2, par1, par2, par3, par4));
          this.onPlayerDestroyBlock(par1, par2, par3, par4);
          this.curBlockDamageMP = 0.0F;
          this.prevBlockDamageMP = 0.0F;
          this.stepSoundTickCounter = 0.0F;
          this.blockHitDelay = 5;
        }
      } else {
        this.clickBlock(par1, par2, par3, par4);
      }
    }
  }
 public void func_328_a() {
   field_22051_j++;
   if (field_22050_k) {
     int i = field_22051_j - field_22046_o;
     int j = thisWorld.getBlockId(field_22049_l, field_22048_m, field_22047_n);
     if (j != 0) {
       Block block = Block.blocksList[j];
       float f = block.blockStrength(thisPlayer) * (float) (i + 1);
       if (f >= 1.0F) {
         field_22050_k = false;
         func_325_c(field_22049_l, field_22048_m, field_22047_n);
       }
     } else {
       field_22050_k = false;
     }
   }
 }
 public void func_22045_b(int i, int j, int k) {
   if (i == field_22054_g && j == field_22053_h && k == field_22052_i) {
     int l = field_22051_j - field_22055_d;
     int i1 = thisWorld.getBlockId(i, j, k);
     if (i1 != 0) {
       Block block = Block.blocksList[i1];
       float f = block.blockStrength(thisPlayer) * (float) (l + 1);
       if (f >= 0.7F) {
         func_325_c(i, j, k);
       } else if (!field_22050_k) {
         field_22050_k = true;
         field_22049_l = i;
         field_22048_m = j;
         field_22047_n = k;
         field_22046_o = field_22055_d;
       }
     }
   }
   field_672_d = 0.0F;
 }