Conditional Proxy Mod Initializers

A simple library for running a proxy Fabric initializer if a required mod exists

by
504 Downloads
fabriccursedlibraryutility
Rent Server with this Mod

Screenshots

the sin I needed to commit in order to make this mod work

About this Mod

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 running new ConditionalModInitializer.Builder())
    • mods() -> List : Returns the list of any mod that is required for this initializer
    • required_mods() -> List : Returns list of all required mods for this initializer
    • can_run -> Boolean : Whether or not the initializer has ran yet
    • environment() -> ExtendedEnvType : Returns the environment (initializer type) for this initializer
      • ExtendedEnvType.CLIENT : ClientModInitializer
      • ExtendedEnvType.SERVER : ModInitializer
      • ExtendedEnvType.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

Available Versions

Conditional Proxy Mod Initializers 1.0release
MC 1.14, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.15, 1.15.1, 1.15.2, 1.16, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.17, 1.17.1, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21fabric
July 10, 2024

How to Install Conditional Proxy Mod Initializers on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set fabric Loader

In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21).

3

Install Mod

Open the mod browser in the dashboard and search for "Conditional Proxy Mod Initializers". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

fabric

Minecraft Versions

1.21, 1.20.6, 1.20.5 (+29 more)

Server-side

Required

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

Conditional Proxy Mod Initializers server crashes on startup – what to do?

Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21). You can switch loaders with one click in the panel.

Is Conditional Proxy Mod Initializers compatible with fabric?

Conditional Proxy Mod Initializers officially supports fabric for Minecraft 1.21, 1.20.6, 1.20.5. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with Conditional Proxy Mod Initializers – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if Conditional Proxy Mod Initializers consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install Conditional Proxy Mod Initializers with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
GNU General Public License v3.0 only
Server-side
Required

Supported Versions

1.211.20.61.20.51.20.41.20.31.20.21.20.11.201.19.41.19.3+22 more