diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/anthonyhilyard/iceberg/config/IcebergConfig.java | 10 | ||||
-rw-r--r-- | src/main/java/com/anthonyhilyard/iceberg/mixin/ForgeConfigMenusPlugin.java | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/config/IcebergConfig.java b/src/main/java/com/anthonyhilyard/iceberg/config/IcebergConfig.java index e27e08d..cc48c2c 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/config/IcebergConfig.java +++ b/src/main/java/com/anthonyhilyard/iceberg/config/IcebergConfig.java @@ -9,12 +9,10 @@ import org.apache.commons.lang3.tuple.Pair; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.config.ModConfigEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -@EventBusSubscriber(modid = Loader.MODID, bus = Bus.MOD) public abstract class IcebergConfig<T extends IcebergConfig<?>> { private static IcebergConfigSpec SPEC = null; @@ -32,7 +30,7 @@ public abstract class IcebergConfig<T extends IcebergConfig<?>> } @SubscribeEvent - private static void onLoadEvent(ModConfigEvent.Loading event) + protected final static void onLoadEvent(ModConfigEvent.Loading event) { if (modId != null && INSTANCE != null && event.getConfig().getModId().contentEquals(modId)) { @@ -41,7 +39,7 @@ public abstract class IcebergConfig<T extends IcebergConfig<?>> } @SubscribeEvent - private static void onReloadEvent(ModConfigEvent.Reloading event) + protected final static void onReloadEvent(ModConfigEvent.Reloading event) { if (modId != null && INSTANCE != null && event.getConfig().getModId().contentEquals(modId)) { @@ -58,6 +56,8 @@ public abstract class IcebergConfig<T extends IcebergConfig<?>> IcebergConfig.modId = modId; + FMLJavaModLoadingContext.get().getModEventBus().register(superClass); + Pair<IcebergConfig<?>, IcebergConfigSpec> specPair = new IcebergConfigSpec.Builder().finish((builder) -> { IcebergConfig<?> result = null; diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/ForgeConfigMenusPlugin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/ForgeConfigMenusPlugin.java index 23c70ad..99f08c3 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/mixin/ForgeConfigMenusPlugin.java +++ b/src/main/java/com/anthonyhilyard/iceberg/mixin/ForgeConfigMenusPlugin.java @@ -3,6 +3,7 @@ package com.anthonyhilyard.iceberg.mixin; import java.util.List; import java.util.Set; +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; @@ -34,7 +35,8 @@ public class ForgeConfigMenusPlugin implements IMixinConfigPlugin // Check if Config Menus for Forge is available. for (ModInfo modInfo : loadingModList.getMods()) { - if (modInfo.getModId().equals("configmenusforge")) + // If config menus for forge is loaded AND it is version 3.1.0, load our mixins. + if (modInfo.getModId().equals("configmenusforge") && modInfo.getVersion().compareTo(new DefaultArtifactVersion("3.1.0")) == 0) { return true; } |