Skip to content

Commit

Permalink
add warning tooltip to turbine dump button
Browse files Browse the repository at this point in the history
  • Loading branch information
thiakil committed Dec 12, 2023
1 parent 4b2537b commit b029d0f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.20.1 2023-06-19T13:24:07.5339045 Languages: en_us: mekanismgenerators
6a484f938ce474cfc39692d64a9688c02f306f01 assets/mekanismgenerators/lang/en_ud.json
18c3ba0c44bd4f32ed1a9986c094296c5c842f58 assets/mekanismgenerators/lang/en_us.json
// 1.20.1 2023-12-12T19:35:09.5503002 Languages: en_us: mekanismgenerators
bd1d92bf6ad86388196e02d445e98df286f73024 assets/mekanismgenerators/lang/en_ud.json
2f9f15b4fd8335b364c1f3a60730a43ca121e826 assets/mekanismgenerators/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@
"turbine.mekanismgenerators.stats.tank_volume": "%s :ǝɯnꞁoΛ ʞuɐ⟘",
"turbine.mekanismgenerators.stats.vents": "%2$s %1$s :sʇuǝΛ",
"turbine.mekanismgenerators.steam_input": "ʇ/ᗺɯ %s :ʇnduI ɯɐǝʇS",
"turbine.mekanismgenerators.tooltip.steamdump": "ɯɐǝʇS ᵷuᴉdɯnᗡ",
"turbine.mekanismgenerators.tooltip.steamdump.warning": "pǝꞁɔʎɔǝɹ ǝq ⟘ON ꞁꞁᴉʍ ɹǝʇɐM",
"turbine.mekanismgenerators.tooltip.steamdump_excess": "ɯɐǝʇS ssǝɔxǝ ᵷuᴉdɯnᗡ",
"wind_generator.mekanismgenerators.no_wind": "puᴉʍ oN",
"wind_generator.mekanismgenerators.sky_blocked": "pǝʞɔoꞁq ʎʞS"
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@
"turbine.mekanismgenerators.stats.tank_volume": "Tank Volume: %1$s",
"turbine.mekanismgenerators.stats.vents": "Vents: %1$s %2$s",
"turbine.mekanismgenerators.steam_input": "Steam Input: %1$s mB/t",
"turbine.mekanismgenerators.tooltip.steamdump": "Dumping Steam",
"turbine.mekanismgenerators.tooltip.steamdump.warning": "Water will NOT be recycled",
"turbine.mekanismgenerators.tooltip.steamdump_excess": "Dumping excess Steam",
"wind_generator.mekanismgenerators.no_wind": "No wind",
"wind_generator.mekanismgenerators.sky_blocked": "Sky blocked"
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ private void addMisc() {
add(GeneratorsLang.TURBINE_MAX_PRODUCTION, "Max Production: %1$s");
add(GeneratorsLang.TURBINE_STATS, "Turbine Statistics");
add(GeneratorsLang.TURBINE_VENTS, "Vents: %1$s %2$s");
add(GeneratorsLang.TURBINE_DUMPING_STEAM, "Dumping Steam");
add(GeneratorsLang.TURBINE_DUMPING_EXCESS_STEAM, "Dumping excess Steam");
add(GeneratorsLang.TURBINE_DUMPING_STEAM_WARNING, "Water will NOT be recycled");
//Fission Reactor
add(GeneratorsLang.FISSION_INVALID_BAD_CONTROL_ROD, "Couldn't form, improper placement for Control Rod Assembly at %1$s.");
add(GeneratorsLang.FISSION_INVALID_MISSING_CONTROL_ROD, "Couldn't form, missing control rod for fuel assembly at %1$s.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.util.ArrayList;
import java.util.List;
import mekanism.api.text.EnumColor;
import mekanism.client.gui.GuiMekanismTile;
import mekanism.client.gui.element.GuiElement;
import mekanism.client.gui.element.GuiInnerScreen;
import mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler;
import mekanism.client.gui.element.bar.GuiVerticalPowerBar;
Expand All @@ -14,6 +16,7 @@
import mekanism.common.MekanismLang;
import mekanism.common.config.MekanismConfig;
import mekanism.common.inventory.container.tile.MekanismTileContainer;
import mekanism.common.tile.TileEntityChemicalTank.GasMode;
import mekanism.common.util.text.EnergyDisplay;
import mekanism.common.util.text.TextUtils;
import mekanism.generators.client.gui.element.GuiTurbineTab;
Expand Down Expand Up @@ -107,7 +110,7 @@ public double getLevel() {
}
return List.of(MekanismLang.STORING.translate(storing), GeneratorsLang.PRODUCING_AMOUNT.translate(producing));
}));
addRenderableWidget(new GuiGasMode(this, 159, 72, true, () -> tile.getMultiblock().dumpMode, tile.getBlockPos(), 0));
addRenderableWidget(new GuiGasMode(this, 159, 72, true, () -> tile.getMultiblock().dumpMode, tile.getBlockPos(), 0, this::dumpModeTooltip));
}

@Override
Expand All @@ -116,4 +119,12 @@ protected void drawForegroundText(@NotNull GuiGraphics guiGraphics, int mouseX,
drawString(guiGraphics, playerInventoryTitle, inventoryLabelX, inventoryLabelY, titleTextColor());
super.drawForegroundText(guiGraphics, mouseX, mouseY);
}

private void dumpModeTooltip(GuiElement element, GuiGraphics guiGraphics, int mouseX, int mouseY) {
GasMode dumpMode = tile.getMultiblock().dumpMode;
if (dumpMode != GasMode.IDLE) {
GeneratorsLang firstLine = dumpMode == GasMode.DUMPING_EXCESS ? GeneratorsLang.TURBINE_DUMPING_EXCESS_STEAM : GeneratorsLang.TURBINE_DUMPING_STEAM;
displayTooltips(guiGraphics, mouseX, mouseY, firstLine.translate(), GeneratorsLang.TURBINE_DUMPING_STEAM_WARNING.translateColored(EnumColor.RED));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public enum GeneratorsLang implements ILangEntry {
TURBINE_MAX_FLOW("turbine", "stats.max_flow"),
TURBINE_MAX_PRODUCTION("turbine", "stats.max_production"),
TURBINE_PRODUCTION("turbine", "stats.production"),
TURBINE_DUMPING_STEAM("turbine", "tooltip.steamdump"),
TURBINE_DUMPING_EXCESS_STEAM("turbine", "tooltip.steamdump_excess"),
TURBINE_DUMPING_STEAM_WARNING("turbine", "tooltip.steamdump.warning"),

FISSION_INVALID_BAD_CONTROL_ROD("fission", "invalid_bad_control_rod"),
FISSION_INVALID_MISSING_CONTROL_ROD("fission", "missing_control_rod"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public class GuiGasMode extends MekanismImageButton {
private final Supplier<GasMode> gasModeSupplier;

public GuiGasMode(IGuiWrapper gui, int x, int y, boolean left, Supplier<GasMode> gasModeSupplier, BlockPos pos, int tank) {
super(gui, x, y, 10, IDLE, () -> Mekanism.packetHandler().sendToServer(new PacketGuiInteract(GuiInteraction.GAS_MODE_BUTTON, pos, tank)));
this(gui, x, y, left, gasModeSupplier, pos, tank, null);
}

public GuiGasMode(IGuiWrapper gui, int x, int y, boolean left, Supplier<GasMode> gasModeSupplier, BlockPos pos, int tank, IHoverable onHover) {
super(gui, x, y, 10, IDLE, () -> Mekanism.packetHandler().sendToServer(new PacketGuiInteract(GuiInteraction.GAS_MODE_BUTTON, pos, tank)), onHover);
this.left = left;
this.gasModeSupplier = gasModeSupplier;
}
Expand Down

0 comments on commit b029d0f

Please sign in to comment.