diff --git a/gradle.properties b/gradle.properties index c94e5a3..aa0f8c2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.debug=false # Version -mod_version=1.2.16 +mod_version=1.2.17 # Mod mod_id=zenith diff --git a/src/main/java/net/zepalesque/zenith/core/Zenith.java b/src/main/java/net/zepalesque/zenith/core/Zenith.java index 504e6dc..4b3db65 100644 --- a/src/main/java/net/zepalesque/zenith/core/Zenith.java +++ b/src/main/java/net/zepalesque/zenith/core/Zenith.java @@ -12,10 +12,12 @@ import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.ModContainer; +import net.neoforged.fml.ModList; import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.fml.common.Mod; import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.fml.loading.LoadingModList; import net.neoforged.neoforge.common.data.ExistingFileHelper; import net.neoforged.neoforge.data.event.GatherDataEvent; import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent; @@ -143,6 +145,18 @@ public static ResourceLocation loc(String path) { return ResourceLocation.fromNamespaceAndPath(MODID, path); } + public static boolean loaded(String modid) { + return ModList.get().isLoaded(modid); + } + + public static boolean loaded(String modid, boolean isEarly) { + return isEarly ? modFileExists(modid) : loaded(modid); + } + + public static boolean modFileExists(String modid) { + return LoadingModList.get().getModFileById(modid) != null; + } + public static class Keys { public static final ResourceKey>>> CONDITION_ELEMENT = ResourceKey.createRegistryKey(Zenith.loc("condition_element"));