aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAbdiel Kavash <19243993+AbdielKavash@users.noreply.github.com>2024-04-03 03:05:24 -0600
committerGitHub <noreply@github.com>2024-04-03 11:05:24 +0200
commite813b56e9a9485c8c4dfc0d2ce464f7e0db64aa5 (patch)
tree1267c1f5157a36cbafb10fbd3ae54a5acea4e840 /src
parentb4a574d069e6589bec90554f78da0a26db0176cb (diff)
downloadGT5-Unofficial-e813b56e9a9485c8c4dfc0d2ce464f7e0db64aa5.tar.gz
GT5-Unofficial-e813b56e9a9485c8c4dfc0d2ce464f7e0db64aa5.tar.bz2
GT5-Unofficial-e813b56e9a9485c8c4dfc0d2ce464f7e0db64aa5.zip
Fix the amount per operation reported in multiblock pump UI. (#2559)
* Fix the amount per operation reported in multiblock pump UI. * why write many code when few code do trick
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
index c4028f1819..075b4e19a1 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
@@ -404,7 +404,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
"GT5U.gui.text.pump_rate.1",
EnumChatFormatting.AQUA + numberFormat.format(getFlowRatePerTick()))
+ StatCollector.translateToLocal("GT5U.gui.text.pump_rate.2"),
- getReservoirContents() + StatCollector.translateToLocal("GT5U.gui.text.pump_recovery.2"));
+ mOilFlow + StatCollector.translateToLocal("GT5U.gui.text.pump_recovery.2"));
} else {
builder.add(failureReason);
}
@@ -438,22 +438,8 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
}
private @NotNull String clientFluidType = "";
- private int clientPumpRate = 0;
- private @NotNull String clientReservoirContents = "";
-
- @NotNull
- private String getReservoirContents() {
- int amount = 0;
- for (Chunk chunk : mOilFieldChunks) {
- final FluidStack fluidStack = undergroundOil(chunk, -1);
- if (fluidStack != null) {
- amount += fluidStack.amount;
- }
- }
-
- return StatCollector
- .translateToLocalFormatted("GT5U.gui.text.pump_recovery.1", GT_Utility.formatNumbers(amount));
- }
+ private int clientFlowPerTick = 0;
+ private int clientFlowPerOperation = 0;
protected static final NumberFormatMUI numberFormat = new NumberFormatMUI();
@@ -474,7 +460,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
() -> EnumChatFormatting.GRAY
+ StatCollector.translateToLocalFormatted(
"GT5U.gui.text.pump_rate.1",
- EnumChatFormatting.AQUA + numberFormat.format(clientPumpRate))
+ EnumChatFormatting.AQUA + numberFormat.format(clientFlowPerTick))
+ EnumChatFormatting.GRAY
+ StatCollector.translateToLocal("GT5U.gui.text.pump_rate.2"))
.setTextAlignment(Alignment.CenterLeft)
@@ -482,18 +468,18 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
.widget(
new TextWidget()
.setStringSupplier(
- () -> EnumChatFormatting.GRAY + clientReservoirContents
+ () -> EnumChatFormatting.GRAY
+ + StatCollector.translateToLocalFormatted(
+ "GT5U.gui.text.pump_recovery.1",
+ EnumChatFormatting.AQUA + numberFormat.format(clientFlowPerOperation))
+ EnumChatFormatting.GRAY
+ StatCollector.translateToLocal("GT5U.gui.text.pump_recovery.2"))
.setTextAlignment(Alignment.CenterLeft)
.setEnabled(widget -> getBaseMetaTileEntity().isActive() && workState == STATE_AT_BOTTOM))
.widget(new FakeSyncWidget.IntegerSyncer(() -> workState, newInt -> workState = newInt))
.widget(new FakeSyncWidget.StringSyncer(this::getFluidName, newString -> clientFluidType = newString))
- .widget(new FakeSyncWidget.IntegerSyncer(this::getFlowRatePerTick, newInt -> clientPumpRate = newInt))
- .widget(
- new FakeSyncWidget.StringSyncer(
- this::getReservoirContents,
- newString -> clientReservoirContents = newString));
+ .widget(new FakeSyncWidget.IntegerSyncer(this::getFlowRatePerTick, newInt -> clientFlowPerTick = newInt))
+ .widget(new FakeSyncWidget.IntegerSyncer(() -> mOilFlow, newInt -> clientFlowPerOperation = newInt));
}
@Override