Skip to content

Registering your Screen

WereF0X edited this page Jul 8, 2026 · 2 revisions

We now need to register our BuilderScreen, and then we are done.

  1. Make a new class in the init package.

If you are on MultiLoader, you will need to do this in the loader-specific modules.

  1. Name the class ModScreenFactories, or another name you like.

  2. Make sure to annotate the class with @OnlyIn(Dist.CLIENT) (NeoForge) or @Environment(EnvType.CLIENT) (Fabric). This is very important, or trying to launch a server with the mod will cause it to crash.

  3. Once again, make a new void register() method.

  4. Inside, call BuilderScreenRegistry.register(String type, Function<BuilderContext, BuilderScreen> factory). This connects our BuilderScreen to the Requirement.

It should look like this (NeoForge example):

@OnlyIn(Dist.CLIENT)
public class ModScreenFactories {
    public static void register() {
        BuilderScreenRegistry.register("blocks_broken", BuilderBlocksBrokenScreen::new);
    }
}
  1. In a different class, you need to listen to the FMLClientSetupEvent event on NeoForge, or on Fabric the Client initialization entrypoint might work. There, call the ModScreenFactories.register(); method. If you are using the event, make sure that the value is set to the Client Dist, and you are using the Mod Bus.

NeoForge example:

@EventBusSubscriber(modid = Constants.MOD_ID, value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD)
public class ClientSetupEvents {

    @SubscribeEvent
    public static void onClientSetup(FMLClientSetupEvent event) {
        ModScreenFactories.register();
    }
}

Now you're all done! You created a mod that functions as an Addon to Access Denied. Have fun!

Clone this wiki locally