Skip to content

Commit

Permalink
Show "Working Disabled" instead of "Idle" when machine is soft mallet…
Browse files Browse the repository at this point in the history
…ed (#3780)

Co-authored-by: Martin Robertz <[email protected]>
  • Loading branch information
serenibyss and Dream-Master authored Jan 10, 2025
1 parent a863f08 commit 6ce7bf8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/main/java/ggfab/mte/MTEAdvAssLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDat
NBTTagCompound tag = accessor.getNBTData();
String machineProgressString = GTWaila.getMachineProgressString(
tag.getBoolean("isActive"),
tag.getBoolean("isAllowedToWork"),
tag.getInteger("maxProgress"),
tag.getInteger("progress"));
currentTip.remove(machineProgressString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@ public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDat
currenttip.add(
GTWaila.getMachineProgressString(
isActive,
tag.getBoolean("isAllowedToWorkSingleBlock"),
tag.getInteger("maxProgressSingleBlock"),
tag.getInteger("progressSingleBlock")));
}
Expand Down Expand Up @@ -1255,6 +1256,7 @@ public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompou
final IGregTechTileEntity tileEntity = getBaseMetaTileEntity();
if (tileEntity != null) {
tag.setBoolean("isActiveSingleBlock", tileEntity.isActive());
tag.setBoolean("isAllowedToWorkSingleBlock", tileEntity.isAllowedToWork());
tag.setInteger(
"outputFacingSingleBlock",
tileEntity.getFrontFacing()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ protected int getMaxBatchSize() {

/**
* Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block)
*
*
* @param aStack what is in controller
*/
public int getPollutionPerTick(ItemStack aStack) {
Expand All @@ -1019,7 +1019,7 @@ public int getPollutionPerTick(ItemStack aStack) {
* the code of the multiblock.
*
* This returns the unmodified raw pollution value, not the one after muffler discounts.
*
*
* @param aStack what is in controller
*/
public int getPollutionPerSecond(ItemStack aStack) {
Expand Down Expand Up @@ -2049,8 +2049,12 @@ public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDat
}
}
}
currentTip
.add(GTWaila.getMachineProgressString(isActive, tag.getInteger("maxProgress"), tag.getInteger("progress")));
currentTip.add(
GTWaila.getMachineProgressString(
isActive,
tag.getBoolean("isAllowedToWork"),
tag.getInteger("maxProgress"),
tag.getInteger("progress")));
// Show ns on the tooltip
if (GTMod.gregtechproxy.wailaAverageNS && tag.hasKey("averageNS")) {
int tAverageTime = tag.getInteger("averageNS");
Expand Down Expand Up @@ -2099,6 +2103,7 @@ public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompou
final IGregTechTileEntity tileEntity = getBaseMetaTileEntity();
if (tileEntity != null) {
tag.setBoolean("isActive", tileEntity.isActive());
tag.setBoolean("isAllowedToWork", tileEntity.isAllowedToWork());
if (tileEntity.isActive()) {
if (mEUt < 0) tag.setLong("energyUsage", getActualEnergyUsage());
else tag.setLong("energyUsage", (long) -mEUt * mEfficiency / 10000);
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/gregtech/api/util/GTWaila.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,22 @@
public abstract class GTWaila {

public static String getMachineProgressString(boolean isActive, int maxProgresstime, int progresstime) {
return getMachineProgressString(isActive, maxProgresstime, (long) progresstime);
return getMachineProgressString(isActive, true, maxProgresstime, (long) progresstime);
}

public static String getMachineProgressString(boolean isActive, boolean isAllowedToWork, int maxProgresstime,
int progresstime) {
return getMachineProgressString(isActive, isAllowedToWork, maxProgresstime, (long) progresstime);
}

public static String getMachineProgressString(boolean isActive, long maxProgresstime, long progresstime) {
return getMachineProgressString(isActive, true, maxProgresstime, progresstime);
}

public static String getMachineProgressString(boolean isActive, boolean isAllowedToWork, long maxProgresstime,
long progresstime) {

if (!isAllowedToWork) return "Working Disabled";
if (!isActive) return "Idle";

return "In progress: " + String.format("%,.1f", (double) progresstime / 20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,12 @@ public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDat
.translateToLocalFormatted("GTPP.waila.steam.use", formatNumbers(actualEnergyUsage * 20)));
}
}
currentTip
.add(GTWaila.getMachineProgressString(isActive, tag.getInteger("maxProgress"), tag.getInteger("progress")));
currentTip.add(
GTWaila.getMachineProgressString(
isActive,
tag.getBoolean("isAllowedToWork"),
tag.getInteger("maxProgress"),
tag.getInteger("progress")));
// Show ns on the tooltip
if (GTMod.gregtechproxy.wailaAverageNS && tag.hasKey("averageNS")) {
int tAverageTime = tag.getInteger("averageNS");
Expand Down

0 comments on commit 6ce7bf8

Please sign in to comment.