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());
}
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));
}
}
}
Aggregations