package client.renderer.chunk;

import java.util.List;

import common.collect.Lists;
import common.tileentity.TileEntity;
import common.util.Facing;

public class CompiledChunk
{
    public static final CompiledChunk DUMMY = new CompiledChunk()
    {
        protected void setLayerUsed(BlockLayer layer)
        {
            throw new UnsupportedOperationException();
        }
        public void setLayerStarted(BlockLayer layer)
        {
            throw new UnsupportedOperationException();
        }
        public boolean isVisible(Facing facing, Facing facing2)
        {
            return false;
        }
    };
    private final boolean[] layersUsed = new boolean[BlockLayer.values().length];
    private final boolean[] layersStarted = new boolean[BlockLayer.values().length];
    private boolean empty = true;
    private final List<TileEntity> tileEntities = Lists.<TileEntity>newArrayList();
    private SetVisibility setVisibility = new SetVisibility();

    public boolean isEmpty()
    {
        return this.empty;
    }

    protected void setLayerUsed(BlockLayer layer)
    {
        this.empty = false;
        this.layersUsed[layer.ordinal()] = true;
    }

    public boolean isLayerEmpty(BlockLayer layer)
    {
        return !this.layersUsed[layer.ordinal()];
    }

    public void setLayerStarted(BlockLayer layer)
    {
        this.layersStarted[layer.ordinal()] = true;
    }

    public boolean isLayerStarted(BlockLayer layer)
    {
        return this.layersStarted[layer.ordinal()];
    }

    public List<TileEntity> getTileEntities()
    {
        return this.tileEntities;
    }

    public void addTileEntity(TileEntity tileEntityIn)
    {
        this.tileEntities.add(tileEntityIn);
    }

    public boolean isVisible(Facing facing, Facing facing2)
    {
        return this.setVisibility.isVisible(facing, facing2);
    }

    public void setVisibility(SetVisibility visibility)
    {
        this.setVisibility = visibility;
    }
}
