Skip to content

Commit 79403b7

Browse files
committed
Update to MUI 3.0.5
1 parent f9a10b5 commit 79403b7

6 files changed

Lines changed: 23 additions & 6 deletions

File tree

dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
dependencies {
4141
// Published dependencies
4242
api("codechicken:codechickenlib:3.2.3.358")
43-
api("com.cleanroommc:modularui:3.0.4") { transitive = false }
43+
api("com.cleanroommc:modularui:3.0.5") { transitive = false }
4444
api("com.cleanroommc:groovyscript:1.2.0-hotfix1") { transitive = false }
4545
api("curse.maven:inventory-bogosorter-632327:7102721-deobf-6717233-sources-6717234") // Inventory BogoSorter − v1.5.0
4646
api("curse.maven:key-binding-patch-928895:5951859") // Key Binding Patch v1.3.3.3, needed by Inventory BogoSorter v1.5.0+

src/main/java/gregtech/api/mui/GregTechGuiScreen.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
public class GregTechGuiScreen extends ModularScreen implements RecipeViewerRecipeTransferHandler {
2828

2929
// Stores lists of higher priority recipe receivers to the left of the tree
30+
@SideOnly(Side.CLIENT)
3031
private static final Int2ObjectMap<Map<String, IRecipeTransferReceiver>> registeredRecipeTransferReceivers = new Int2ObjectAVLTreeMap<>(
3132
IntComparators.OPPOSITE_COMPARATOR);
3233

@@ -81,6 +82,7 @@ public IRecipeTransferError transferRecipe(IRecipeLayout recipeLayout, boolean m
8182
*
8283
* @throws IllegalArgumentException if a receiver with the given key already exists.
8384
*/
85+
@SideOnly(Side.CLIENT)
8486
public static void registerRecipeTransferHandler(@NotNull String key,
8587
@NotNull IRecipeTransferReceiver transferReceiver) {
8688
registerRecipeTransferHandler(key, transferReceiver, 0);
@@ -96,6 +98,7 @@ public static void registerRecipeTransferHandler(@NotNull String key,
9698
*
9799
* @throws IllegalArgumentException if a receiver with the given key already exists.
98100
*/
101+
@SideOnly(Side.CLIENT)
99102
public static void registerRecipeTransferHandler(@NotNull String key,
100103
@NotNull IRecipeTransferReceiver transferReceiver,
101104
int priority) {
@@ -115,6 +118,7 @@ public static void registerRecipeTransferHandler(@NotNull String key,
115118
*
116119
* @throws IllegalArgumentException if no receiver exists with the given key.
117120
*/
121+
@SideOnly(Side.CLIENT)
118122
public static void removeRecipeTransferHandler(@NotNull String key) {
119123
for (Map<String, IRecipeTransferReceiver> subMap : registeredRecipeTransferReceivers.values()) {
120124
if (subMap.containsKey(key)) {

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public class FixedIntArraySyncValue extends ValueSyncHandler<int[]> {
2525
private final Supplier<int[]> getter;
2626
private final @Nullable Consumer<int[]> setter;
2727

28+
public FixedIntArraySyncValue(@NotNull Supplier<int[]> getter) {
29+
this(getter, null);
30+
}
31+
2832
public FixedIntArraySyncValue(@NotNull Supplier<int[]> getter, @Nullable Consumer<int[]> setter) {
2933
this.getter = Objects.requireNonNull(getter);
3034
this.setter = setter;
@@ -70,6 +74,11 @@ public boolean updateCacheFromSource(boolean isFirstSync) {
7074
return false;
7175
}
7276

77+
@Override
78+
public void notifyUpdate() {
79+
setValue(this.getter.get(), false, true);
80+
}
81+
7382
@Override
7483
public void write(@NotNull PacketBuffer buffer) throws IOException {
7584
for (int i : cache) {
@@ -92,4 +101,9 @@ public int[] getValue() {
92101
public int getValue(int index) {
93102
return this.cache[index];
94103
}
104+
105+
@Override
106+
public Class<int[]> getValueType() {
107+
return int[].class;
108+
}
95109
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ protected int getTransferHandlerPriority() {
2828
return 0;
2929
}
3030

31-
// TODO: this method is never actually called. Either fix on our side or wait for it to get fixed in MUI.
3231
@ApiStatus.OverrideOnly
3332
@MustBeInvokedByOverriders
3433
@Override

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public int getProgressBarCount() {
250250

251251
@Override
252252
public void registerBars(List<UnaryOperator<TemplateBarBuilder>> bars, PanelSyncManager syncManager) {
253-
FixedIntArraySyncValue fuelValue = new FixedIntArraySyncValue(this::getFuelAmount, null);
253+
FixedIntArraySyncValue fuelValue = new FixedIntArraySyncValue(this::getFuelAmount);
254254
syncManager.syncValue("fuel_amount", fuelValue);
255255
StringSyncValue fuelNameValue = new StringSyncValue(() -> {
256256
FluidStack stack = ((MultiblockFuelRecipeLogic) recipeMapWorkable).getInputFluidStack();
@@ -264,9 +264,9 @@ public void registerBars(List<UnaryOperator<TemplateBarBuilder>> bars, PanelSync
264264
return fluid.getName();
265265
});
266266
syncManager.syncValue("fuel_name", fuelNameValue);
267-
FixedIntArraySyncValue lubricantValue = new FixedIntArraySyncValue(this::getLubricantAmount, null);
267+
FixedIntArraySyncValue lubricantValue = new FixedIntArraySyncValue(this::getLubricantAmount);
268268
syncManager.syncValue("lubricant_amount", lubricantValue);
269-
FixedIntArraySyncValue oxygenValue = new FixedIntArraySyncValue(this::getOxygenAmount, null);
269+
FixedIntArraySyncValue oxygenValue = new FixedIntArraySyncValue(this::getOxygenAmount);
270270
syncManager.syncValue("oxygen_amount", oxygenValue);
271271
BooleanSyncValue boostValue = new BooleanSyncValue(this::isBoostAllowed);
272272
syncManager.syncValue("boost_allowed", boostValue);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public int getProgressBarCount() {
272272

273273
@Override
274274
public void registerBars(List<UnaryOperator<TemplateBarBuilder>> bars, PanelSyncManager syncManager) {
275-
FixedIntArraySyncValue fuelValue = new FixedIntArraySyncValue(this::getFuelAmount, null);
275+
FixedIntArraySyncValue fuelValue = new FixedIntArraySyncValue(this::getFuelAmount);
276276
StringSyncValue fuelNameValue = new StringSyncValue(() -> {
277277
FluidStack stack = ((MultiblockFuelRecipeLogic) recipeMapWorkable).getInputFluidStack();
278278
if (stack == null) {

0 commit comments

Comments
 (0)