use of mekanism.client.gui.element.slot.GuiSlot in project Mekanism by mekanism.
the class GuiModuleTweaker method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
moduleScreen = addButton(new GuiModuleScreen(this, 138, 20, () -> menu.slots.get(selected).getSlotIndex()));
scrollList = addButton(new GuiModuleScrollList(this, 30, 20, 108, 116, () -> getStack(selected), this::onModuleSelected));
addButton(new GuiElementHolder(this, 30, 136, 108, 18));
optionsButton = addButton(new TranslationButton(this, 31, 137, 106, 16, MekanismLang.BUTTON_OPTIONS, this::openOptions));
optionsButton.active = false;
int size = menu.slots.size();
for (int i = 0; i < size; i++) {
Slot slot = menu.slots.get(i);
final int index = i;
// initialize selected item
if (selected == -1 && isValidItem(index)) {
select(index);
}
addButton(new GuiSlot(SlotType.NORMAL, this, slot.x - 1, slot.y - 1).click((e, x, y) -> select(index)).overlayColor(isValidItem(index) ? null : () -> 0xCC333333).with(() -> index == selected ? SlotOverlay.SELECT : null));
}
}
use of mekanism.client.gui.element.slot.GuiSlot in project Mekanism by mekanism.
the class GuiLogisticalSorter method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiSlot(SlotType.NORMAL, this, 12, 136).setRenderAboveSlots());
addButton(new TranslationButton(this, 56, 136, 96, 20, MekanismLang.BUTTON_NEW_FILTER, () -> addWindow(new GuiSorterFilerSelect(this, tile))));
addButton(new MekanismImageButton(this, 12, 58, 14, getButtonLocation("single"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.SINGLE_ITEM_BUTTON, tile)), getOnHover(MekanismLang.SORTER_SINGLE_ITEM_DESCRIPTION)));
addButton(new MekanismImageButton(this, 12, 84, 14, getButtonLocation("round_robin"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.ROUND_ROBIN_BUTTON, tile)), getOnHover(MekanismLang.SORTER_ROUND_ROBIN_DESCRIPTION)));
addButton(new MekanismImageButton(this, 12, 110, 14, getButtonLocation("auto_eject"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.AUTO_EJECT_BUTTON, tile)), getOnHover(MekanismLang.SORTER_AUTO_EJECT_DESCRIPTION)));
addButton(new ColorButton(this, 13, 137, 16, 16, () -> tile.color, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.CHANGE_COLOR, tile, hasShiftDown() ? -1 : TransporterUtils.getColorIndex(TransporterUtils.increment(tile.color)))), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.CHANGE_COLOR, tile, TransporterUtils.getColorIndex(TransporterUtils.decrement(tile.color))))));
}
use of mekanism.client.gui.element.slot.GuiSlot in project Mekanism by mekanism.
the class GuiDynamicTank method addGuiElements.
@Override
protected void addGuiElements() {
// Add the side holder before the slots, as it holds a couple of the slots
addButton(GuiSideHolder.armorHolder(this));
addButton(new GuiElementHolder(this, 141, 16, 26, 56));
super.addGuiElements();
addButton(new GuiSlot(SlotType.INNER_HOLDER_SLOT, this, 145, 20));
addButton(new GuiSlot(SlotType.INNER_HOLDER_SLOT, this, 145, 50));
addButton(new GuiInnerScreen(this, 49, 21, 84, 46, () -> {
List<ITextComponent> ret = new ArrayList<>();
TankMultiblockData multiblock = tile.getMultiblock();
long capacity = multiblock.getChemicalTankCapacity();
switch(multiblock.mergedTank.getCurrentType()) {
case EMPTY:
ret.add(MekanismLang.EMPTY.translate());
break;
case FLUID:
addStored(ret, multiblock.getFluidTank().getFluid(), FluidStack::getAmount);
capacity = multiblock.getTankCapacity();
break;
case GAS:
addStored(ret, multiblock.getGasTank());
break;
case INFUSION:
addStored(ret, multiblock.getInfusionTank());
break;
case PIGMENT:
addStored(ret, multiblock.getPigmentTank());
break;
case SLURRY:
addStored(ret, multiblock.getSlurryTank());
break;
}
ret.add(MekanismLang.CAPACITY.translate(""));
ret.add(MekanismLang.GENERIC_MB.translate(TextUtils.format(capacity)));
return ret;
}).spacing(2));
addButton(new GuiDownArrow(this, 150, 39));
addButton(new GuiContainerEditModeTab<>(this, tile));
addButton(new GuiMergedTankGauge<>(() -> tile.getMultiblock().mergedTank, tile::getMultiblock, GaugeType.MEDIUM, this, 7, 16, 34, 56));
}
use of mekanism.client.gui.element.slot.GuiSlot in project Mekanism by mekanism.
the class GuiDigitalMiner method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiInnerScreen(this, 7, 19, 77, 69, () -> {
List<ITextComponent> list = new ArrayList<>();
ILangEntry runningType;
if (tile.getEnergyContainer().getEnergyPerTick().greaterThan(tile.getEnergyContainer().getMaxEnergy())) {
runningType = MekanismLang.MINER_LOW_POWER;
} else if (tile.isRunning()) {
runningType = MekanismLang.MINER_RUNNING;
} else {
runningType = MekanismLang.IDLE;
}
list.add(runningType.translate());
list.add(tile.searcher.state.getTextComponent());
list.add(MekanismLang.MINER_TO_MINE.translate(TextUtils.format(tile.getToMine())));
return list;
}).spacing(1).clearFormat());
addButton(new GuiDigitalSwitch(this, 19, 56, EJECT, tile::getDoEject, MekanismLang.AUTO_EJECT.translate(), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.AUTO_EJECT_BUTTON, tile)), SwitchType.LOWER_ICON));
addButton(new GuiDigitalSwitch(this, 38, 56, INPUT, tile::getDoPull, MekanismLang.AUTO_PULL.translate(), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.AUTO_PULL_BUTTON, tile)), SwitchType.LOWER_ICON));
addButton(new GuiDigitalSwitch(this, 57, 56, SILK, tile::getSilkTouch, MekanismLang.MINER_SILK.translate(), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.SILK_TOUCH_BUTTON, tile)), SwitchType.LOWER_ICON));
addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 157, 39, 47));
addButton(new GuiVisualsTab(this, tile));
addButton(new GuiSlot(SlotType.DIGITAL, this, 64, 21).setRenderAboveSlots().validity(() -> tile.missingStack).with(() -> tile.missingStack.isEmpty() ? SlotOverlay.CHECK : null).hover(getOnHover(() -> tile.missingStack.isEmpty() ? MekanismLang.MINER_WELL.translate() : MekanismLang.MINER_MISSING_BLOCK.translate())));
addButton(new GuiEnergyTab(this, () -> {
MinerEnergyContainer energyContainer = tile.getEnergyContainer();
FloatingLong perTick = energyContainer.getEnergyPerTick();
ArrayList<ITextComponent> ret = new ArrayList<>(4);
ret.add(MekanismLang.MINER_ENERGY_CAPACITY.translate(EnergyDisplay.of(energyContainer.getMaxEnergy())));
ret.add(MekanismLang.NEEDED_PER_TICK.translate(EnergyDisplay.of(perTick)));
if (perTick.greaterThan(energyContainer.getMaxEnergy())) {
ret.add(MekanismLang.MINER_INSUFFICIENT_BUFFER.translateColored(EnumColor.RED));
}
ret.add(MekanismLang.MINER_BUFFER_FREE.translate(EnergyDisplay.of(energyContainer.getNeeded())));
return ret;
}));
int buttonStart = 19;
startButton = addButton(new TranslationButton(this, 87, buttonStart, 61, 18, MekanismLang.BUTTON_START, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.START_BUTTON, tile))));
stopButton = addButton(new TranslationButton(this, 87, buttonStart + 17, 61, 18, MekanismLang.BUTTON_STOP, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.STOP_BUTTON, tile))));
configButton = addButton(new TranslationButton(this, 87, buttonStart + 34, 61, 18, MekanismLang.BUTTON_CONFIG, () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedTileButton.DIGITAL_MINER_CONFIG, tile))));
addButton(new TranslationButton(this, 87, buttonStart + 51, 61, 18, MekanismLang.MINER_RESET, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.RESET_BUTTON, tile))));
updateEnabledButtons();
trackWarning(WarningType.FILTER_HAS_BLACKLISTED_ELEMENT, () -> tile.getFilters().stream().anyMatch(MinerFilter::hasBlacklistedElement));
}
use of mekanism.client.gui.element.slot.GuiSlot in project Mekanism by mekanism.
the class GuiChemicalCrystallizer method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 157, 23));
addButton(new GuiEnergyTab(this, tile.getEnergyContainer(), tile::getActive));
addButton(new GuiMergedChemicalTankGauge<>(() -> tile.inputTank, () -> tile, GaugeType.STANDARD, this, 7, 4));
addButton(new GuiProgress(tile::getScaledProgress, ProgressType.LARGE_RIGHT, this, 53, 61).jeiCategory(tile));
// Init slot display before gui screen, so it can reference it, but add it after, so it renders above it
slotDisplay = new GuiSequencedSlotDisplay(this, 129, 14, () -> iterStacks);
updateSlotContents();
addButton(new GuiInnerScreen(this, 31, 13, 115, 42, () -> getScreenRenderStrings(this.oreInfo)));
addButton(new GuiSlot(SlotType.ORE, this, 128, 13).setRenderAboveSlots());
addButton(slotDisplay);
}
Aggregations