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

More accurate Waila status line for steam machines with obstructed vents #3848

Merged
merged 1 commit into from
Jan 22, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import net.minecraftforge.fluids.IFluidHandler;

import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;

import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.math.Pos2d;
Expand Down Expand Up @@ -1185,7 +1186,7 @@ public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDat
final NBTTagCompound tag = accessor.getNBTData();

if (tag.getBoolean("stutteringSingleBlock")) {
currenttip.add("Status: insufficient energy");
currenttip.add(StatCollector.translateToLocal(getWailaStutteringLine(tag)));
} else {
boolean isActive = tag.getBoolean("isActiveSingleBlock");
if (isActive) {
Expand Down Expand Up @@ -1243,6 +1244,11 @@ public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDat
.name()));
}

private static @NotNull String getWailaStutteringLine(NBTTagCompound tag) {
return tag.getBoolean("blockedSteamVentSingleBlock") ? "GT5U.waila.status.obstructed_steam_vent"
: "GT5U.waila.status.insufficient_energy";
}

@Override
public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y,
int z) {
Expand All @@ -1252,6 +1258,7 @@ public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompou
tag.setInteger("maxProgressSingleBlock", mMaxProgresstime);
tag.setInteger("mainFacingSingleBlock", mMainFacing.ordinal());
tag.setBoolean("stutteringSingleBlock", mStuttering);
tag.setBoolean("blockedSteamVentSingleBlock", cannotVentSteam());

final IGregTechTileEntity tileEntity = getBaseMetaTileEntity();
if (tileEntity != null) {
Expand Down Expand Up @@ -1565,7 +1572,7 @@ protected List<String> getErrorDescriptionsShift() {

protected GTTooltipDataCache.TooltipData getErrorTooltip() {
if (isSteampowered()) {
if ((getBaseMetaTileEntity().getErrorDisplayID() & 64) != 0) {
if (cannotVentSteam()) {
return mTooltipCache.getData(STALLED_VENT_TOOLTIP);
}
}
Expand All @@ -1577,6 +1584,10 @@ protected GTTooltipDataCache.TooltipData getErrorTooltip() {
return null;
}

private boolean cannotVentSteam() {
return (getBaseMetaTileEntity().getErrorDisplayID() & 64) != 0;
}

protected static int getCapacityForTier(int tier) {
return switch (tier) {
case 0 -> 8000;
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/gregtech/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,8 @@ GT5U.waila.producing=Producing:
GT5U.waila.producing.andmore= And %d More...
GT5U.waila.generating.on=Generating Energy
GT5U.waila.generating.off=Not Generating
GT5U.waila.status.insufficient_energy=Status: Insufficient energy
GT5U.waila.status.obstructed_steam_vent=Status: Obstructed steam vent


achievement.flintpick=First Tools
Expand Down
Loading