Search in sources :

Example 1 with IEmptyContainer

use of mekanism.common.inventory.container.IEmptyContainer in project Mekanism by mekanism.

the class MekanismTileContainer method addSlots.

@Override
protected void addSlots() {
    super.addSlots();
    if (this instanceof IEmptyContainer) {
        // Don't include the inventory slots
        return;
    }
    if (tile.supportsUpgrades()) {
        // Add the virtual slot for the upgrade (add them before the main inventory to make sure they take priority in targeting)
        addSlot(upgradeSlot = tile.getComponent().getUpgradeSlot().createContainerSlot());
        addSlot(upgradeOutputSlot = tile.getComponent().getUpgradeOutputSlot().createContainerSlot());
    }
    if (tile.hasInventory()) {
        // Get all the inventory slots the tile has
        List<IInventorySlot> inventorySlots = tile.getInventorySlots(null);
        for (IInventorySlot inventorySlot : inventorySlots) {
            Slot containerSlot = inventorySlot.createContainerSlot();
            if (containerSlot != null) {
                addSlot(containerSlot);
            }
        }
    }
}
Also used : IInventorySlot(mekanism.api.inventory.IInventorySlot) IEmptyContainer(mekanism.common.inventory.container.IEmptyContainer) VirtualInventoryContainerSlot(mekanism.common.inventory.container.slot.VirtualInventoryContainerSlot) IInventorySlot(mekanism.api.inventory.IInventorySlot) Slot(net.minecraft.inventory.container.Slot)

Aggregations

IInventorySlot (mekanism.api.inventory.IInventorySlot)1 IEmptyContainer (mekanism.common.inventory.container.IEmptyContainer)1 VirtualInventoryContainerSlot (mekanism.common.inventory.container.slot.VirtualInventoryContainerSlot)1 Slot (net.minecraft.inventory.container.Slot)1