use of mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler 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))));
}
use of mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler 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.bar.GuiBar.IBarInfoHandler 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();
}
use of mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler in project Mekanism by mekanism.
the class GuiIndustrialTurbine method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiInnerScreen(this, 50, 18, 112, 50, () -> {
List<ITextComponent> list = new ArrayList<>();
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
list.add(GeneratorsLang.TURBINE_PRODUCTION_AMOUNT.translate(EnergyDisplay.of(multiblock.getProductionRate())));
list.add(GeneratorsLang.TURBINE_FLOW_RATE.translate(TextUtils.format(multiblock.clientFlow)));
list.add(GeneratorsLang.TURBINE_CAPACITY.translate(TextUtils.format(multiblock.getSteamCapacity())));
list.add(GeneratorsLang.TURBINE_MAX_FLOW.translate(TextUtils.format(multiblock.getMaxFlowRate())));
}
return list;
}));
addButton(new GuiTurbineTab(this, tile, TurbineTab.STAT));
addButton(new GuiVerticalPowerBar(this, new IBarInfoHandler() {
@Override
public ITextComponent getTooltip() {
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
return EnergyDisplay.of(multiblock.energyContainer).getTextComponent();
}
return EnergyDisplay.ZERO.getTextComponent();
}
@Override
public double getLevel() {
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
return multiblock.energyContainer.getEnergy().divideToLevel(multiblock.energyContainer.getMaxEnergy());
}
return 1;
}
}, 164, 16));
addButton(new GuiVerticalRateBar(this, new IBarInfoHandler() {
@Override
public ITextComponent getTooltip() {
return GeneratorsLang.TURBINE_STEAM_INPUT_RATE.translate(TextUtils.format(tile.getMultiblock().lastSteamInput));
}
@Override
public double getLevel() {
TurbineMultiblockData multiblock = tile.getMultiblock();
if (!multiblock.isFormed()) {
return 0;
}
double rate = Math.min(multiblock.lowerVolume * multiblock.getDispersers() * MekanismGeneratorsConfig.generators.turbineDisperserGasFlow.get(), multiblock.vents * MekanismGeneratorsConfig.generators.turbineVentGasFlow.get());
if (rate == 0) {
return 0;
}
return Math.min(1, multiblock.lastSteamInput / rate);
}
}, 40, 13));
addButton(new GuiGasGauge(() -> tile.getMultiblock().gasTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.MEDIUM, this, 6, 13));
addButton(new GuiEnergyTab(this, () -> {
EnergyDisplay storing;
EnergyDisplay producing;
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
storing = EnergyDisplay.of(multiblock.energyContainer);
producing = EnergyDisplay.of(MekanismConfig.general.maxEnergyPerSteam.get().divide(TurbineValidator.MAX_BLADES).multiply(multiblock.clientFlow * Math.min(multiblock.blades, multiblock.coils * MekanismGeneratorsConfig.generators.turbineBladesPerCoil.get())));
} else {
storing = EnergyDisplay.ZERO;
producing = EnergyDisplay.ZERO;
}
return Arrays.asList(MekanismLang.STORING.translate(storing), GeneratorsLang.PRODUCING_AMOUNT.translate(producing));
}));
addButton(new GuiGasMode(this, 159, 72, true, () -> tile.getMultiblock().dumpMode, tile.getBlockPos(), 0));
}
use of mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler in project Mekanism by mekanism.
the class GuiFissionReactorStats method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiFissionReactorTab(this, tile, FissionReactorTab.MAIN));
addButton(new GuiDynamicHorizontalRateBar(this, new IBarInfoHandler() {
@Override
public ITextComponent getTooltip() {
return GeneratorsLang.GAS_BURN_RATE.translate(tile.getMultiblock().lastBurnRate);
}
@Override
public double getLevel() {
FissionReactorMultiblockData multiblock = tile.getMultiblock();
return Math.min(1, multiblock.lastBurnRate / multiblock.getMaxBurnRate());
}
}, 5, 114, imageWidth - 12));
rateLimitField = addButton(new GuiTextField(this, 77, 128, 49, 12));
rateLimitField.setEnterHandler(this::setRateLimit);
rateLimitField.setInputValidator(InputValidator.DECIMAL);
rateLimitField.setMaxStringLength(4);
rateLimitField.addCheckmarkButton(this::setRateLimit);
}
Aggregations