/** * Called by Minecraft class when the player is hitting a block with an item. Args: x, y, z, side */ public void clickBlock(int par1, int par2, int par3, int par4) { if (Vanity.autotool) { this.autotool(par1, par2, par3); } if (creativeMode) { netClientHandler.addToSendQueue(new Packet14BlockDig(0, par1, par2, par3, par4)); PlayerControllerCreative.clickBlockCreative(mc, this, par1, par2, par3, par4); /** VANITY * */ blockHitDelay = Vanity.speedmine ? 0 : 5; } else if (!isHittingBlock || par1 != currentBlockX || par2 != currentBlockY || par3 != currentblockZ) { netClientHandler.addToSendQueue(new Packet14BlockDig(0, par1, par2, par3, par4)); int i = mc.theWorld.getBlockId(par1, par2, par3); if (i > 0 && curBlockDamageMP == 0.0F) { Block.blocksList[i].onBlockClicked(mc.theWorld, par1, par2, par3, mc.thePlayer); } if (i > 0 && Block.blocksList[i].blockStrength(mc.thePlayer) >= 1.0F) { onPlayerDestroyBlock(par1, par2, par3, par4); } else { isHittingBlock = true; currentBlockX = par1; currentBlockY = par2; currentblockZ = par3; curBlockDamageMP = 0.0F; prevBlockDamageMP = 0.0F; stepSoundTickCounter = 0.0F; } } }
/** * Called by Minecraft class when the player is hitting a block with an item. Args: x, y, z, side */ public void clickBlock(int par1, int par2, int par3, int par4) { if (this.creativeMode) { this.netClientHandler.addToSendQueue(new Packet14BlockDig(0, par1, par2, par3, par4)); PlayerControllerCreative.clickBlockCreative(this.mc, this, par1, par2, par3, par4); this.blockHitDelay = 5; } else if (!this.isHittingBlock || par1 != this.currentBlockX || par2 != this.currentBlockY || par3 != this.currentblockZ) { this.netClientHandler.addToSendQueue(new Packet14BlockDig(0, par1, par2, par3, par4)); int var5 = this.mc.theWorld.getBlockId(par1, par2, par3); if (var5 > 0 && this.curBlockDamageMP == 0.0F) { Block.blocksList[var5].onBlockClicked( this.mc.theWorld, par1, par2, par3, this.mc.thePlayer); } if (var5 > 0 && Block.blocksList[var5].blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3) >= 1.0F) { this.onPlayerDestroyBlock(par1, par2, par3, par4); } else { this.isHittingBlock = true; this.currentBlockX = par1; this.currentBlockY = par2; this.currentblockZ = par3; this.curBlockDamageMP = 0.0F; this.prevBlockDamageMP = 0.0F; this.stepSoundTickCounter = 0.0F; } } }
/** 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); } } }