001package net.minecraft.block; 002 003import cpw.mods.fml.relauncher.Side; 004import cpw.mods.fml.relauncher.SideOnly; 005import net.minecraft.block.material.Material; 006import net.minecraft.client.renderer.texture.IconRegister; 007import net.minecraft.world.IBlockAccess; 008 009public class BlockBreakable extends Block 010{ 011 private boolean localFlag; 012 private String breakableBlockIcon; 013 014 protected BlockBreakable(int par1, String par2Str, Material par3Material, boolean par4) 015 { 016 super(par1, par3Material); 017 this.localFlag = par4; 018 this.breakableBlockIcon = par2Str; 019 } 020 021 /** 022 * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two 023 * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. 024 */ 025 public boolean isOpaqueCube() 026 { 027 return false; 028 } 029 030 @SideOnly(Side.CLIENT) 031 032 /** 033 * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given 034 * coordinates. Args: blockAccess, x, y, z, side 035 */ 036 public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) 037 { 038 int i1 = par1IBlockAccess.getBlockId(par2, par3, par4); 039 return !this.localFlag && i1 == this.blockID ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); 040 } 041 042 @SideOnly(Side.CLIENT) 043 044 /** 045 * When this method is called, your block should register all the icons it needs with the given IconRegister. This 046 * is the only chance you get to register icons. 047 */ 048 public void registerIcons(IconRegister par1IconRegister) 049 { 050 this.blockIcon = par1IconRegister.registerIcon(this.breakableBlockIcon); 051 } 052}