package common.item.block;

import common.block.foliage.BlockDoublePlant;
import common.block.foliage.BlockDoublePlant.EnumPlantType;
import common.color.Colorizer;
import common.item.ItemStack;
import common.model.Model;
import common.model.ModelProvider;

public class ItemDoublePlant extends ItemBlock
{
	private final BlockDoublePlant.EnumPlantType type;
	
    public ItemDoublePlant(BlockDoublePlant block)
    {
        super(block, "");
        this.type = block.getType();
    }

    public int getColorFromItemStack(ItemStack stack, int renderPass)
    {
        return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN ? super.getColorFromItemStack(stack, renderPass) : Colorizer.getGrassColor(0.5D, 1.0D);
    }

    public Model getModel(ModelProvider provider, String name) {
    	return provider.getModel(this.getTransform(), "blocks/" + (
    			this.type == EnumPlantType.SUNFLOWER ? "sunflower_front" : 
    			this.type.getName() + "_top"));
    }
}
