Jump to content

[1.15.2] Cant trigger RegisterEvent.NewRegistry


drazuam

Recommended Posts

I'm trying to create a new registry... Which I think I've mostly got down besides one thorn in my side - I can seem to get the RegisterEvent.NewRegistry Event to trigger.

 

Here is my Event Handler:

public class CommonEventHandler {

    @SubscribeEvent
    public void onChunkAttachCapabilitiesEvent(AttachCapabilitiesEvent<Chunk> evt)
    {
        evt.addCapability(SymbolHandler.Provider.NAME, new SymbolHandler.Provider());
    }

    @SubscribeEvent
    public void onCreateRegistryEvent(RegistryEvent.NewRegistry evt)
    {
        SymbolRegistration.onCreateRegistryEvent(evt);
    }

    @SubscribeEvent
    public void onSymbolRegistryEvent(RegistryEvent.Register<Symbol> evt)
    {
        SymbolRegistration.registerSymbols(evt);
    }

}

 

And here is where I register the handler:
 

@Mod("runicarcana")
public class RunicArcana
{
    // Directly reference a log4j logger.
    private static final Logger LOGGER = LogManager.getLogger();
    public static final String MODID = "runicarcana";

    //Capability Registration
    @CapabilityInject(ISymbolHandler.class)
    public static Capability<ISymbolHandler> SYMBOL_CAP = null;

    public RunicArcana() {
        // Register the setup method for modloading
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        // Register the enqueueIMC method for modloading
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
        // Register the processIMC method for modloading
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
        // Register the doClientStuff method for modloading
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);

        // Register ourselves for server and other game events we are interested in
        MinecraftForge.EVENT_BUS.register(this);
        MinecraftForge.EVENT_BUS.register(new CommonEventHandler());
        MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
        Registration.init();
    }

(I know it's messy right now... I'll clean it up [eventually])

Does anybody out there know why I can't seem to get RegistryEvent.NewRegistry to trigger?  Any help is greatly appreciated!

Link to comment
Share on other sites

Hi

FYI some notes from my testing on the buses so far...

 

    // Beware - there are two event busses: the MinecraftForge.EVENT_BUS, and your own ModEventBus.
    //  If you subscribe your event to the wrong bus, it will never get called.
    // likewise, beware of the difference between static and non-static methods, i.e.
    //  If you register a class, but the @SubscribeEvent is on a non-static method, it won't be called.  e.g.
    //  MOD_EVENT_BUS.register(MyClass.class);
    //  public class ServerLifecycleEvents {
    //    @SubscribeEvent
    //      public void onServerStartingEvent(FMLServerStartingEvent event) { // missing static! --> never gets called}
    //  }

    // Based on my testing: ModEventBus is used for setup events only, in the following order:
    // * RegistryEvent of all types
    // * ColorHandlerEvent for blocks & items
    // * ParticleFactoryRegisterEvent
    // * FMLCommonSetupEvent
    // * TextureStitchEvent
    // * ModelBakeEvent
    // * FMLClientSetupEvent or FMLDedicatedServerSetupEvent
    // * ModelRegistryEvent
    // * Other ModLifecycleEvents such as InterModEnqueueEvent, InterModProcessEvent
    // Everything else: the MinecraftForge.EVENT_BUS

-TGG

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.