package common.block.tile;

import common.block.Block;
import common.item.Item;
import common.item.block.ItemBanner;
import common.properties.Property;
import common.util.BlockPos;
import common.world.State;
import common.world.World;

public class BlockBannerStanding extends BlockBanner
{
    public BlockBannerStanding()
    {
        this.setDefaultState(this.getBaseState().withProperty(ROTATION, Integer.valueOf(0)));
    }

    public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock)
    {
        if (!worldIn.getState(pos.down()).getBlock().getMaterial().isSolid())
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
        }

        super.onNeighborBlockChange(worldIn, pos, state, neighborBlock);
    }

    public State getStateFromMeta(int meta)
    {
        return this.getState().withProperty(ROTATION, Integer.valueOf(meta));
    }

    public int getMetaFromState(State state)
    {
        return ((Integer)state.getValue(ROTATION)).intValue();
    }

    protected Property[] getProperties()
    {
        return new Property[] {ROTATION};
    }
	
	protected Item getItemToRegister() {
		return new ItemBanner(this).setDisplay("Banner");
	}
}