Skip to content

Commit

Permalink
Fix race condition for AE2WTLib integration
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed May 9, 2024
1 parent 1148dc8 commit 86a4ab2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gripe/_90/appliede/AppliedE.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public final class AppliedE {
public static final RegistryObject<Item> LEARNING_CARD = ITEMS.register("learning_card", () -> Upgrades.createUpgradeCardItem(new Item.Properties()));

public static final RegistryObject<Item> WIRELESS_TRANSMUTATION_TERMINAL = ITEMS.register("wireless_transmutation_terminal", () -> Addons.AE2WTLIB.isLoaded()
? AE2WTIntegration.createWirelessTerminalItem()
? AE2WTIntegration.getWirelessTerminalItem()
: new DummyIntegrationItem(new Item.Properties().stacksTo(1), Addons.AE2WTLIB));

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
import gripe._90.appliede.integration.Addons;

public class AE2WTIntegration {
public static Item createWirelessTerminalItem() {
var terminal = new WTTItem();
GridLinkables.register(terminal, WirelessTerminalItem.LINKABLE_HANDLER);
return terminal;
private static final Item TERMINAL = new WTTItem();

static {
GridLinkables.register(TERMINAL, WirelessTerminalItem.LINKABLE_HANDLER);
}

public static Item getWirelessTerminalItem() {
return TERMINAL;
}

public static MenuType<?> getWirelessTerminalMenu() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import de.mari_023.ae2wtlib.AE2wtlib;
import de.mari_023.ae2wtlib.wut.WUTHandler;

import gripe._90.appliede.AppliedE;
import gripe._90.appliede.integration.ae2wtlib.AE2WTIntegration;
import gripe._90.appliede.integration.ae2wtlib.WTTItem;
import gripe._90.appliede.integration.ae2wtlib.WTTMenu;
import gripe._90.appliede.integration.ae2wtlib.WTTMenuHost;
Expand All @@ -17,7 +17,7 @@
public abstract class AE2wtlibMixin {
@Inject(method = "onAe2Initialized", at = @At("HEAD"), remap = false)
private static void addWirelessTransmutationTerminal(CallbackInfo ci) {
var terminal = (WTTItem) AppliedE.WIRELESS_TRANSMUTATION_TERMINAL.get();
var terminal = (WTTItem) AE2WTIntegration.getWirelessTerminalItem();
WUTHandler.addTerminal(
"transmutation",
terminal::tryOpen,
Expand Down

0 comments on commit 86a4ab2

Please sign in to comment.