use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.
the class GuiQIOFilterHandler method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiQIOFrequencyTab(this, tile));
addButton(new GuiInnerScreen(this, 9, 16, imageWidth - 18, 12, () -> {
List<ITextComponent> list = new ArrayList<>();
QIOFrequency freq = tile.getQIOFrequency();
if (freq == null) {
list.add(MekanismLang.NO_FREQUENCY.translate());
} else {
list.add(MekanismLang.FREQUENCY.translate(freq.getKey()));
}
return list;
}).tooltip(() -> {
List<ITextComponent> list = new ArrayList<>();
QIOFrequency freq = tile.getQIOFrequency();
if (freq != null) {
list.add(MekanismLang.QIO_ITEMS_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(freq.getTotalItemCount()), TextUtils.format(freq.getTotalItemCountCapacity())));
list.add(MekanismLang.QIO_TYPES_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(freq.getTotalItemTypes(true)), TextUtils.format(freq.getTotalItemTypeCapacity())));
}
return list;
}));
// Filter holder
addButton(new GuiElementHolder(this, 9, 30, 144, 68));
// new filter button border
addButton(new GuiElementHolder(this, 9, 98, 144, 22));
addButton(new TranslationButton(this, 10, 99, 142, 20, MekanismLang.BUTTON_NEW_FILTER, () -> addWindow(new GuiQIOFilerSelect(this, tile))));
scrollBar = addButton(new GuiScrollBar(this, 153, 30, 90, () -> tile.getFilters().size(), () -> FILTER_COUNT));
// Add each of the buttons and then just change visibility state to match filter info
for (int i = 0; i < FILTER_COUNT; i++) {
addButton(new MovableFilterButton(this, 10, 31 + i * 22, 142, 22, i, scrollBar::getCurrentSelection, tile::getFilters, index -> {
if (index > 0) {
Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.MOVE_FILTER_UP, tile, index));
}
}, index -> {
if (index < tile.getFilters().size() - 1) {
Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.MOVE_FILTER_DOWN, tile, index));
}
}, this::onClick, filter -> {
List<ItemStack> list = new ArrayList<>();
if (filter != null) {
if (filter instanceof IItemStackFilter) {
list.add(((IItemStackFilter<?>) filter).getItemStack());
} else if (filter instanceof ITagFilter) {
String name = ((ITagFilter<?>) filter).getTagName();
if (name != null && !name.isEmpty()) {
list.addAll(TagCache.getItemTagStacks(((ITagFilter<?>) filter).getTagName()));
}
} else if (filter instanceof IModIDFilter) {
list.addAll(TagCache.getModIDStacks(((IModIDFilter<?>) filter).getModID(), false));
}
}
return list;
}));
}
}
use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.
the class GuiQIOItemViewer method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
int slotsY = MekanismConfig.client.qioItemViewerSlotsY.get();
getMinecraft().keyboardHandler.setSendRepeatsToGui(true);
addButton(new GuiInnerScreen(this, 7, 15, imageWidth - 16, 12, () -> {
List<ITextComponent> list = new ArrayList<>();
FrequencyIdentity freq = getFrequency();
if (freq == null) {
list.add(MekanismLang.NO_FREQUENCY.translate());
} else {
list.add(MekanismLang.FREQUENCY.translate(freq.getKey()));
}
return list;
}).tooltip(() -> {
List<ITextComponent> list = new ArrayList<>();
if (getFrequency() != null) {
list.add(MekanismLang.QIO_ITEMS_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(menu.getTotalItems()), TextUtils.format(menu.getCountCapacity())));
list.add(MekanismLang.QIO_TYPES_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(menu.getTotalTypes()), TextUtils.format(menu.getTypeCapacity())));
}
return list;
}));
searchField = addButton(new GuiTextField(this, 50, 15 + 12 + 3, imageWidth - 50 - 10, 10));
searchField.setOffset(0, -1);
searchField.setInputValidator(this::isValidSearchChar);
searchField.setResponder(menu::updateSearch);
searchField.setMaxStringLength(50);
searchField.setBackground(BackgroundType.ELEMENT_HOLDER);
searchField.setVisible(true);
searchField.setTextColor(0xFFFFFF);
searchField.setFocused(true);
addButton(new GuiSlotScroll(this, 7, QIOItemViewerContainer.SLOTS_START_Y, MekanismConfig.client.qioItemViewerSlotsX.get(), slotsY, menu::getQIOItemList, menu));
addButton(new GuiDropdown<>(this, imageWidth - 9 - 54, QIOItemViewerContainer.SLOTS_START_Y + slotsY * 18 + 1, 41, ListSortType.class, menu::getSortType, menu::setSortType));
addButton(new GuiDigitalIconToggle<>(this, imageWidth - 9 - 12, QIOItemViewerContainer.SLOTS_START_Y + slotsY * 18 + 1, 12, 12, SortDirection.class, menu::getSortDirection, menu::setSortDirection));
addButton(new GuiResizeControls(this, (getMinecraft().getWindow().getGuiScaledHeight() / 2) - 20 - topPos, this::resize));
craftingWindowTab = addButton(new GuiCraftingWindowTab(this, () -> craftingWindowTab, menu));
}
use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.
the class GuiRobitMain method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiSecurityTab(this, robit, 120));
addButton(GuiSideHolder.create(this, 176, 6, 106, false, false, SpecialColors.TAB_ROBIT_MENU));
addButton(new GuiInnerScreen(this, 27, 16, 122, 56));
addButton(new GuiHorizontalPowerBar(this, robit.getEnergyContainer(), 27, 74, 120));
addButton(new MekanismImageButton(this, 6, 16, 18, getButtonLocation("home"), () -> {
Mekanism.packetHandler.sendToServer(new PacketRobit(RobitPacketType.GO_HOME, robit));
getMinecraft().setScreen(null);
}, getOnHover(MekanismLang.ROBIT_TELEPORT)));
renameButton = addButton(new MekanismImageButton(this, 6, 35, 18, getButtonLocation("rename"), () -> openWindow(new GuiRobitRename(this, 27, 16, robit), () -> renameButton), getOnHover(MekanismLang.ROBIT_RENAME)));
skinButton = addButton(new MekanismImageButton(this, 6, 54, 18, getButtonLocation("skin"), () -> openWindow(new GuiRobitSkinSelect(this, 4, -12, robit), () -> skinButton), getOnHover(MekanismLang.ROBIT_SKIN_SELECT)));
addButton(new MekanismImageButton(this, 152, 35, 18, getButtonLocation("drop"), () -> Mekanism.packetHandler.sendToServer(new PacketRobit(RobitPacketType.DROP_PICKUP, robit)), getOnHover(MekanismLang.ROBIT_TOGGLE_PICKUP)));
addButton(new MekanismImageButton(this, 152, 54, 18, getButtonLocation("follow"), () -> Mekanism.packetHandler.sendToServer(new PacketRobit(RobitPacketType.FOLLOW, robit)), getOnHover(MekanismLang.ROBIT_TOGGLE_FOLLOW)));
addButton(new MekanismImageButton(this, 179, 10, 18, getButtonLocation("main"), () -> {
// Clicking main button doesn't do anything while already on the main GUI
}, getOnHover(MekanismLang.ROBIT)));
addButton(new MekanismImageButton(this, 179, 30, 18, getButtonLocation("crafting"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_CRAFTING, robit)), getOnHover(MekanismLang.ROBIT_CRAFTING)));
addButton(new MekanismImageButton(this, 179, 50, 18, getButtonLocation("inventory"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_INVENTORY, robit)), getOnHover(MekanismLang.ROBIT_INVENTORY)));
addButton(new MekanismImageButton(this, 179, 70, 18, getButtonLocation("smelting"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_SMELTING, robit)), getOnHover(MekanismLang.ROBIT_SMELTING)));
addButton(new MekanismImageButton(this, 179, 90, 18, getButtonLocation("repair"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_REPAIR, robit)), getOnHover(MekanismLang.ROBIT_REPAIR)));
}
use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.
the class GuiResistiveHeater method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiInnerScreen(this, 48, 23, 80, 42, () -> Arrays.asList(MekanismLang.TEMPERATURE.translate(MekanismUtils.getTemperatureDisplay(tile.getTotalTemperature(), TemperatureUnit.KELVIN, true)), MekanismLang.RESISTIVE_HEATER_USAGE.translate(EnergyDisplay.of(tile.getEnergyContainer().getEnergyPerTick())))).clearFormat());
addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 164, 15));
addButton(new GuiEnergyTab(this, tile.getEnergyContainer()));
addButton(new GuiHeatTab(this, () -> {
ITextComponent environment = MekanismUtils.getTemperatureDisplay(tile.getLastEnvironmentLoss(), TemperatureUnit.KELVIN, false);
return Collections.singletonList(MekanismLang.DISSIPATED_RATE.translate(environment));
}));
energyUsageField = addButton(new GuiTextField(this, 50, 51, 76, 12));
energyUsageField.setText(energyUsageField.getText());
energyUsageField.setMaxStringLength(7);
energyUsageField.setInputValidator(InputValidator.DIGIT);
energyUsageField.configureDigitalInput(this::setEnergyUsage);
energyUsageField.setFocused(true);
}
use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.
the class GuiSPS method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiGasGauge(() -> tile.getMultiblock().inputTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 7, 17));
addButton(new GuiGasGauge(() -> tile.getMultiblock().outputTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 151, 17));
addButton(new GuiInnerScreen(this, 27, 17, 122, 60, () -> {
List<ITextComponent> list = new ArrayList<>();
SPSMultiblockData multiblock = tile.getMultiblock();
boolean active = multiblock.lastProcessed > 0;
list.add(MekanismLang.STATUS.translate(active ? MekanismLang.ACTIVE : MekanismLang.IDLE));
if (active) {
list.add(MekanismLang.SPS_ENERGY_INPUT.translate(EnergyDisplay.of(multiblock.lastReceivedEnergy)));
list.add(MekanismLang.PROCESS_RATE_MB.translate(multiblock.getProcessRate()));
}
return list;
}).jeiCategories(MekanismBlocks.SPS_CASING.getRegistryName()));
addButton(new GuiDynamicHorizontalRateBar(this, new IBarInfoHandler() {
@Override
public ITextComponent getTooltip() {
return MekanismLang.PROGRESS.translate(TextUtils.getPercent(tile.getMultiblock().getScaledProgress()));
}
@Override
public double getLevel() {
return Math.min(1, tile.getMultiblock().getScaledProgress());
}
}, 7, 79, 160, ColorFunction.scale(Color.rgbi(60, 45, 74), Color.rgbi(100, 30, 170))));
}
Aggregations