Skip to content

Commit 2fc3483

Browse files
authored
Fix Large Boiler and Steam Machines giving incorrect info in TheOneProbe/HWYLA (GregTechCEu#2001)
1 parent 4412c71 commit 2fc3483

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

src/main/java/gregtech/api/capability/impl/BoilerRecipeLogic.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,16 @@ public void setLastTickSteam(int lastTickSteamOutput) {
204204
this.lastTickSteamOutput = lastTickSteamOutput;
205205
}
206206

207+
@Override
208+
public int getInfoProviderEUt() {
209+
return this.lastTickSteamOutput;
210+
}
211+
212+
@Override
213+
public boolean consumesEnergy() {
214+
return false;
215+
}
216+
207217
public void invalidate() {
208218
progressTime = 0;
209219
maxProgressTime = 0;

src/main/java/gregtech/integration/hwyla/provider/RecipeLogicDataProvider.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
import gregtech.api.capability.impl.AbstractRecipeLogic;
66
import gregtech.api.metatileentity.SteamMetaTileEntity;
77
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
8+
import gregtech.api.unification.material.Materials;
89
import gregtech.api.util.GTUtility;
10+
import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler;
911
import mcp.mobius.waila.api.IWailaConfigHandler;
1012
import mcp.mobius.waila.api.IWailaDataAccessor;
1113
import mcp.mobius.waila.api.IWailaRegistrar;
@@ -58,18 +60,25 @@ public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWai
5860
if (tag.getBoolean("Working")) {
5961
int EUt = tag.getInteger("RecipeEUt");
6062
int absEUt = Math.abs(EUt);
63+
boolean consumer = EUt > 0;
6164
String endText = null;
6265

6366
if (accessor.getTileEntity() instanceof IGregTechTileEntity gtte) {
64-
if (gtte.getMetaTileEntity() instanceof SteamMetaTileEntity) {
65-
endText = ": " + absEUt + TextFormatting.RESET + " L/t " + I18n.format("material.steam");
67+
if (gtte.getMetaTileEntity() instanceof SteamMetaTileEntity || gtte.getMetaTileEntity() instanceof MetaTileEntityLargeBoiler) {
68+
endText = ": " + absEUt + TextFormatting.RESET + " L/t " + I18n.format("gregtech.top.steam")+ " " + I18n.format(Materials.Steam.getUnlocalizedName());
69+
}
70+
AbstractRecipeLogic arl = gtte.getMetaTileEntity().getRecipeLogic();
71+
if (arl != null) {
72+
consumer = arl.consumesEnergy();
6673
}
6774
}
6875
if (endText == null) {
6976
endText = ": " + absEUt + TextFormatting.RESET + " EU/t (" + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.RESET + ")";
7077
}
7178

72-
if (EUt > 0) {
79+
if (EUt == 0) return tooltip;
80+
81+
if (consumer) {
7382
tooltip.add(I18n.format("gregtech.top.energy_consumption") + endText);
7483
} else {
7584
tooltip.add(I18n.format("gregtech.top.energy_production") + endText);

src/main/java/gregtech/integration/theoneprobe/provider/RecipeLogicInfoProvider.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import gregtech.api.metatileentity.MetaTileEntity;
88
import gregtech.api.metatileentity.SteamMetaTileEntity;
99
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
10+
import gregtech.api.unification.material.Materials;
1011
import gregtech.api.util.GTUtility;
12+
import gregtech.common.metatileentities.multi.MetaTileEntityLargeBoiler;
1113
import mcjty.theoneprobe.api.IProbeHitData;
1214
import mcjty.theoneprobe.api.IProbeInfo;
1315
import mcjty.theoneprobe.api.TextStyleClass;
@@ -40,23 +42,26 @@ protected void addProbeInfo(@Nonnull AbstractRecipeLogic capability, @Nonnull IP
4042
}
4143
int EUt = capability.getInfoProviderEUt();
4244
int absEUt = Math.abs(EUt);
45+
boolean consumer = capability.consumesEnergy();
4346
String text = null;
4447

4548
if (tileEntity instanceof IGregTechTileEntity) {
4649
IGregTechTileEntity gtTileEntity = (IGregTechTileEntity) tileEntity;
4750
MetaTileEntity mte = gtTileEntity.getMetaTileEntity();
48-
if (mte instanceof SteamMetaTileEntity) {
49-
text = TextFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " L/t " + "{*material.steam*}";
51+
if (mte instanceof SteamMetaTileEntity || mte instanceof MetaTileEntityLargeBoiler) {
52+
text = TextFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " L/t {*gregtech.top.steam*} {*" + Materials.Steam.getUnlocalizedName() + "*}";
5053
}
5154
}
5255
if (text == null) {
5356
// Default behavior, if this TE is not a steam machine (or somehow not instanceof IGregTechTileEntity...)
5457
text = TextFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " EU/t" + TextFormatting.GREEN + " (" + GTValues.VNF[GTUtility.getTierByVoltage(absEUt)] + TextFormatting.GREEN + ")";
5558
}
5659

57-
if (EUt > 0) {
60+
if (EUt == 0) return; // idk what to do for 0 eut
61+
62+
if (consumer) {
5863
probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.energy_consumption*} " + text);
59-
} else if (EUt < 0) {
64+
} else {
6065
probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.energy_production*} " + text);
6166
}
6267
}

src/main/resources/assets/gregtech/lang/en_us.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ gregtech.top.working_disabled=Working Disabled
5757

5858
gregtech.top.energy_consumption=Using
5959
gregtech.top.energy_production=Producing
60+
gregtech.top.steam=of
6061

6162
gregtech.top.transform_up=Step Up
6263
gregtech.top.transform_down=Step Down

0 commit comments

Comments
 (0)