/** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata */ public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) { int var3 = getDirectionMeta(par2); return par1 == var3 ? (this.headTexture != null ? this.headTexture : ((par2 & 8) != 0 ? BlockPistonBase.func_94496_b("piston_top_sticky") : BlockPistonBase.func_94496_b("piston_top"))) : (var3 < 6 && par1 == Facing.faceToSide[var3] ? BlockPistonBase.func_94496_b("piston_top") : BlockPistonBase.func_94496_b("piston_side")); }
/** Called when the block is placed in the world. */ public void onBlockPlacedBy( World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) { int var6 = par1World.getBlockMetadata(par2, par3, par4) & 3; int var7 = BlockPistonBase.determineOrientation( par1World, par2, par3, par4, (EntityPlayer) par5EntityLiving); byte var8 = 0; switch (var7) { case 0: case 1: var8 = 0; break; case 2: case 3: var8 = 8; break; case 4: case 5: var8 = 4; } par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 | var8); }
/** ejects contained items into the world, and notifies neighbours of an update, as appropriate */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { super.breakBlock(par1World, par2, par3, par4, par5, par6); int var7 = Facing.faceToSide[getDirectionMeta(par6)]; par2 += Facing.offsetsXForSide[var7]; par3 += Facing.offsetsYForSide[var7]; par4 += Facing.offsetsZForSide[var7]; int var8 = par1World.getBlockId(par2, par3, par4); if (var8 == Block.pistonBase.blockID || var8 == Block.pistonStickyBase.blockID) { par6 = par1World.getBlockMetadata(par2, par3, par4); if (BlockPistonBase.isExtended(par6)) { Block.blocksList[var8].dropBlockAsItem(par1World, par2, par3, par4, par6, 0); par1World.setBlockToAir(par2, par3, par4); } } }
public void func_56322_a(World par1World, int par2, int par3, int par4, int par5, int par6) { super.func_56322_a(par1World, par2, par3, par4, par5, par6); int i = Facing.faceToSide[getDirectionMeta(par6)]; par2 += Facing.offsetsXForSide[i]; par3 += Facing.offsetsYForSide[i]; par4 += Facing.offsetsZForSide[i]; int j = par1World.getBlockId(par2, par3, par4); if (j == Block.pistonBase.blockID || j == Block.pistonStickyBase.blockID) { par6 = par1World.getBlockMetadata(par2, par3, par4); if (BlockPistonBase.isExtended(par6)) { Block.blocksList[j].dropBlockAsItem(par1World, par2, par3, par4, par6, 0); par1World.setBlockWithNotify(par2, par3, par4, 0); } } }
/** Called whenever the block is removed. */ public void onBlockRemoval(World par1World, int par2, int par3, int par4) { super.onBlockRemoval(par1World, par2, par3, par4); int i = par1World.getBlockMetadata(par2, par3, par4); int k = Facing.faceToSide[getDirectionMeta(i)]; par2 += Facing.offsetsXForSide[k]; par3 += Facing.offsetsYForSide[k]; par4 += Facing.offsetsZForSide[k]; int l = par1World.getBlockId(par2, par3, par4); if (l == Block.pistonBase.blockID || l == Block.pistonStickyBase.blockID) { int j = par1World.getBlockMetadata(par2, par3, par4); if (BlockPistonBase.isExtended(j)) { Block.blocksList[l].dropBlockAsItem(par1World, par2, par3, par4, j, 0); par1World.setBlockWithNotify(par2, par3, par4, 0); } } }