-
Notifications
You must be signed in to change notification settings - Fork 0
Registering your Requirement
WereF0X edited this page Jul 8, 2026
·
2 revisions
Registering a Requirement is pretty straight forward.
There are multiple ways you can do this, I like to keep things organized so I'll show my method. You are free to do as you like, as long as the outcome is the same.
- Create a new class, called
ModRequirements. I like to put this in the init package, as we need to call its method during mod initialization later. - Make a new void
register()method. - Inside the method, call the API method
RequirementRegistry.register(String type, Class<? extends Requirement> clazz).
-- MUST KNOW ABOUT REQUIREMENTS --
Each Requirement has a dedicated String, its
type. It's like an identifier, and should be unique to that Requirement.
Every Requirement also has its dedicated screen, as previously mentioned.
- Your class should look something like this:
public class ModRequirements {
public static void register() {
RequirementRegistry.register("blocks_broken", BlocksBrokenRequirement.class);
// More Requirements to come
}
}- Now let's call the method during mod initialization in your main mod class, or the CommonClass in MultiLoader's case, here are some examples:
NeoForge
public MyAddon(IEventBus modEventBus) {
NeoForge.EVENT_BUS.register(this);
ModRequirements.register()
}MultiLoader
public static void init() {
ModRequirements.register();
}Now your Requirement is registered. However, it's not ready to go just yet.