Allow Entries to be conditionally shown

- Define a required mod using `requiredMod = "modid"` in entries & comments
This commit is contained in:
Martin Prokoph
2024-10-11 00:08:45 +02:00
parent 765ad60d0b
commit 07e6049fa0
4 changed files with 28 additions and 14 deletions

View File

@@ -35,6 +35,8 @@ configurations {
canBeResolved = true
canBeConsumed = false
}
archivesBaseName = rootProject.archives_base_name + "-neoforge"
version = rootProject.mod_version + "+" + rootProject.minecraft_version
}
dependencies {
@@ -45,10 +47,10 @@ dependencies {
}
processResources {
inputs.property 'version', project.version
inputs.property 'version', rootProject.version
filesMatching('META-INF/neoforge.mods.toml') {
expand version: project.version
expand version: rootProject.version
}
}
@@ -75,7 +77,7 @@ components.java {
unifiedPublishing {
project {
displayName = "MidnightLib $project.version - NeoForge $project.minecraft_version"
displayName = "MidnightLib $rootProject.version - NeoForge $project.minecraft_version"
releaseType = "$project.release_type"
changelog = releaseChangelog()
gameVersions = []
@@ -96,7 +98,7 @@ unifiedPublishing {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
version = "$rootProject.version-$project.name"
gameVersions.addAll project.minecraft_version, project.supported_versions
}
}

View File

@@ -2,7 +2,6 @@ package eu.midnightdust.neoforge;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import eu.midnightdust.core.MidnightLib;
import eu.midnightdust.lib.config.AutoCommand;
import eu.midnightdust.lib.config.MidnightConfig;
import net.minecraft.server.command.ServerCommandSource;
import net.neoforged.api.distmarker.Dist;
@@ -16,6 +15,7 @@ import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.List;
@Mod("midnightlib")
@@ -32,7 +32,7 @@ public class MidnightLibNeoForge {
@SubscribeEvent
public static void onPostInit(FMLClientSetupEvent event) {
ModList.get().forEachModContainer((modid, modContainer) -> {
if (MidnightConfig.configClass.containsKey(modid)) {
if (MidnightConfig.configClass.containsKey(modid) && !MidnightLib.hiddenMods.contains(modid)) {
modContainer.registerExtensionPoint(IConfigScreenFactory.class, (minecraftClient, screen) -> MidnightConfig.getScreen(screen, modid));
}
});
@@ -43,7 +43,10 @@ public class MidnightLibNeoForge {
public static class MidnightLibEvents {
@SubscribeEvent
public static void registerCommands(RegisterCommandsEvent event) {
commands.forEach(command -> event.getDispatcher().register(command));
try {
commands.forEach(command -> event.getDispatcher().register(command));
}
catch (ConcurrentModificationException ignored) {}
}
}
}