Search in sources :

Example 1 with SlotOverlay

use of mekanism.common.inventory.container.slot.SlotOverlay in project Mekanism by mekanism.

the class GuiFormulaicAssemblicator method renderBg.

@Override
protected void renderBg(@Nonnull MatrixStack matrix, float partialTick, int mouseX, int mouseY) {
    super.renderBg(matrix, partialTick, mouseX, mouseY);
    // TODO: Gui element
    SlotOverlay overlay = tile.hasRecipe() ? SlotOverlay.CHECK : SlotOverlay.X;
    getMinecraft().textureManager.bind(overlay.getTexture());
    blit(matrix, leftPos + 88, topPos + 22, 0, 0, overlay.getWidth(), overlay.getHeight(), overlay.getWidth(), overlay.getHeight());
}
Also used : SlotOverlay(mekanism.common.inventory.container.slot.SlotOverlay)

Example 2 with SlotOverlay

use of mekanism.common.inventory.container.slot.SlotOverlay in project Mekanism by mekanism.

the class GuiMekanism method addSlots.

protected void addSlots() {
    int size = menu.slots.size();
    for (int i = 0; i < size; i++) {
        Slot slot = menu.slots.get(i);
        if (slot instanceof InventoryContainerSlot) {
            InventoryContainerSlot containerSlot = (InventoryContainerSlot) slot;
            ContainerSlotType slotType = containerSlot.getSlotType();
            DataType dataType = findDataType(containerSlot);
            // Shift the slots by one as the elements include the border of the slot
            SlotType type;
            if (dataType != null) {
                type = SlotType.get(dataType);
            } else if (slotType == ContainerSlotType.INPUT || slotType == ContainerSlotType.OUTPUT || slotType == ContainerSlotType.EXTRA) {
                type = SlotType.NORMAL;
            } else if (slotType == ContainerSlotType.POWER) {
                type = SlotType.POWER;
            } else if (slotType == ContainerSlotType.NORMAL || slotType == ContainerSlotType.VALIDITY) {
                type = SlotType.NORMAL;
            } else {
                // slotType == ContainerSlotType.IGNORED: don't do anything
                continue;
            }
            GuiSlot guiSlot = new GuiSlot(type, this, slot.x - 1, slot.y - 1);
            SlotOverlay slotOverlay = containerSlot.getSlotOverlay();
            if (slotOverlay != null) {
                guiSlot.with(slotOverlay);
            }
            if (slotType == ContainerSlotType.VALIDITY) {
                int index = i;
                guiSlot.validity(() -> checkValidity(index));
            }
            addButton(guiSlot);
        } else {
            addButton(new GuiSlot(SlotType.NORMAL, this, slot.x - 1, slot.y - 1));
        }
    }
}
Also used : SlotOverlay(mekanism.common.inventory.container.slot.SlotOverlay) ContainerSlotType(mekanism.common.inventory.container.slot.ContainerSlotType) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) IVirtualSlot(mekanism.common.inventory.container.slot.IVirtualSlot) Slot(net.minecraft.inventory.container.Slot) InventoryContainerSlot(mekanism.common.inventory.container.slot.InventoryContainerSlot) GuiVirtualSlot(mekanism.client.gui.element.slot.GuiVirtualSlot) DataType(mekanism.common.tile.component.config.DataType) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) InventoryContainerSlot(mekanism.common.inventory.container.slot.InventoryContainerSlot) SlotType(mekanism.client.gui.element.slot.SlotType) ContainerSlotType(mekanism.common.inventory.container.slot.ContainerSlotType)

Aggregations

SlotOverlay (mekanism.common.inventory.container.slot.SlotOverlay)2 GuiSlot (mekanism.client.gui.element.slot.GuiSlot)1 GuiVirtualSlot (mekanism.client.gui.element.slot.GuiVirtualSlot)1 SlotType (mekanism.client.gui.element.slot.SlotType)1 ContainerSlotType (mekanism.common.inventory.container.slot.ContainerSlotType)1 IVirtualSlot (mekanism.common.inventory.container.slot.IVirtualSlot)1 InventoryContainerSlot (mekanism.common.inventory.container.slot.InventoryContainerSlot)1 DataType (mekanism.common.tile.component.config.DataType)1 Slot (net.minecraft.inventory.container.Slot)1