package common.entity.item;

import common.block.tech.BlockChest;
import common.entity.DamageSource;
import common.entity.npc.EntityNPC;
import common.init.Blocks;
import common.init.Items;
import common.inventory.Container;
import common.inventory.ContainerChest;
import common.inventory.InventoryPlayer;
import common.util.Facing;
import common.vars.Vars;
import common.world.State;
import common.world.World;

public class EntityChestCart extends EntityCartContainer
{
    public EntityChestCart(World worldIn)
    {
        super(worldIn);
    }

    public EntityChestCart(World worldIn, double x, double y, double z)
    {
        super(worldIn, x, y, z);
    }

    public void killMinecart(DamageSource source)
    {
        super.killMinecart(source);

        if (Vars.objectDrop)
        {
            this.dropItemWithOffset(Items.chest, 1, 0.0F);
        }
    }

    /**
     * Returns the number of slots in the inventory.
     */
    public int getSizeInventory()
    {
        return 27;
    }

    public EntityCart.EnumMinecartType getMinecartType()
    {
        return EntityCart.EnumMinecartType.CHEST;
    }

    public State getDisplayTile()
    {
        return Blocks.chest.getState().withProperty(BlockChest.FACING, Facing.NORTH);
    }

    public int getDisplayTileOffset()
    {
        return 8;
    }

    public String getGuiID()
    {
        return "chest";
    }

    public Container createContainer(InventoryPlayer playerInventory, EntityNPC playerIn)
    {
        return new ContainerChest(playerInventory, this, playerIn);
    }
}
