package common.block;

import common.material.Material;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.properties.PropertyEnum;
import common.util.Facing;
import common.world.State;

public abstract class BlockRotatedPillar extends Block
{
    public static final PropertyEnum<Facing.Axis> AXIS = PropertyEnum.<Facing.Axis>create("axis", Facing.Axis.class);

    public BlockRotatedPillar(Material materialIn)
    {
        super(materialIn);
    }

    public Model getModel(ModelProvider provider, String name, State state) {
    	switch(state.getValue(AXIS)) {
	    	case X:
	    		return provider.getModel(name + "_side").add().d().rot(180).u()
	    				.n(name + "_top").rot(180).s(name + "_top").w().rot(270)
	    				.e().rot(90).rotate(ModelRotation.X0_Y90);
	    	case Y:
	    	default:
	    		return provider.getModel(name + "_side").add().nswe().du(name + "_top");
	    	case Z:
	    		return provider.getModel(name + "_side").add().d().rot(180).u()
	    				.n(name + "_top").rot(180).s(name + "_top").w().rot(270)
	    				.e().rot(90);
		}
    }
}
