From e813b56e9a9485c8c4dfc0d2ce464f7e0db64aa5 Mon Sep 17 00:00:00 2001 From: Abdiel Kavash <19243993+AbdielKavash@users.noreply.github.com> Date: Wed, 3 Apr 2024 03:05:24 -0600 Subject: 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 --- .../multi/GT_MetaTileEntity_OilDrillBase.java | 34 +++++++--------------- 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'src') 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 -- cgit