use of mekanism.client.gui.element.GuiInnerScreen 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.GuiInnerScreen in project Mekanism by mekanism.
the class GuiFilterHolder method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiInnerScreen(this, 9, 17, 46, 140));
// Filter holder
addButton(new GuiElementHolder(this, 55, 17, 98, 118));
// new filter button border
addButton(new GuiElementHolder(this, 55, 135, 98, 22));
scrollBar = addButton(new GuiScrollBar(this, 153, 17, 140, () -> 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++) {
addFilterButton(new MovableFilterButton(this, 56, 18 + i * 29, i, scrollBar::getCurrentSelection, this::getFilters, index -> {
if (index > 0) {
Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.MOVE_FILTER_UP, tile, index));
}
}, index -> {
if (index < 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) {
list.addAll(getTagStacks(((ITagFilter<?>) filter).getTagName()));
} else if (filter instanceof IMaterialFilter) {
list.addAll(TagCache.getMaterialStacks(((IMaterialFilter<?>) filter).getMaterialItem()));
} 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 GuiThermalEvaporationController method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiInnerScreen(this, 48, 19, 80, 40, () -> {
EvaporationMultiblockData multiblock = tile.getMultiblock();
return Arrays.asList(MekanismLang.MULTIBLOCK_FORMED.translate(), MekanismLang.EVAPORATION_HEIGHT.translate(multiblock.height()), MekanismLang.TEMPERATURE.translate(MekanismUtils.getTemperatureDisplay(multiblock.getTemperature(), TemperatureUnit.KELVIN, true)), MekanismLang.FLUID_PRODUCTION.translate(Math.round(multiblock.lastGain * 100D) / 100D));
}).spacing(1).jeiCategory(tile));
addButton(new GuiDownArrow(this, 32, 39));
addButton(new GuiDownArrow(this, 136, 39));
addButton(new GuiHorizontalRateBar(this, new IBarInfoHandler() {
@Override
public ITextComponent getTooltip() {
return MekanismUtils.getTemperatureDisplay(tile.getMultiblock().getTemperature(), TemperatureUnit.KELVIN, true);
}
@Override
public double getLevel() {
return Math.min(1, tile.getMultiblock().getTemperature() / EvaporationMultiblockData.MAX_MULTIPLIER_TEMP);
}
}, 48, 63));
addButton(new GuiFluidGauge(() -> tile.getMultiblock().inputTank, () -> tile.getMultiblock().getFluidTanks(null), GaugeType.STANDARD, this, 6, 13));
addButton(new GuiFluidGauge(() -> tile.getMultiblock().outputTank, () -> tile.getMultiblock().getFluidTanks(null), GaugeType.STANDARD, this, 152, 13));
addButton(new GuiHeatTab(this, () -> {
ITextComponent environment = MekanismUtils.getTemperatureDisplay(tile.getMultiblock().lastEnvironmentLoss, TemperatureUnit.KELVIN, false);
return Collections.singletonList(MekanismLang.DISSIPATED_RATE.translate(environment));
}));
}
use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.
the class GuiBioGenerator method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiInnerScreen(this, 48, 23, 80, 40, () -> Arrays.asList(EnergyDisplay.of(tile.getEnergyContainer().getEnergy()).getTextComponent(), GeneratorsLang.STORED_BIO_FUEL.translate(TextUtils.format(tile.bioFuelTank.getFluidAmount())), GeneratorsLang.OUTPUT_RATE_SHORT.translate(EnergyDisplay.of(tile.getMaxOutput())))));
addButton(new GuiEnergyTab(this, () -> Arrays.asList(GeneratorsLang.PRODUCING_AMOUNT.translate(tile.getActive() ? EnergyDisplay.of(MekanismGeneratorsConfig.generators.bioGeneration.get()) : EnergyDisplay.ZERO), MekanismLang.MAX_OUTPUT.translate(EnergyDisplay.of(tile.getMaxOutput())))));
addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 164, 15));
addButton(new GuiFluidBar(this, GuiFluidBar.getProvider(tile.bioFuelTank, tile.getFluidTanks(null)), 7, 15, 4, 52, false));
}
use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.
the class GuiFissionReactor method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiFissionReactorTab(this, tile, FissionReactorTab.STAT));
addButton(new GuiInnerScreen(this, 45, 17, 105, 56, () -> {
FissionReactorMultiblockData multiblock = tile.getMultiblock();
return Arrays.asList(MekanismLang.STATUS.translate(multiblock.isActive() ? EnumColor.BRIGHT_GREEN : EnumColor.RED, ActiveDisabled.of(multiblock.isActive())), GeneratorsLang.GAS_BURN_RATE.translate(multiblock.lastBurnRate), GeneratorsLang.FISSION_HEATING_RATE.translate(TextUtils.format(multiblock.lastBoilRate)), MekanismLang.TEMPERATURE.translate(tile.getTempColor(), MekanismUtils.getTemperatureDisplay(multiblock.heatCapacitor.getTemperature(), TemperatureUnit.KELVIN, true)), GeneratorsLang.FISSION_DAMAGE.translate(tile.getDamageColor(), tile.getDamageString()));
}).spacing(2).jeiCategories(JEI_LOCATION));
addButton(new GuiHybridGauge(() -> tile.getMultiblock().gasCoolantTank, () -> tile.getMultiblock().getGasTanks(null), () -> tile.getMultiblock().fluidCoolantTank, () -> tile.getMultiblock().getFluidTanks(null), GaugeType.STANDARD, this, 6, 13).setLabel(GeneratorsLang.FISSION_COOLANT_TANK.translateColored(EnumColor.AQUA)));
addButton(new GuiGasGauge(() -> tile.getMultiblock().fuelTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 25, 13).setLabel(GeneratorsLang.FISSION_FUEL_TANK.translateColored(EnumColor.DARK_GREEN)));
addButton(new GuiGasGauge(() -> tile.getMultiblock().heatedCoolantTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 152, 13).setLabel(GeneratorsLang.FISSION_HEATED_COOLANT_TANK.translateColored(EnumColor.ORANGE)));
addButton(new GuiGasGauge(() -> tile.getMultiblock().wasteTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 171, 13).setLabel(GeneratorsLang.FISSION_WASTE_TANK.translateColored(EnumColor.BROWN)));
addButton(new GuiHeatTab(this, () -> {
ITextComponent environment = MekanismUtils.getTemperatureDisplay(tile.getMultiblock().lastEnvironmentLoss, TemperatureUnit.KELVIN, false);
return Collections.singletonList(MekanismLang.DISSIPATED_RATE.translate(environment));
}));
activateButton = addButton(new TranslationButton(this, 6, 75, 81, 16, GeneratorsLang.FISSION_ACTIVATE, () -> MekanismGenerators.packetHandler.sendToServer(new PacketGeneratorsGuiInteract(GeneratorsGuiInteraction.FISSION_ACTIVE, tile, 1)), null, () -> EnumColor.DARK_GREEN) {
@Override
public void renderForeground(MatrixStack matrix, int mouseX, int mouseY) {
super.renderForeground(matrix, mouseX, mouseY);
if (!active && tile.getMultiblock().isForceDisabled()) {
active = true;
// Temporarily set active to true, so we can easily check if the mouse is over the button
if (isMouseOverCheckWindows(mouseX, mouseY)) {
displayTooltip(matrix, GeneratorsLang.FISSION_FORCE_DISABLED.translate(), mouseX - getGuiLeft(), mouseY - getGuiTop());
}
active = false;
}
}
});
scramButton = addButton(new TranslationButton(this, 89, 75, 81, 16, GeneratorsLang.FISSION_SCRAM, () -> MekanismGenerators.packetHandler.sendToServer(new PacketGeneratorsGuiInteract(GeneratorsGuiInteraction.FISSION_ACTIVE, tile, 0)), null, () -> EnumColor.DARK_RED));
addButton(new GuiBigLight(this, 173, 76, tile.getMultiblock()::isActive));
addButton(new GuiDynamicHorizontalRateBar(this, new IBarInfoHandler() {
@Override
public ITextComponent getTooltip() {
return MekanismUtils.getTemperatureDisplay(tile.getMultiblock().heatCapacitor.getTemperature(), TemperatureUnit.KELVIN, true);
}
@Override
public double getLevel() {
return Math.min(1, tile.getMultiblock().heatCapacitor.getTemperature() / FissionReactorMultiblockData.MAX_DAMAGE_TEMPERATURE);
}
}, 5, 102, imageWidth - 12));
heatGraph = addButton(new GuiGraph(this, 5, 123, imageWidth - 10, 38, temp -> MekanismUtils.getTemperatureDisplay(temp, TemperatureUnit.KELVIN, true)));
heatGraph.setMinScale(1_600);
updateButtons();
}
Aggregations