Skip to content

Multiple @Mod entries not supported #89

@MelanX

Description

@MelanX

Minecraft version

1.21.1

LibX version

1.21.1-6.0.6

Neoforge version

21.1.213

The latest.log file

https://pastee.dev/p/4wffgYJS

Issue description

If you have multiple entrypoints using @Mod("modid"), it fails to register things using @RegisterConfig or @RegisterClass. This happens because it's explicitly checked for only one of these annotations here in the ModInitProcessor#run.

A temporary fix would be to add the @ForMod annotation of each class but that's very ugly if you have more than just a handful of classes.

Other information

Why this wasn't an issue before

This feature to allow multiple entrypoints per mod was added in FML 3.0.21 with this PR: neoforged/FancyModLoader#126

Possible solutions

  • Keep it as is (annoying)
  • Add an annotation @MainEntry or similar which marks the main entry for the mod and which will be used by LibX (easiest, cleanest)
  • Store all the mod entries in a map and iterate over all and find the best fitting when required (dumb, hard, hacky)

We can't just use the first or last class with the annotation from all the classes existing since the class may not extend ModXRegistration but the actual main class does. That problem would throw errors when trying to register anything using LibX annotations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions