Integrations init fix
This commit is contained in:
parent
b53d513dec
commit
42feb6d4b8
4 changed files with 32 additions and 4 deletions
|
@ -16,9 +16,6 @@ public class ModIntegrationAPI {
|
|||
*/
|
||||
public static ModIntegration register(ModIntegration integration) {
|
||||
INTEGRATIONS.add(integration);
|
||||
if (integration.modIsInstalled()) {
|
||||
integration.init();
|
||||
}
|
||||
return integration;
|
||||
}
|
||||
|
||||
|
@ -29,4 +26,15 @@ public class ModIntegrationAPI {
|
|||
public static List<ModIntegration> getIntegrations() {
|
||||
return INTEGRATIONS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all integrations, only for internal usage.
|
||||
*/
|
||||
public static void registerAll() {
|
||||
INTEGRATIONS.forEach(integration -> {
|
||||
if (integration.modIsInstalled()) {
|
||||
integration.init();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package ru.bclib.mixin.common;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointServer;
|
||||
import ru.bclib.api.ModIntegrationAPI;
|
||||
|
||||
@Mixin(value = EntrypointServer.class, remap = false)
|
||||
public class EntrypointServerMixin {
|
||||
@Inject(method = "start", at = @At(value = "TAIL"))
|
||||
private static void start(File runDir, Object gameInstance, CallbackInfo info) {
|
||||
ModIntegrationAPI.registerAll();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue