[DEV] New Cloth Config GUIs, new nojang apis, and bug fixes

This commit is contained in:
2025-01-14 15:53:58 +02:00
parent aded006f30
commit 5d0ad68c64
27 changed files with 682 additions and 35 deletions

View File

@@ -5,6 +5,8 @@ dependencies {
// Compat
// NOT AVAILABLE ON FORGE modImplementation("maven.modrinth:vanishmod:${vanishmod}")
modImplementation("me.shedaniel.cloth:cloth-config-forge:${cloth_config}")
// Do not edit or remove
implementation project(":Common")
}
@@ -113,4 +115,12 @@ publisher {
setArtifact(remapJar)
setCurseEnvironment("both")
setIsManualRelease(true)
curseDepends {
optional("cloth-config")
}
modrinthDepends {
optional("cloth-config")
}
}

View File

@@ -29,13 +29,14 @@ public class ConfigScreenHandlerMixin {
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
if (!conf.getClass().isAnnotationPresent(NoConfigScreen.class)) {
ModuleConfig config = (ModuleConfig) conf;
if (config.getModId().equals(selectedMod.getModId())) {
cir.setReturnValue(
Optional.of((minecraft, screen) -> new CraterConfigScreen(config, screen))
);
}
AbstractConfig config = watcher.getLeft();
if (config.getClass().isAnnotationPresent(NoConfigScreen.class))
return;
if (watcher.getLeft().getClass().isAnnotationPresent(ClothScreen.class) && (ModloaderEnvironment.INSTANCE.isModLoaded("cloth_config") || ModloaderEnvironment.INSTANCE.isModLoaded("cloth-config") || ModloaderEnvironment.INSTANCE.isModLoaded("clothconfig"))) {
ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> ClothConfigScreenBuilder.buildConfigScreen(config, screen))));
} else {
//ModList.get().getModContainerById(config.getModId()).ifPresent(c -> c.registerExtensionPoint(IConfigScreenFactory.class, ((minecraft, screen) -> new CraterConfigScreen(config, screen))));
}
});
}