Skip to content

Commit

Permalink
Add NEITHER SteamMode to hide energy cost of recipes (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swedz authored Jan 1, 2025
1 parent f985db2 commit 38104ab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import aztech.modern_industrialization.MIText;
import aztech.modern_industrialization.MITooltips;
import aztech.modern_industrialization.compat.rei.machines.MachineCategoryParams;
import aztech.modern_industrialization.compat.rei.machines.SteamMode;
import aztech.modern_industrialization.compat.viewer.abstraction.ViewerCategory;
import aztech.modern_industrialization.inventory.SlotPositions;
import aztech.modern_industrialization.machines.gui.MachineScreen;
Expand Down Expand Up @@ -206,9 +207,11 @@ public void buildWidgets(RecipeHolder<MachineRecipe> recipeHolder, WidgetList wi

guiGraphics.pose().popPose();
});
widgets.text(
TextHelper.getEuTextTick(recipe.eu),
15 + (params.steamMode.steam ? 2 : 0), 5, TextAlign.LEFT, false, true, null);
if (params.steamMode != SteamMode.NEITHER) {
widgets.text(
TextHelper.getEuTextTick(recipe.eu),
15 + (params.steamMode.steam ? 2 : 0), 5, TextAlign.LEFT, false, true, null);
}
widgets.text(
MIText.BaseDurationSeconds.text(getSeconds(recipe)),
width - 5, 5, TextAlign.RIGHT, false, true, null);
Expand All @@ -235,7 +238,9 @@ public void buildWidgets(RecipeHolder<MachineRecipe> recipeHolder, WidgetList wi
}
// Tooltips
List<Component> tooltips = new ArrayList<>();
tooltips.add(MIText.BaseEuTotal.text(TextHelper.getEuText((long) recipe.duration * recipe.eu)));
if (params.steamMode != SteamMode.NEITHER) {
tooltips.add(MIText.BaseEuTotal.text(TextHelper.getEuText((long) recipe.duration * recipe.eu)));
}
if (params.steamMode.steam) {
tooltips.add((params.steamMode.electric ? MIText.AcceptsSteamToo : MIText.AcceptsSteam).text().withStyle(ChatFormatting.GRAY));
if (steelHatchRequired) {
Expand All @@ -251,7 +256,9 @@ public void buildWidgets(RecipeHolder<MachineRecipe> recipeHolder, WidgetList wi
condition.appendDescription(tooltips);
}
}
widgets.tooltip(2, 5, width - 10, 11, tooltips);
if (!tooltips.isEmpty()) {
widgets.tooltip(2, 5, width - 10, 11, tooltips);
}
}

private double getSeconds(MachineRecipe recipe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
public enum SteamMode {
STEAM_ONLY(true, false),
ELECTRIC_ONLY(false, true),
BOTH(true, true);
BOTH(true, true),
NEITHER(false, false);

public final boolean steam;
public final boolean electric;
Expand Down

0 comments on commit 38104ab

Please sign in to comment.