package com.zivilon.cinder_loe.blocks;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;
import net.minecraft.block.BlockRotatedPillar;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
import net.minecraft.util.IIcon;
import net.minecraft.client.renderer.texture.IIconRegister;
import lotr.common.LOTRCreativeTabs;
import net.minecraft.creativetab.CreativeTabs;

import com.zivilon.cinder_loe.util.Utilities;

public abstract class StaticBlockBase3 extends Block {
    public String textureName;
    public IIcon[] icons = new IIcon[3];

    public StaticBlockBase3(Material material, String blockName) {
        super(material);
        this.textureName = Utilities.toSnakeCase(blockName);
        this.setBlockName(blockName);
        this.setCreativeTab((CreativeTabs)Utilities.reflected_tab_block);
    }

    @Override
    public IIcon getIcon(int side, int meta) {
        switch(side) {
            case 0: // Facing down
                return this.icons[0];
            case 1: // Facing up
                return this.icons[1];
            case 2: // Facing North
            case 3: // Facing South
            case 4: // Facing West
            case 5: // Facing East
                return this.icons[2];
        }

        return this.blockIcon;
    }

    @Override
    public void registerBlockIcons(IIconRegister reg) {
        icons[0] = reg.registerIcon(this.textureName + "_bottom");
        icons[1] = reg.registerIcon(this.textureName + "_top");
        icons[2] = reg.registerIcon(this.textureName + "_side");
    }
}
