    001    package net.minecraft.src;
    002
    003    public class BlockCommandBlock extends BlockContainer
    004    {
    005        public BlockCommandBlock(int par1)
    006        {
    007            super(par1, 184, Material.iron);
    008        }
    009
    010        /**
    011         * Returns a new instance of a block's tile entity class. Called on placing the block.
    012         */
    013        public TileEntity createNewTileEntity(World par1World)
    014        {
    015            return new TileEntityCommandBlock();
    016        }
    017
    018        /**
    019         * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
    020         * their own) Args: x, y, z, neighbor blockID
    021         */
    022        public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
    023        {
    024            if (!par1World.isRemote)
    025            {
    026                boolean var6 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4);
    027                int var7 = par1World.getBlockMetadata(par2, par3, par4);
    028                boolean var8 = (var7 & 1) != 0;
    029
    030                if (var6 && !var8)
    031                {
    032                    TileEntity var9 = par1World.getBlockTileEntity(par2, par3, par4);
    033
    034                    if (var9 != null && var9 instanceof TileEntityCommandBlock)
    035                    {
    036                        ((TileEntityCommandBlock)var9).func_82351_a(par1World);
    037                    }
    038
    039                    par1World.setBlockMetadata(par2, par3, par4, var7 | 1);
    040                }
    041                else if (!var6 && var8)
    042                {
    043                    par1World.setBlockMetadata(par2, par3, par4, var7 & -2);
    044                }
    045            }
    046        }
    047
    048        /**
    049         * Called upon block activation (right click on the block.)
    050         */
    051        public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
    052        {
    053            TileEntityCommandBlock var10 = (TileEntityCommandBlock)par1World.getBlockTileEntity(par2, par3, par4);
    054
    055            if (var10 != null)
    056            {
    057                par5EntityPlayer.displayGUIEditSign(var10);
    058            }
    059
    060            return true;
    061        }
    062    }