package xyz.ibatv.iba_backblocks.blocks.mc18.base;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;

public class BaseBlocks extends Block 
{

	protected BaseBlocks(String UnlocalizedName, Material material, float hardness, float resistance)
	{
		super(material);
		this.setBlockName(UnlocalizedName);
		this.setHardness(hardness);
		this.setResistance(resistance);
	}
	
	@Override
	public String getUnlocalizedName()
	{
		return String.format("tile.%s%s","iba_backblocks:", getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
	}

	protected String getUnwrappedUnlocalizedName(String unlocalizedName)
	{
		return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1	);
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void registerBlockIcons(IIconRegister iconRegister)
	{
		blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName())));
	}
	
}
