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