Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show average power I/O in substation in amps as well as EU/t. #2762

Open
wants to merge 2 commits into
base: 1.20.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -3288,9 +3288,9 @@
"gtceu.multiblock.pattern.location_end": "ɹ§puƎ ʎɹǝΛɔ§",
"gtceu.multiblock.pattern.replaceable_air": "ɹıⱯ ʎq ǝןqɐǝɔɐןdǝᴚ",
"gtceu.multiblock.pattern.single": "ɹ§pǝsn ǝq uɐɔ ʞɔoןq sıɥʇ ʎןuO9§",
"gtceu.multiblock.power_substation.average_in": "ʇ/∩Ǝㄥ§ %s :ʇnduI ˙bʌⱯㄥ§",
"gtceu.multiblock.power_substation.average_in": "%s Ɐ %s \nʇ/∩Ǝㄥ§ %s :ʇnduI ˙bʌⱯㄥ§",
"gtceu.multiblock.power_substation.average_in_hover": "ʞuɐq ʎbɹǝuǝ ןɐuɹǝʇuı s,uoıʇɐʇsqnS ɹǝʍoԀ ǝɥʇ oʇuı ∩Ǝ pǝʇɹǝsuı ǝbɐɹǝʌɐ ǝɥ⟘",
"gtceu.multiblock.power_substation.average_out": "ʇ/∩Ǝㄥ§ %s :ʇndʇnO ˙bʌⱯㄥ§",
"gtceu.multiblock.power_substation.average_out": "%s Ɐ %s \nʇ/∩Ǝㄥ§ %s :ʇndʇnO ˙bʌⱯㄥ§",
"gtceu.multiblock.power_substation.average_out_hover": "ʞuɐq ʎbɹǝuǝ ןɐuɹǝʇuı s,uoıʇɐʇsqnS ɹǝʍoԀ ǝɥʇ ɟo ʇno ∩Ǝ pǝʇɔɐɹʇxǝ ǝbɐɹǝʌɐ ǝɥ⟘",
"gtceu.multiblock.power_substation.capacity": "∩Ǝㄥ§ %s :ʎʇıɔɐdɐƆㄥ§",
"gtceu.multiblock.power_substation.passive_drain": "ʇ/∩Ǝㄥ§ %s :uıɐɹᗡ ǝʌıssɐԀㄥ§",
Expand Down
4 changes: 2 additions & 2 deletions src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -3288,9 +3288,9 @@
"gtceu.multiblock.pattern.location_end": "§cVery End§r",
"gtceu.multiblock.pattern.replaceable_air": "Replaceable by Air",
"gtceu.multiblock.pattern.single": "§6Only this block can be used§r",
"gtceu.multiblock.power_substation.average_in": "§7Avg. Input: %s §7EU/t",
"gtceu.multiblock.power_substation.average_in": "§7Avg. Input: %s §7EU/t\n %s A %s",
"gtceu.multiblock.power_substation.average_in_hover": "The average inserted EU into the Power Substation's internal energy bank",
"gtceu.multiblock.power_substation.average_out": "§7Avg. Output: %s §7EU/t",
"gtceu.multiblock.power_substation.average_out": "§7Avg. Output: %s §7EU/t\n %s A %s",
"gtceu.multiblock.power_substation.average_out_hover": "The average extracted EU out of the Power Substation's internal energy bank",
"gtceu.multiblock.power_substation.capacity": "§7Capacity: %s §7EU",
"gtceu.multiblock.power_substation.passive_drain": "§7Passive Drain: %s §7EU/t",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.common.machine.multiblock.electric;

import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.capability.IEnergyContainer;
import com.gregtechceu.gtceu.api.capability.IEnergyInfoProvider;
import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability;
Expand All @@ -22,6 +23,7 @@
import com.gregtechceu.gtceu.api.misc.EnergyContainerList;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.utils.FormattingUtil;
import com.gregtechceu.gtceu.utils.GTUtil;

import com.lowdragmc.lowdraglib.gui.modular.ModularUI;
import com.lowdragmc.lowdraglib.gui.widget.*;
Expand Down Expand Up @@ -191,26 +193,12 @@ protected void transferEnergyTick() {
public void addDisplayText(List<Component> textList) {
IDisplayUIMachine.super.addDisplayText(textList);
if (isFormed()) {
if (!isWorkingEnabled()) {
textList.add(Component.translatable("gtceu.multiblock.work_paused"));

} else if (isActive()) {
if (isActive()) {
textList.add(Component.translatable("gtceu.multiblock.running"));
int currentProgress = (int) (recipeLogic.getProgressPercent() * 100);
double maxInSec = (float) recipeLogic.getDuration() / 20.0f;
double currentInSec = (float) recipeLogic.getProgress() / 20.0f;
textList.add(
Component.translatable("gtceu.multiblock.progress", String.format("%.2f", (float) currentInSec),
String.format("%.2f", (float) maxInSec), currentProgress));
} else {
textList.add(Component.translatable("gtceu.multiblock.idling"));
}

if (recipeLogic.isWaiting()) {
textList.add(Component.translatable("gtceu.multiblock.waiting")
.setStyle(Style.EMPTY.withColor(ChatFormatting.RED)));
}

if (energyBank != null) {
BigInteger energyStored = energyBank.getStored();
BigInteger energyCapacity = energyBank.getCapacity();
Expand All @@ -233,16 +221,24 @@ public void addDisplayText(List<Component> textList) {
passiveDrainComponent.setStyle(STYLE_DARK_RED)));

var avgInComponent = Component.literal(FormattingUtil.formatNumbers(averageInLastSec));
var avgInVoltage = GTUtil.getFloorTierByVoltage(averageInLastSec);
var avgInAmperage = averageInLastSec / (double) GTValues.VEX[avgInVoltage];
textList.add(Component
.translatable("gtceu.multiblock.power_substation.average_in",
avgInComponent.setStyle(STYLE_GREEN))
avgInComponent.setStyle(STYLE_GREEN),
Component.literal(FormattingUtil.DECIMAL_FORMAT_1F.format(avgInAmperage)),
Component.literal(GTValues.VNF[avgInVoltage]))
.withStyle(Style.EMPTY.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
Component.translatable("gtceu.multiblock.power_substation.average_in_hover")))));

var avgOutComponent = Component.literal(FormattingUtil.formatNumbers(Math.abs(averageOutLastSec)));
var avgOutVoltage = GTUtil.getFloorTierByVoltage(averageOutLastSec);
var avgOutAmperage = averageOutLastSec / (double) GTValues.VEX[avgOutVoltage];
textList.add(Component
.translatable("gtceu.multiblock.power_substation.average_out",
avgOutComponent.setStyle(STYLE_RED))
avgOutComponent.setStyle(STYLE_RED),
Component.literal(FormattingUtil.DECIMAL_FORMAT_1F.format(avgOutAmperage)),
Component.literal(GTValues.VNF[avgOutVoltage]))
.withStyle(Style.EMPTY.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
Component.translatable("gtceu.multiblock.power_substation.average_out_hover")))));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,10 +915,10 @@ protected static void init(RegistrateLangProvider provider) {
provider.add("gtceu.multiblock.power_substation.stored", "§7Stored: %s §7EU");
provider.add("gtceu.multiblock.power_substation.capacity", "§7Capacity: %s §7EU");
provider.add("gtceu.multiblock.power_substation.passive_drain", "§7Passive Drain: %s §7EU/t");
provider.add("gtceu.multiblock.power_substation.average_in", "§7Avg. Input: %s §7EU/t");
provider.add("gtceu.multiblock.power_substation.average_in", "§7Avg. Input: %s §7EU/t\n %s A %s");
provider.add("gtceu.multiblock.power_substation.average_in_hover",
"The average inserted EU into the Power Substation's internal energy bank");
provider.add("gtceu.multiblock.power_substation.average_out", "§7Avg. Output: %s §7EU/t");
provider.add("gtceu.multiblock.power_substation.average_out", "§7Avg. Output: %s §7EU/t\n %s A %s");
provider.add("gtceu.multiblock.power_substation.average_out_hover",
"The average extracted EU out of the Power Substation's internal energy bank");
provider.add("gtceu.multiblock.power_substation.time_to_fill", "§7Time to fill: %s");
Expand Down
Loading