package net.tropicraft.block; import net.minecraft.block.BlockSandStone; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemBucket; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.tropicraft.info.TCInfo; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockPortalWall extends BlockSandStone { public BlockPortalWall() { this.setBlockUnbreakable(); this.setResistance(6000000.0F); this.setCreativeTab(null); } /** * @return The unlocalized block name */ @Override public String getUnlocalizedName() { return String.format("tile.%s%s", TCInfo.ICON_LOCATION, getActualName(super.getUnlocalizedName())); } /** * Get the true name of the block * @param unlocalizedName tile.%truename% * @return The actual name of the block, rather than tile.%truename% */ protected String getActualName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf('.') + 1); } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { return Blocks.sandstone.getIcon(side, 0); } @Override public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int doop, float doo, float doe, float doa) { if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemBucket) { return true; } return false; } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { } }