Conditional Proxy Mod Initializers
No reviews yet
A simple library for running a proxy Fabric initializer if a required mod exists
Provides a framework or library for other mods to use.
Fabric is a mod loader for versions 1.14+ of Minecraft, particularly popular for client side and optimization mods.
Community voices
Reviews
Click once to include, again to exclude, again to clear
No reviews yet. Be the first to review this project!
Get it on
Available Platforms
Compatibility
Supported Environments
About
Project Details
For authors
Embed Badge
If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.
Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.
Identifiers
Platform IDs
Resources
External Links
About
Description
A simple 5-class mod which adds support for initializing code depending on if a specific mod exists.
This mod will always load last, so there is no need to worry about race conditions due to mod load order.
Code and variables must be available before or during any mod initialization stages (ie cannot be done on datapack reload for example)
Usage:
// Inside main ModInitializer, ClientModInitializer, or any class that gets called at some point during Fabric init
// For running an instance of a ModInitializer:
ConditionalModInitializer myConditionalModInitializer = new ConditionalModInitializer.Builder().mods("some-mod").initializer(SomeOtherInitializer.class).build();
// For running any unspecified code:
ConditionalModInitializer myConditionalRunner = new ConditionalModInitializer.Builder().mods("some-other-mod").found(() -> {
// Code goes here
}).build();
public void onInitialize() {
ConditionalModInitializer.create().mods("some_mod").required_mods("some_other_dependency_mod").initializer(AnotherInitializer.class).build();
}
- NOTE: new ConditionalModInitializer.Builder() MUST be assigned to a variable, or be called inside a function to work! Static declaration (
static{}will NOT work!)
Docs:
-
ConditionalModInitializer
create()-> Returns a new Builder() instance. (Same as runningnew ConditionalModInitializer.Builder())mods()-> List<String> : Returns the list of any mod that is required for this initializerrequired_mods()-> List<String> : Returns list of all required mods for this initializercan_run-> Boolean : Whether or not the initializer has ran yetenvironment()-> ExtendedEnvType : Returns the environment (initializer type) for this initializerExtendedEnvType.CLIENT: ClientModInitializerExtendedEnvType.SERVER: ModInitializerExtendedEnvType.DEDICATED_SERVER: DedicatedServerModInitializer
on_found()-> Runnable : Returns the function to call when a required mod is found
-
ConditionalModInitializer.Builder
-
mods(String...): Appends to the list of mods that will allow this initializer to run -
required_mods(String...): Appends to the list of required mods for this initializer -
environment(ExtendedEnvType): Sets the environment of the initializer (Default:ExtendedEnvType.SERVER: ModInitializer) -
found(Runnable): Code to execute if the mod is found -
initializer(Class<ModInitializer>): Initializer to run if the mod is found -
mainInitializer(Class<ModInitializer>): Initializer to run if the mod is found -
clientInitializer(Class<ClientModInitializer>): Initializer to run if the mod is found -
serverInitializer(Class<DedicatedServerModInitializer>): Initializer to run if the mod is found -
build(): Returns the finalized ConditionalModInitializer
-
Versions
Files
Relations
Project Relations
More like this
Similar Mods
Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.
On ModDex
Community snapshot
By the numbers
Statistics
Want to reach Minecraft players?
We're looking for a server hosting partner to feature here and other parts of the site. Interested? Send us a message!
Get in touchGet it on
Available Platforms
On ModDex
Community snapshot
By the numbers
Statistics
Resources