    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.util.Random;
    006
    007    public class BlockLockedChest extends Block
    008    {
    009        protected BlockLockedChest(int par1)
    010        {
    011            super(par1, Material.wood);
    012            this.blockIndexInTexture = 26;
    013        }
    014
    015        @SideOnly(Side.CLIENT)
    016
    017        /**
    018         * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
    019         */
    020        public int getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
    021        {
    022            if (par5 == 1)
    023            {
    024                return this.blockIndexInTexture - 1;
    025            }
    026            else if (par5 == 0)
    027            {
    028                return this.blockIndexInTexture - 1;
    029            }
    030            else
    031            {
    032                int var6 = par1IBlockAccess.getBlockId(par2, par3, par4 - 1);
    033                int var7 = par1IBlockAccess.getBlockId(par2, par3, par4 + 1);
    034                int var8 = par1IBlockAccess.getBlockId(par2 - 1, par3, par4);
    035                int var9 = par1IBlockAccess.getBlockId(par2 + 1, par3, par4);
    036                byte var10 = 3;
    037
    038                if (Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var7])
    039                {
    040                    var10 = 3;
    041                }
    042
    043                if (Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var6])
    044                {
    045                    var10 = 2;
    046                }
    047
    048                if (Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var9])
    049                {
    050                    var10 = 5;
    051                }
    052
    053                if (Block.opaqueCubeLookup[var9] && !Block.opaqueCubeLookup[var8])
    054                {
    055                    var10 = 4;
    056                }
    057
    058                return par5 == var10 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture;
    059            }
    060        }
    061
    062        /**
    063         * Returns the block texture based on the side being looked at.  Args: side
    064         */
    065        public int getBlockTextureFromSide(int par1)
    066        {
    067            return par1 == 1 ? this.blockIndexInTexture - 1 : (par1 == 0 ? this.blockIndexInTexture - 1 : (par1 == 3 ? this.blockIndexInTexture + 1 : this.blockIndexInTexture));
    068        }
    069
    070        /**
    071         * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
    072         */
    073        public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
    074        {
    075            return true;
    076        }
    077
    078        /**
    079         * Ticks the block if it's been scheduled
    080         */
    081        public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
    082        {
    083            par1World.setBlockWithNotify(par2, par3, par4, 0);
    084        }
    085    }