Skip to content

Commit 6e486e5

Browse files
committed
add helper method for array access
1 parent b7de2a6 commit 6e486e5

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ protected void createFuelTooltip(@NotNull RichTooltip tooltip, @NotNull FixedInt
209209
tooltip.addLine(IKey.lang("gregtech.multiblock.large_combustion_engine.fuel_none"));
210210
} else {
211211
tooltip.addLine(
212-
IKey.lang("gregtech.multiblock.large_combustion_engine.fuel_amount", amounts.getValue()[0],
213-
amounts.getValue()[1], fluid.getLocalizedName(new FluidStack(fluid, 1))));
212+
IKey.lang("gregtech.multiblock.large_combustion_engine.fuel_amount", amounts.getValue(0),
213+
amounts.getValue(1), fluid.getLocalizedName(new FluidStack(fluid, 1))));
214214
}
215215
} else {
216216
tooltip.addLine(IKey.lang("gregtech.multiblock.invalid_structure"));

src/main/java/gregtech/api/mui/sync/FixedIntArraySyncValue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,8 @@ public void read(@NotNull PacketBuffer buffer) throws IOException {
8888
public int[] getValue() {
8989
return this.cache;
9090
}
91+
92+
public int getValue(int index) {
93+
return this.cache[index];
94+
}
9195
}

src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeCombustionEngine.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ public int getProgressBarCount() {
304304
panelSyncManager.syncValue("fuel_name", fuelNameValue);
305305

306306
yield new ProgressWidget()
307-
.progress(() -> fuelValue.getValue()[1] == 0 ? 0 :
308-
1.0 * fuelValue.getValue()[0] / fuelValue.getValue()[1])
307+
.progress(() -> fuelValue.getValue(1) == 0 ? 0 :
308+
1.0 * fuelValue.getValue(0) / fuelValue.getValue(1))
309309
.texture(GTGuiTextures.PROGRESS_BAR_LCE_FUEL, MultiblockUIFactory.Bars.THIRD_WIDTH)
310310
.tooltip(t -> t.setAutoUpdate(true))
311311
.tooltipBuilder(t -> createFuelTooltip(t, fuelValue, fuelNameValue));
@@ -315,17 +315,17 @@ yield new ProgressWidget()
315315
panelSyncManager.syncValue("lubricant_amount", lubricantValue);
316316

317317
yield new ProgressWidget()
318-
.progress(() -> lubricantValue.getValue()[1] == 0 ? 0 :
319-
1.0 * lubricantValue.getValue()[0] / lubricantValue.getValue()[1])
318+
.progress(() -> lubricantValue.getValue(1) == 0 ? 0 :
319+
1.0 * lubricantValue.getValue(0) / lubricantValue.getValue(1))
320320
.texture(GTGuiTextures.PROGRESS_BAR_LCE_LUBRICANT, MultiblockUIFactory.Bars.THIRD_WIDTH)
321321
.tooltip(tooltip -> tooltip.setAutoUpdate(true))
322322
.tooltipBuilder(t -> {
323323
if (isStructureFormed()) {
324-
if (lubricantValue.getValue()[0] == 0) {
324+
if (lubricantValue.getValue(0) == 0) {
325325
t.addLine(IKey.lang("gregtech.multiblock.large_combustion_engine.no_lubricant"));
326326
} else {
327327
t.addLine(IKey.lang("gregtech.multiblock.large_combustion_engine.lubricant_amount",
328-
lubricantValue.getValue()[0], lubricantValue.getValue()[1]));
328+
lubricantValue.getValue(0), lubricantValue.getValue(0)));
329329
}
330330
} else {
331331
t.addLine(IKey.lang("gregtech.multiblock.invalid_structure"));
@@ -339,22 +339,22 @@ yield new ProgressWidget()
339339
panelSyncManager.syncValue("boost_allowed", boostValue);
340340

341341
yield new ProgressWidget()
342-
.progress(() -> oxygenValue.getValue()[1] == 0 ? 0 :
343-
1.0 * oxygenValue.getValue()[0] / oxygenValue.getValue()[1])
342+
.progress(() -> oxygenValue.getValue(1) == 0 ? 0 :
343+
1.0 * oxygenValue.getValue(0) / oxygenValue.getValue(1))
344344
.texture(GTGuiTextures.PROGRESS_BAR_LCE_OXYGEN, MultiblockUIFactory.Bars.THIRD_WIDTH)
345345
.tooltipBuilder(t -> {
346346
t.setAutoUpdate(true);
347347
if (isStructureFormed()) {
348348
if (boostValue.getBoolValue()) {
349-
if (oxygenValue.getValue()[0] == 0) {
349+
if (oxygenValue.getValue(0) == 0) {
350350
t.addLine(IKey.lang("gregtech.multiblock.large_combustion_engine.oxygen_none"));
351351
} else if (isExtreme) {
352352
t.addLine(IKey.lang(
353353
"gregtech.multiblock.large_combustion_engine.liquid_oxygen_amount",
354-
oxygenValue.getValue()[0], oxygenValue.getValue()[1]));
354+
oxygenValue.getValue(0), oxygenValue.getValue(0)));
355355
} else {
356356
t.addLine(IKey.lang("gregtech.multiblock.large_combustion_engine.oxygen_amount",
357-
oxygenValue.getValue()[0], oxygenValue.getValue()[1]));
357+
oxygenValue.getValue(0), oxygenValue.getValue(1)));
358358
}
359359
} else if (isExtreme) {
360360
t.addLine(IKey.lang(

src/main/java/gregtech/common/metatileentities/multi/electric/generator/MetaTileEntityLargeTurbine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ public int getProgressBarCount() {
357357
panelSyncManager.syncValue("fuel_name", fuelNameValue);
358358

359359
yield new ProgressWidget()
360-
.progress(() -> fuelValue.getValue()[1] == 0 ? 0 :
361-
1.0 * fuelValue.getValue()[0] / fuelValue.getValue()[1])
360+
.progress(() -> fuelValue.getValue(1) == 0 ? 0 :
361+
1.0 * fuelValue.getValue(0) / fuelValue.getValue(1))
362362
.texture(GTGuiTextures.PROGRESS_BAR_LCE_FUEL, MultiblockUIFactory.Bars.THIRD_WIDTH)
363363
.tooltip(t -> t.setAutoUpdate(true))
364364
.tooltipBuilder(t -> createFuelTooltip(t, fuelValue, fuelNameValue));

0 commit comments

Comments
 (0)