Integrations init fix
This commit is contained in:
parent
b53d513dec
commit
42feb6d4b8
4 changed files with 32 additions and 4 deletions
|
@ -8,7 +8,7 @@ yarn_mappings=6
|
||||||
loader_version=0.11.3
|
loader_version=0.11.3
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.1.36
|
mod_version = 0.1.37
|
||||||
maven_group = ru.bclib
|
maven_group = ru.bclib
|
||||||
archives_base_name = bclib
|
archives_base_name = bclib
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,6 @@ public class ModIntegrationAPI {
|
||||||
*/
|
*/
|
||||||
public static ModIntegration register(ModIntegration integration) {
|
public static ModIntegration register(ModIntegration integration) {
|
||||||
INTEGRATIONS.add(integration);
|
INTEGRATIONS.add(integration);
|
||||||
if (integration.modIsInstalled()) {
|
|
||||||
integration.init();
|
|
||||||
}
|
|
||||||
return integration;
|
return integration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,4 +26,15 @@ public class ModIntegrationAPI {
|
||||||
public static List<ModIntegration> getIntegrations() {
|
public static List<ModIntegration> getIntegrations() {
|
||||||
return INTEGRATIONS;
|
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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"ComposterBlockAccessor",
|
"ComposterBlockAccessor",
|
||||||
|
"EntrypointServerMixin",
|
||||||
"PotionBrewingAccessor",
|
"PotionBrewingAccessor",
|
||||||
"RecipeManagerAccessor",
|
"RecipeManagerAccessor",
|
||||||
"EnchantmentMenuMixin",
|
"EnchantmentMenuMixin",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue