use of mekanism.client.gui.element.slot.SlotType 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