Skip to content

Commit

Permalink
Use event subscription for screen registration
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed May 2, 2024
1 parent 6e5fa84 commit f0f69ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/main/java/gripe/_90/appliede/AppliedE.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.fml.loading.LoadingModList;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import net.minecraftforge.registries.DeferredRegister;
Expand All @@ -44,7 +43,6 @@
import gripe._90.appliede.iface.EMCInterfaceMenu;
import gripe._90.appliede.iface.EMCInterfacePart;
import gripe._90.appliede.iface.EMCInterfacePartAECF;
import gripe._90.appliede.iface.EMCInterfaceScreen;
import gripe._90.appliede.key.EMCKey;
import gripe._90.appliede.key.EMCKeyType;
import gripe._90.appliede.module.EMCModulePart;
Expand Down Expand Up @@ -129,10 +127,6 @@ public AppliedE() {
registerEMC(AEParts.CABLE_ANCHOR, 32);
registerEMC(AEItems.FACADE, 1); // will be replaced by FacadeProcessor
});

if (FMLEnvironment.dist.isClient()) {
bus.addListener(EMCInterfaceScreen::register);
}
}

public static ResourceLocation id(String path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import net.minecraft.client.gui.components.Button;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

import appeng.client.gui.AEBaseScreen;
Expand All @@ -16,6 +19,10 @@
import appeng.init.client.InitScreens;
import appeng.menu.SlotSemantics;

import gripe._90.appliede.AppliedE;

@SuppressWarnings("unused")
@Mod.EventBusSubscriber(modid = AppliedE.MODID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class EMCInterfaceScreen extends AEBaseScreen<EMCInterfaceMenu> {
private final List<Button> amountButtons = new ArrayList<>();

Expand All @@ -39,6 +46,7 @@ public EMCInterfaceScreen(EMCInterfaceMenu menu, Inventory playerInventory, Comp
}
}

@SubscribeEvent
public static void register(FMLClientSetupEvent event) {
event.enqueueWork(() -> InitScreens.register(
EMCInterfaceMenu.TYPE, EMCInterfaceScreen::new, "/screens/appliede/emc_interface.json"));
Expand Down

0 comments on commit f0f69ee

Please sign in to comment.