diff --git a/src/BlockFluid.java b/src/BlockFluid.java new file mode 100644 index 0000000..0b22c9f --- /dev/null +++ b/src/BlockFluid.java @@ -0,0 +1,258 @@ +package net.minecraft.src; + +import java.util.Random; + +public abstract class BlockFluid extends Block { + protected BlockFluid(int i1, Material material2) { + super(i1, (material2 == Material.lava ? 14 : 12) * 16 + 13, material2); + float f3 = 0.0F; + float f4 = 0.0F; + this.setBlockBounds(0.0F + f4, 0.0F + f3, 0.0F + f4, 1.0F + f4, 1.0F + f3, 1.0F + f4); + this.setTickOnLoad(true); + } + + public int colorMultiplier(IBlockAccess iBlockAccess1, int i2, int i3, int i4) { + return 0xFFFFFF; + } + + public static float getPercentAir(int i0) { + if(i0 >= 8) { + i0 = 0; + } + + float f1 = (float)(i0 + 1) / 9.0F; + return f1; + } + + public int getBlockTextureFromSide(int i1) { + return i1 != 0 && i1 != 1 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture; + } + + protected int getFlowDecay(World world1, int i2, int i3, int i4) { + return world1.getBlockMaterial(i2, i3, i4) != this.blockMaterial ? -1 : world1.getBlockMetadata(i2, i3, i4); + } + + protected int getEffectiveFlowDecay(IBlockAccess iBlockAccess1, int i2, int i3, int i4) { + if(iBlockAccess1.getBlockMaterial(i2, i3, i4) != this.blockMaterial) { + return -1; + } else { + int i5 = iBlockAccess1.getBlockMetadata(i2, i3, i4); + if(i5 >= 8) { + i5 = 0; + } + + return i5; + } + } + + public boolean renderAsNormalBlock() { + return false; + } + + public boolean isOpaqueCube() { + return false; + } + + public boolean canCollideCheck(int i1, boolean z2) { + //return purity.jesus ? true : z2 && i1 == 0; + return z2 && i1 == 0; + } + + public boolean getIsBlockSolid(IBlockAccess iBlockAccess1, int i2, int i3, int i4, int i5) { + Material material6 = iBlockAccess1.getBlockMaterial(i2, i3, i4); + return material6 == this.blockMaterial ? false : (material6 == Material.ice ? false : (i5 == 1 ? true : super.getIsBlockSolid(iBlockAccess1, i2, i3, i4, i5))); + } + + public boolean shouldSideBeRendered(IBlockAccess iBlockAccess1, int i2, int i3, int i4, int i5) { + Material material6 = iBlockAccess1.getBlockMaterial(i2, i3, i4); + return material6 == this.blockMaterial ? false : (material6 == Material.ice ? false : (i5 == 1 ? true : super.shouldSideBeRendered(iBlockAccess1, i2, i3, i4, i5))); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world1, int i2, int i3, int i4) { + return purity.jesus ? super.getCollisionBoundingBoxFromPool(world1, i2, i3, i4) : null; + //return null; + } + + public int getRenderType() { + return 4; + } + + public int idDropped(int i1, Random random2) { + return 0; + } + + public int quantityDropped(Random random1) { + return 0; + } + + private Vec3D getFlowVector(IBlockAccess iBlockAccess1, int i2, int i3, int i4) { + Vec3D vec3D5 = Vec3D.createVector(0.0D, 0.0D, 0.0D); + int i6 = this.getEffectiveFlowDecay(iBlockAccess1, i2, i3, i4); + + for(int i7 = 0; i7 < 4; ++i7) { + int i8 = i2; + int i10 = i4; + if(i7 == 0) + i8 = i2 - 1; + else if(i7 == 1) + i10 = i4 - 1; + else if(i7 == 2) + ++i8; + else if(i7 == 3) + ++i10; + + int i11 = this.getEffectiveFlowDecay(iBlockAccess1, i8, i3, i10); + int i12; + if(i11 < 0) { + if(!iBlockAccess1.getBlockMaterial(i8, i3, i10).getIsSolid()) { + i11 = this.getEffectiveFlowDecay(iBlockAccess1, i8, i3 - 1, i10); + if(i11 >= 0) { + i12 = i11 - (i6 - 8); + vec3D5 = vec3D5.addVector((double)((i8 - i2) * i12), (double)((i3 - i3) * i12), (double)((i10 - i4) * i12)); + } + } + } else if(i11 >= 0) { + i12 = i11 - i6; + vec3D5 = vec3D5.addVector((double)((i8 - i2) * i12), (double)((i3 - i3) * i12), (double)((i10 - i4) * i12)); + } + } + + if(iBlockAccess1.getBlockMetadata(i2, i3, i4) >= 8) { + boolean z13 = false; + if(z13 || this.getIsBlockSolid(iBlockAccess1, i2, i3, i4 - 1, 2)) + z13 = true; + else if(z13 || this.getIsBlockSolid(iBlockAccess1, i2, i3, i4 + 1, 3)) + z13 = true; + else if(z13 || this.getIsBlockSolid(iBlockAccess1, i2 - 1, i3, i4, 4)) + z13 = true; + else if(z13 || this.getIsBlockSolid(iBlockAccess1, i2 + 1, i3, i4, 5)) + z13 = true; + else if(z13 || this.getIsBlockSolid(iBlockAccess1, i2, i3 + 1, i4 - 1, 2)) + z13 = true; + else if(z13 || this.getIsBlockSolid(iBlockAccess1, i2, i3 + 1, i4 + 1, 3)) + z13 = true; + else if(z13 || this.getIsBlockSolid(iBlockAccess1, i2 - 1, i3 + 1, i4, 4)) + z13 = true; + else if(z13 || this.getIsBlockSolid(iBlockAccess1, i2 + 1, i3 + 1, i4, 5)) + z13 = true; + + if(z13) { + vec3D5 = vec3D5.normalize().addVector(0.0D, -6.0D, 0.0D); + } + } + + vec3D5 = vec3D5.normalize(); + return vec3D5; + } + + public void velocityToAddToEntity(World world1, int i2, int i3, int i4, Entity entity5, Vec3D vec3D6) { + Vec3D vec3D7 = this.getFlowVector(world1, i2, i3, i4); + vec3D6.xCoord += vec3D7.xCoord; + vec3D6.yCoord += vec3D7.yCoord; + vec3D6.zCoord += vec3D7.zCoord; + } + + public int tickRate() { + return this.blockMaterial == Material.water ? 5 : (this.blockMaterial == Material.lava ? 30 : 0); + } + + public float getBlockBrightness(IBlockAccess iBlockAccess1, int i2, int i3, int i4) { + float f5 = iBlockAccess1.getLightBrightness(i2, i3, i4); + float f6 = iBlockAccess1.getLightBrightness(i2, i3 + 1, i4); + return f5 > f6 ? f5 : f6; + } + + public void updateTick(World world1, int i2, int i3, int i4, Random random5) { + super.updateTick(world1, i2, i3, i4, random5); + } + + public int getRenderBlockPass() { + return this.blockMaterial == Material.water ? 1 : 0; + } + + public void randomDisplayTick(World world1, int i2, int i3, int i4, Random random5) { + if(this.blockMaterial == Material.water && random5.nextInt(64) == 0) { + int i6 = world1.getBlockMetadata(i2, i3, i4); + if(i6 > 0 && i6 < 8) { + world1.playSoundEffect((double)((float)i2 + 0.5F), (double)((float)i3 + 0.5F), (double)((float)i4 + 0.5F), "liquid.water", random5.nextFloat() * 0.25F + 0.75F, random5.nextFloat() * 1.0F + 0.5F); + } + } + + if(this.blockMaterial == Material.lava && world1.getBlockMaterial(i2, i3 + 1, i4) == Material.air && !world1.isBlockOpaqueCube(i2, i3 + 1, i4) && random5.nextInt(100) == 0) { + double d12 = (double)((float)i2 + random5.nextFloat()); + double d8 = (double)i3 + this.maxY; + double d10 = (double)((float)i4 + random5.nextFloat()); + world1.spawnParticle("lava", d12, d8, d10, 0.0D, 0.0D, 0.0D); + } + + } + + public static double func_293_a(IBlockAccess iBlockAccess0, int i1, int i2, int i3, Material material4) { + Vec3D vec3D5 = null; + if(material4 == Material.water) { + vec3D5 = ((BlockFluid)Block.waterMoving).getFlowVector(iBlockAccess0, i1, i2, i3); + } + + if(material4 == Material.lava) { + vec3D5 = ((BlockFluid)Block.lavaMoving).getFlowVector(iBlockAccess0, i1, i2, i3); + } + + return vec3D5.xCoord == 0.0D && vec3D5.zCoord == 0.0D ? -1000.0D : Math.atan2(vec3D5.zCoord, vec3D5.xCoord) - Math.PI / 2D; + } + + public void onBlockAdded(World world1, int i2, int i3, int i4) { + this.checkForHarden(world1, i2, i3, i4); + } + + public void onNeighborBlockChange(World world1, int i2, int i3, int i4, int i5) { + this.checkForHarden(world1, i2, i3, i4); + } + + private void checkForHarden(World world1, int i2, int i3, int i4) { + if(world1.getBlockId(i2, i3, i4) == this.blockID) { + if(this.blockMaterial == Material.lava) { + boolean z5 = false; + if(z5 || world1.getBlockMaterial(i2, i3, i4 - 1) == Material.water) { + z5 = true; + } + + if(z5 || world1.getBlockMaterial(i2, i3, i4 + 1) == Material.water) { + z5 = true; + } + + if(z5 || world1.getBlockMaterial(i2 - 1, i3, i4) == Material.water) { + z5 = true; + } + + if(z5 || world1.getBlockMaterial(i2 + 1, i3, i4) == Material.water) { + z5 = true; + } + + if(z5 || world1.getBlockMaterial(i2, i3 + 1, i4) == Material.water) { + z5 = true; + } + + if(z5) { + int i6 = world1.getBlockMetadata(i2, i3, i4); + if(i6 == 0) { + world1.setBlockWithNotify(i2, i3, i4, Block.obsidian.blockID); + } else if(i6 <= 4) { + world1.setBlockWithNotify(i2, i3, i4, Block.cobblestone.blockID); + } + + this.triggerLavaMixEffects(world1, i2, i3, i4); + } + } + + } + } + + protected void triggerLavaMixEffects(World world1, int i2, int i3, int i4) { + world1.playSoundEffect((double)((float)i2 + 0.5F), (double)((float)i3 + 0.5F), (double)((float)i4 + 0.5F), "random.fizz", 0.5F, 2.6F + (world1.rand.nextFloat() - world1.rand.nextFloat()) * 0.8F); + + for(int i5 = 0; i5 < 8; ++i5) { + world1.spawnParticle("largesmoke", (double)i2 + Math.random(), (double)i3 + 1.2D, (double)i4 + Math.random(), 0.0D, 0.0D, 0.0D); + } + + } +} diff --git a/src/EntityPlayerSP.java b/src/EntityPlayerSP.java index 41d53ad..a5fbae0 100644 --- a/src/EntityPlayerSP.java +++ b/src/EntityPlayerSP.java @@ -96,15 +96,18 @@ public void handleKeyPress(int i1, boolean z2) { this.movementInput.checkKeyForMovementInput(i1, z2); if(!z2) { - if(i1 == Keyboard.KEY_N) { + if(i1 == Keyboard.KEY_N) purity.no_fall = !purity.no_fall; - } else if(i1 == Keyboard.KEY_X){ + else if(i1 == Keyboard.KEY_X) purity.speed = !purity.speed; - } else if(i1 == Keyboard.KEY_U) { + else if(i1 == Keyboard.KEY_U) purity.no_knockback = !purity.no_knockback; - } else if(i1 == Keyboard.KEY_P) { + else if(i1 == Keyboard.KEY_P) purity.step = !purity.step; - } + else if(i1 == Keyboard.KEY_L) + purity.fast_mine = !purity.fast_mine; + else if(i1 == Keyboard.KEY_J) + purity.jesus = !purity.jesus; } } diff --git a/src/GuiIngame.java b/src/GuiIngame.java index c9489e5..03a49a8 100644 --- a/src/GuiIngame.java +++ b/src/GuiIngame.java @@ -185,9 +185,11 @@ public void renderGameOverlay(float f1, boolean z2, int i3, int i4) { } else if(this.mc.inGameHasFocus) { fontRenderer8.drawStringWithShadow("purity " + purity.version, 2, 2, 0xFFFFFF); fontRenderer8.drawStringWithShadow("no knockback [u]", 2, 12, (purity.no_knockback ? 52224 : 0xFFFFFF)); - fontRenderer8.drawStringWithShadow("no fall [n]", 2, 22, (purity.no_fall ? 52224 : 0xFFFFFF)); - fontRenderer8.drawStringWithShadow("speed [x]", 2, 32, (purity.speed ? 52224 : 0xFFFFFF)); - fontRenderer8.drawStringWithShadow("step [p]", 2, 42, (purity.step ? 52224 : 0xFFFFFF)); + fontRenderer8.drawStringWithShadow("fast mine [l]", 2, 22, (purity.fast_mine ? 52224 : 0xFFFFFF)); + fontRenderer8.drawStringWithShadow("no fall [n]", 2, 32, (purity.no_fall ? 52224 : 0xFFFFFF)); + fontRenderer8.drawStringWithShadow("speed [x]", 2, 42, (purity.speed ? 52224 : 0xFFFFFF)); + fontRenderer8.drawStringWithShadow("jesus [j]", 2, 52, (purity.jesus ? 52224 : 0xFFFFFF)); + fontRenderer8.drawStringWithShadow("step [p]", 2, 62, (purity.step ? 52224 : 0xFFFFFF)); } if(this.recordPlayingUpFor > 0) { diff --git a/src/PlayerControllerMP.java b/src/PlayerControllerMP.java new file mode 100644 index 0000000..3e2b9d9 --- /dev/null +++ b/src/PlayerControllerMP.java @@ -0,0 +1,183 @@ +package net.minecraft.src; + +import net.minecraft.client.Minecraft; + +public class PlayerControllerMP extends PlayerController { + private int currentBlockX = -1; + private int currentBlockY = -1; + private int currentblockZ = -1; + private float curBlockDamageMP = 0.0F; + private float prevBlockDamageMP = 0.0F; + private float field_9441_h = 0.0F; + private int blockHitDelay = 0; + private boolean isHittingBlock = false; + private NetClientHandler netClientHandler; + private int currentPlayerItem = 0; + + public PlayerControllerMP(Minecraft minecraft1, NetClientHandler netClientHandler2) { + super(minecraft1); + this.netClientHandler = netClientHandler2; + } + + public void flipPlayer(EntityPlayer entityPlayer1) { + entityPlayer1.rotationYaw = -180.0F; + } + + public boolean sendBlockRemoved(int i1, int i2, int i3, int i4) { + int i5 = this.mc.theWorld.getBlockId(i1, i2, i3); + boolean z6 = super.sendBlockRemoved(i1, i2, i3, i4); + ItemStack itemStack7 = this.mc.thePlayer.getCurrentEquippedItem(); + if(itemStack7 != null) { + itemStack7.onDestroyBlock(i5, i1, i2, i3, this.mc.thePlayer); + if(itemStack7.stackSize == 0) { + itemStack7.func_1097_a(this.mc.thePlayer); + this.mc.thePlayer.destroyCurrentEquippedItem(); + } + } + + return z6; + } + + public void clickBlock(int i1, int i2, int i3, int i4) { + if(!this.isHittingBlock || i1 != this.currentBlockX || i2 != this.currentBlockY || i3 != this.currentblockZ) { + this.netClientHandler.addToSendQueue(new Packet14BlockDig(0, i1, i2, i3, i4)); + int i5 = this.mc.theWorld.getBlockId(i1, i2, i3); + if(i5 > 0 && this.curBlockDamageMP == 0.0F) { + Block.blocksList[i5].onBlockClicked(this.mc.theWorld, i1, i2, i3, this.mc.thePlayer); + } + + if(i5 > 0 && Block.blocksList[i5].blockStrength(this.mc.thePlayer) >= 1.0F) { + this.sendBlockRemoved(i1, i2, i3, i4); + } else { + this.isHittingBlock = true; + this.currentBlockX = i1; + this.currentBlockY = i2; + this.currentblockZ = i3; + this.curBlockDamageMP = 0.0F; + this.prevBlockDamageMP = 0.0F; + this.field_9441_h = 0.0F; + } + } + + } + + public void resetBlockRemoving() { + this.curBlockDamageMP = 0.0F; + this.isHittingBlock = false; + } + + public void sendBlockRemoving(int i1, int i2, int i3, int i4) { + if(this.isHittingBlock) { + this.syncCurrentPlayItem(); + if(this.blockHitDelay > 0) { + --this.blockHitDelay; + } else { + if(i1 == this.currentBlockX && i2 == this.currentBlockY && i3 == this.currentblockZ) { + int i5 = this.mc.theWorld.getBlockId(i1, i2, i3); + if(i5 == 0) { + this.isHittingBlock = false; + return; + } + + Block block6 = Block.blocksList[i5]; + this.curBlockDamageMP += block6.blockStrength(this.mc.thePlayer); + if(this.field_9441_h % 4.0F == 0.0F && block6 != null) { + this.mc.sndManager.playSound(block6.stepSound.func_1145_d(), (float)i1 + 0.5F, (float)i2 + 0.5F, (float)i3 + 0.5F, (block6.stepSound.getVolume() + 1.0F) / 8.0F, block6.stepSound.getPitch() * 0.5F); + } + + ++this.field_9441_h; + if(this.curBlockDamageMP >= (purity.fast_mine ? 0.7F : 1.0F)) { + this.isHittingBlock = false; + this.netClientHandler.addToSendQueue(new Packet14BlockDig(2, i1, i2, i3, i4)); + this.sendBlockRemoved(i1, i2, i3, i4); + this.curBlockDamageMP = 0.0F; + this.prevBlockDamageMP = 0.0F; + this.field_9441_h = 0.0F; + this.blockHitDelay = (purity.fast_mine ? 0 : 5); + } + } else { + this.clickBlock(i1, i2, i3, i4); + } + + } + } + } + + public void setPartialTime(float f1) { + if(this.curBlockDamageMP <= 0.0F) { + this.mc.ingameGUI.damageGuiPartialTime = 0.0F; + this.mc.renderGlobal.damagePartialTime = 0.0F; + } else { + float f2 = this.prevBlockDamageMP + (this.curBlockDamageMP - this.prevBlockDamageMP) * f1; + this.mc.ingameGUI.damageGuiPartialTime = f2; + this.mc.renderGlobal.damagePartialTime = f2; + } + + } + + public float getBlockReachDistance() { + return 4.0F; + } + + public void func_717_a(World world1) { + super.func_717_a(world1); + } + + public void updateController() { + this.syncCurrentPlayItem(); + this.prevBlockDamageMP = this.curBlockDamageMP; + this.mc.sndManager.playRandomMusicIfReady(); + } + + private void syncCurrentPlayItem() { + int i1 = this.mc.thePlayer.inventory.currentItem; + if(i1 != this.currentPlayerItem) { + this.currentPlayerItem = i1; + this.netClientHandler.addToSendQueue(new Packet16BlockItemSwitch(this.currentPlayerItem)); + } + + } + + public boolean sendPlaceBlock(EntityPlayer entityPlayer1, World world2, ItemStack itemStack3, int i4, int i5, int i6, int i7) { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet15Place(i4, i5, i6, i7, entityPlayer1.inventory.getCurrentItem())); + boolean z8 = super.sendPlaceBlock(entityPlayer1, world2, itemStack3, i4, i5, i6, i7); + return z8; + } + + public boolean sendUseItem(EntityPlayer entityPlayer1, World world2, ItemStack itemStack3) { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet15Place(-1, -1, -1, 255, entityPlayer1.inventory.getCurrentItem())); + boolean z4 = super.sendUseItem(entityPlayer1, world2, itemStack3); + return z4; + } + + public EntityPlayer createPlayer(World world1) { + return new EntityClientPlayerMP(this.mc, world1, this.mc.session, this.netClientHandler); + } + + public void attackEntity(EntityPlayer entityPlayer1, Entity entity2) { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet7UseEntity(entityPlayer1.entityId, entity2.entityId, 1)); + entityPlayer1.attackTargetEntityWithCurrentItem(entity2); + } + + public void interactWithEntity(EntityPlayer entityPlayer1, Entity entity2) { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet7UseEntity(entityPlayer1.entityId, entity2.entityId, 0)); + entityPlayer1.useCurrentItemOnEntity(entity2); + } + + public ItemStack func_27174_a(int i1, int i2, int i3, boolean z4, EntityPlayer entityPlayer5) { + short s6 = entityPlayer5.craftingInventory.func_20111_a(entityPlayer5.inventory); + ItemStack itemStack7 = super.func_27174_a(i1, i2, i3, z4, entityPlayer5); + this.netClientHandler.addToSendQueue(new Packet102WindowClick(i1, i2, i3, z4, itemStack7, s6)); + return itemStack7; + } + + public void func_20086_a(int i1, EntityPlayer entityPlayer2) { + if(i1 != -9999) { + ; + } + } +} diff --git a/src/purity.java b/src/purity.java index 2e729c6..2454771 100644 --- a/src/purity.java +++ b/src/purity.java @@ -3,10 +3,12 @@ import net.minecraft.client.Minecraft; public class purity { - public static String version = "0.1a"; + public static String version = "0.11a"; public static boolean no_knockback = true; + public static boolean fast_mine = true; public static boolean no_fall = true; + public static boolean jesus = true; public static boolean speed = true; public static boolean step = true; }