Compare commits
14 Commits
60a34c63a3
...
multiversi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b70a553a1 | ||
|
|
8e6c76d804 | ||
|
|
6c732783c7 | ||
|
|
1ea57b1a23 | ||
|
|
312096d989 | ||
|
|
4831da5076 | ||
|
|
4076ee2b6f | ||
|
|
071f79b763 | ||
|
|
333af2cfe3 | ||
|
|
0cf6dde5ef | ||
|
|
d78bcb89bb | ||
|
|
e660509fee | ||
|
|
625b820cf0 | ||
|
|
fa5119ab04 |
15
CHANGELOG.md
@@ -0,0 +1,15 @@
|
||||
## MidnightLib v1.9.2
|
||||
- Add support for using `StringRepresentable` to translate enums
|
||||
## MidnightLib v1.9.1
|
||||
- Fix crash when loading existing main config on NeoForge
|
||||
# MidnightLib v1.9.0
|
||||
- Setup a **multiversion** build environment
|
||||
- MidnightLib will now always be up-to-date on all relevant versions of Minecraft
|
||||
(Fabric/Forge 1.20.1; Fabric/NeoForge 1.21.1, 1.21.5, 1.21.8, 1.21.10)
|
||||
- Measures were taken to ensure this doesn't break mods targeting old MidnightLib versions.
|
||||
In case you still find a broken mod, please [report it](https://github.com/TeamMidnightDust/MidnightLib/issues/new/choose) and tag the issue with `1.9.0`.
|
||||
- New logo! This offers improved visibility on light themes and a more modern, fresh look.
|
||||
- Added JavaDocs to improve the developer experience.
|
||||
- To be able to view them, adjust your midnightlib gradle dependency by following the [wiki](https://midnightdust.eu/wiki/midnightlib).
|
||||
- Reduced jar size – now under 60KB again for Fabric builds :)
|
||||
- Migrate to Mojang mappings in preparation for upcoming non-obfuscated releases
|
||||
@@ -1,10 +1,9 @@
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
id("dev.architectury.loom")
|
||||
id("architectury-plugin")
|
||||
id("me.modmuss50.mod-publish-plugin")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
val minecraft = stonecutter.current.version
|
||||
@@ -16,16 +15,11 @@ base {
|
||||
archivesName.set("${mod.id}-$loader")
|
||||
}
|
||||
|
||||
//architectury.common(stonecutter.tree.branches.mapNotNull {
|
||||
// if (stonecutter.current.project !in it) null
|
||||
// else it.prop("loom.platform")
|
||||
//})
|
||||
repositories {
|
||||
maven("https://maven.neoforged.net/releases/")
|
||||
|
||||
//modmenu
|
||||
// modmenu
|
||||
maven("https://maven.terraformersmc.com/")
|
||||
//placeholder api (modmenu depencency)
|
||||
maven("https://maven.nucleoid.xyz/")
|
||||
}
|
||||
dependencies {
|
||||
@@ -35,9 +29,7 @@ dependencies {
|
||||
modImplementation("net.fabricmc:fabric-loader:${mod.dep("fabric_loader")}")
|
||||
modImplementation("com.terraformersmc:modmenu:${mod.dep("modmenu_version")}")
|
||||
|
||||
//some features (like automatic resource loading from non vanilla namespaces) work only with fabric API installed
|
||||
//for example translations from assets/modid/lang/en_us.json won't be working, same stuff with textures
|
||||
//but we keep runtime only to not accidentally depend on fabric's api, because it doesn't exist in neo/forge
|
||||
// Fabric API is required to load modded resources
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:${mod.dep("fabric_version")}")
|
||||
}
|
||||
if (loader == "forge") {
|
||||
@@ -58,33 +50,27 @@ loom {
|
||||
}
|
||||
}
|
||||
if (loader == "forge") {
|
||||
forge.mixinConfigs(
|
||||
"template-common.mixins.json",
|
||||
"template-forge.mixins.json",
|
||||
)
|
||||
forge.mixinConfigs("midnightlib.mixins.json")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val localProperties = Properties()
|
||||
val localPropertiesFile = rootProject.file("local.properties")
|
||||
if (localPropertiesFile.exists()) {
|
||||
localProperties.load(localPropertiesFile.inputStream())
|
||||
}
|
||||
publishMods {
|
||||
val modrinthToken = localProperties.getProperty("publish.modrinthToken", System.getenv("MODRINTH_TOKEN"))
|
||||
val curseforgeToken = localProperties.getProperty("publish.curseforgeToken", System.getenv("CURSEFORGE_TOKEN"))
|
||||
|
||||
val modrinthToken = System.getenv("MODRINTH_TOKEN")
|
||||
val curseforgeToken = System.getenv("CURSEFORGE_TOKEN")
|
||||
val githubToken = System.getenv("GITHUB_TOKEN").orEmpty()
|
||||
|
||||
file = project.tasks.remapJar.get().archiveFile
|
||||
dryRun = modrinthToken == null || curseforgeToken == null
|
||||
|
||||
displayName = "${mod.name} ${loader.replaceFirstChar { it.uppercase() }} ${property("mod.mc_title")}-${mod.version}"
|
||||
version = mod.version
|
||||
displayName = "${mod.name} ${mod.version} - ${loader.replaceFirstChar { it.uppercase() }} ${property("mod.mc_title")}"
|
||||
version = "${mod.version}+${property("mod.mc_title")}-${loader}"
|
||||
changelog = rootProject.file("CHANGELOG.md").readText()
|
||||
type = BETA
|
||||
type = STABLE
|
||||
|
||||
modLoaders.add(loader)
|
||||
if (loader == "fabric") {
|
||||
modLoaders.add("quilt")
|
||||
}
|
||||
|
||||
val targets = property("mod.mc_targets").toString().split(' ')
|
||||
modrinth {
|
||||
@@ -93,7 +79,6 @@ publishMods {
|
||||
targets.forEach(minecraftVersions::add)
|
||||
if (loader == "fabric") {
|
||||
requires("fabric-api")
|
||||
optional("modmenu")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,11 +88,42 @@ publishMods {
|
||||
targets.forEach(minecraftVersions::add)
|
||||
if (loader == "fabric") {
|
||||
requires("fabric-api")
|
||||
optional("modmenu")
|
||||
}
|
||||
}
|
||||
|
||||
// github {
|
||||
// accessToken = githubToken
|
||||
// repository = "TeamMidnightDust/MidnightLib"
|
||||
// commitish = "multiversion" // This is the branch the release tag will be created from
|
||||
//
|
||||
// tagName = "v" + properties["mod.version"]
|
||||
//
|
||||
// // Allow the release to be initially created without any files.
|
||||
// allowEmptyFiles = true
|
||||
// }
|
||||
}
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "MidnightDust"
|
||||
url = uri("https://maven.midnightdust.eu/releases")
|
||||
credentials(PasswordCredentials::class)
|
||||
}
|
||||
}
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
pom {
|
||||
groupId = "eu.midnightdust"
|
||||
artifactId = project.mod.id
|
||||
version = "${project.version}-${loader}"
|
||||
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
val java = if (stonecutter.eval(minecraft, ">=1.20.5")) JavaVersion.VERSION_21 else JavaVersion.VERSION_17
|
||||
@@ -189,4 +205,12 @@ stonecutter {
|
||||
constants {
|
||||
arrayOf("fabric", "neoforge", "forge").forEach { it -> put(it, loader == it) }
|
||||
}
|
||||
replacements.string {
|
||||
direction = eval(current.version, ">=1.21.11-rc2")
|
||||
replace("ResourceLocation", "Identifier")
|
||||
}
|
||||
replacements.string {
|
||||
direction = eval(current.version, ">=1.21.11-rc2")
|
||||
replace("net.minecraft.Util", "net.minecraft.util.Util")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ org.gradle.parallel=false
|
||||
#org.gradle.configureondemand=true
|
||||
|
||||
# Mod properties
|
||||
mod.version=1.8.3
|
||||
mod.version=1.9.2
|
||||
mod.group=eu.midnightdust
|
||||
mod.id=midnightlib
|
||||
mod.name=MidnightLib
|
||||
@@ -21,7 +21,7 @@ mod.mc_title=[VERSIONED]
|
||||
mod.mc_targets=[VERSIONED]
|
||||
|
||||
# Mod setup
|
||||
deps.fabric_loader=0.17.3
|
||||
deps.fabric_loader=0.18.1
|
||||
deps.fabric_version=[VERSIONED]
|
||||
|
||||
deps.forge_loader=[VERSIONED]
|
||||
|
||||
@@ -22,10 +22,10 @@ stonecutter {
|
||||
for (version in versions) vers("$version-$loader", version)
|
||||
}
|
||||
//i would recommend to use neoforge for mc > 1.20.1, i haven't tested template for forge on versions higher than that
|
||||
mc("fabric","1.20.1", "1.21.1", "1.21.5", "1.21.8", "1.21.10")
|
||||
mc("fabric","1.20.1", "1.21.1", "1.21.5", "1.21.8", "1.21.10", "1.21.11")
|
||||
mc("forge","1.20.1")
|
||||
//WARNING: neoforge uses mods.toml instead of neoforge.mods.toml for versions 1.20.4 (?) and earlier
|
||||
mc("neoforge", "1.21.1", "1.21.5", "1.21.8", "1.21.10")
|
||||
mc("neoforge", "1.21.1", "1.21.5", "1.21.8", "1.21.10", "1.21.11")
|
||||
}
|
||||
create(rootProject)
|
||||
}
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
package eu.midnightdust.core;
|
||||
|
||||
import eu.midnightdust.core.config.MidnightLibConfig;
|
||||
import eu.midnightdust.lib.config.AutoCommand;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import net.minecraft.Util;
|
||||
import java.lang.reflect.Field;
|
||||
import net.minecraft.util.Util;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//? if fabric {
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
@@ -24,9 +21,10 @@ import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MidnightLib implements DedicatedServerModInitializer, ClientModInitializer, ModMenuApi {
|
||||
public class MidnightLib implements ClientModInitializer {
|
||||
//?} else if neoforge {
|
||||
/*import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import eu.midnightdust.lib.config.AutoCommand;
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
|
||||
@@ -41,6 +39,25 @@ import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||
|
||||
import java.util.ConcurrentModificationException;
|
||||
|
||||
@Mod("midnightlib")
|
||||
public class MidnightLib {
|
||||
*///?} else if forge {
|
||||
/*import java.util.ConcurrentModificationException;
|
||||
import eu.midnightdust.lib.config.AutoCommand;
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.IExtensionPoint;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.network.NetworkConstants;
|
||||
|
||||
@Mod("midnightlib")
|
||||
public class MidnightLib {
|
||||
*///?}
|
||||
@@ -58,23 +75,11 @@ public class MidnightLib {
|
||||
MidnightLibConfig.init(MOD_ID, MidnightLibConfig.class);
|
||||
}
|
||||
|
||||
public static void registerAutoCommand() {
|
||||
MidnightConfig.configInstances.forEach((modid, config) -> {
|
||||
for (Field field : config.configClass.getFields()) {
|
||||
if (field.isAnnotationPresent(MidnightConfig.Entry.class) && !field.isAnnotationPresent(MidnightConfig.Client.class) && !field.isAnnotationPresent(MidnightConfig.Hidden.class))
|
||||
new AutoCommand(field, modid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//? if fabric {
|
||||
public void onInitializeServer() {
|
||||
registerAutoCommand();
|
||||
}
|
||||
|
||||
public static class ModMenuInit implements ModMenuApi {
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return parent -> MidnightLibConfig.getScreen(parent,"midnightlib");
|
||||
return parent -> MidnightLibConfig.getScreen(parent, MOD_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,12 +91,10 @@ public class MidnightLib {
|
||||
});
|
||||
return map;
|
||||
}
|
||||
}
|
||||
//?}
|
||||
|
||||
|
||||
|
||||
/*? if neoforge {*/
|
||||
|
||||
/*public static List<LiteralArgumentBuilder<CommandSourceStack>> commands = new ArrayList<>();
|
||||
|
||||
public MidnightLib() {
|
||||
@@ -99,9 +102,9 @@ public class MidnightLib {
|
||||
}
|
||||
|
||||
//? if >= 1.21.6 {
|
||||
@EventBusSubscriber(modid = "midnightlib", value = Dist.CLIENT)
|
||||
@EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT)
|
||||
//?} else {
|
||||
/^@EventBusSubscriber(modid = "midnightlib", bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
/^@EventBusSubscriber(modid = MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
^///?}
|
||||
public static class MidnightLibBusEvents {
|
||||
@SubscribeEvent
|
||||
@@ -111,11 +114,44 @@ public class MidnightLib {
|
||||
modContainer.registerExtensionPoint(IConfigScreenFactory.class, (minecraftClient, screen) -> MidnightConfig.getScreen(screen, modid));
|
||||
}
|
||||
});
|
||||
MidnightLib.registerAutoCommand();
|
||||
new AutoCommand().onInitializeServer();
|
||||
}
|
||||
}
|
||||
|
||||
@EventBusSubscriber(modid = "midnightlib")
|
||||
@EventBusSubscriber(modid = MOD_ID)
|
||||
public static class MidnightLibEvents {
|
||||
@SubscribeEvent
|
||||
public static void registerCommands(RegisterCommandsEvent event) {
|
||||
try {
|
||||
commands.forEach(command -> event.getDispatcher().register(command));
|
||||
}
|
||||
catch (ConcurrentModificationException ignored) {}
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
|
||||
//? if forge {
|
||||
/*public MidnightLib() {
|
||||
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (remote, server) -> true));
|
||||
if (PlatformFunctions.isClientEnv()) this.onInitializeClient();
|
||||
}
|
||||
|
||||
public static List<LiteralArgumentBuilder<CommandSourceStack>> commands = new ArrayList<>();
|
||||
|
||||
@Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public static class MidnightLibBusEvents {
|
||||
@SubscribeEvent
|
||||
public static void onPostInit(FMLClientSetupEvent event) {
|
||||
ModList.get().forEachModContainer((modid, modContainer) -> {
|
||||
if (MidnightConfig.configInstances.containsKey(modid) && !MidnightLib.hiddenMods.contains(modid)) {
|
||||
modContainer.registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((minecraftClient, screen) -> MidnightConfig.getScreen(screen, modid)));
|
||||
}
|
||||
});
|
||||
new AutoCommand().onInitializeServer();
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(modid = MOD_ID)
|
||||
public static class MidnightLibEvents {
|
||||
@SubscribeEvent
|
||||
public static void registerCommands(RegisterCommandsEvent event) {
|
||||
|
||||
@@ -3,10 +3,8 @@ package eu.midnightdust.core.config;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MidnightLibConfig extends MidnightConfig {
|
||||
public static final boolean HAS_MODMENU = PlatformFunctions.isModLoaded("modmenu") || Objects.equals(PlatformFunctions.getPlatformName(), "neoforge");
|
||||
public static final boolean HAS_MODMENU = PlatformFunctions.isModLoaded("modmenu") || "neoforge".equals(PlatformFunctions.getPlatformName());
|
||||
|
||||
@Entry public static ConfigButton config_screen_list = HAS_MODMENU ? ConfigButton.MODMENU : ConfigButton.TRUE;
|
||||
|
||||
|
||||
@@ -1,33 +1,41 @@
|
||||
package eu.midnightdust.core.mixin;
|
||||
|
||||
import eu.midnightdust.core.screen.MidnightConfigOverviewScreen;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Objects;
|
||||
import net.minecraft.client.gui.components.SpriteIconButton;
|
||||
import net.minecraft.client.gui.layouts.HeaderAndFooterLayout;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.options.OptionsScreen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import static eu.midnightdust.core.MidnightLib.MOD_ID;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.Identifier;
|
||||
|
||||
//? if >= 1.21 {
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import net.minecraft.client.gui.layouts.HeaderAndFooterLayout;
|
||||
import net.minecraft.client.gui.components.SpriteIconButton;
|
||||
import net.minecraft.client.gui.screens.options.OptionsScreen;
|
||||
import static eu.midnightdust.core.MidnightLib.MOD_ID;
|
||||
//?} else {
|
||||
/*import net.minecraft.client.gui.components.TextAndImageButton;
|
||||
import net.minecraft.client.gui.screens.OptionsScreen;
|
||||
*///?}
|
||||
|
||||
import static eu.midnightdust.core.config.MidnightLibConfig.shouldShowButton;
|
||||
|
||||
@Mixin(OptionsScreen.class)
|
||||
public abstract class MixinOptionsScreen extends Screen {
|
||||
private MixinOptionsScreen(Component title) {super(title);}
|
||||
//? if >= 1.20.4 {
|
||||
@Shadow @Final private HeaderAndFooterLayout layout;
|
||||
@Unique SpriteIconButton midnightlib$button = SpriteIconButton.builder(Component.translatable("midnightlib.overview.title"), (
|
||||
buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(new MidnightConfigOverviewScreen(this)), true)
|
||||
.sprite(ResourceLocation.fromNamespaceAndPath(MOD_ID,"icon/"+MOD_ID), 16, 16).size(20, 20).build();
|
||||
|
||||
private MixinOptionsScreen(Component title) {super(title);}
|
||||
.sprite(Identifier.fromNamespaceAndPath(MOD_ID,"icon/"+MOD_ID), 16, 16).size(20, 20).build();
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "init")
|
||||
public void midnightlib$onInit(CallbackInfo ci) {
|
||||
@@ -46,4 +54,17 @@ public abstract class MixinOptionsScreen extends Screen {
|
||||
public void midnightlib$setButtonPos() {
|
||||
midnightlib$button.setPosition(layout.getWidth() / 2 + 158, layout.getY() + layout.getFooterHeight() - 4);
|
||||
}
|
||||
//?} else {
|
||||
/*@Unique TextAndImageButton midnightlib$button = TextAndImageButton.builder(Component.translatable("midnightlib.overview.title"), new Identifier("midnightlib", "icon/midnightlib.png"),
|
||||
button -> Objects.requireNonNull(minecraft).setScreen(new MidnightConfigOverviewScreen(this))).textureSize(16, 16).usedTextureSize(16, 16).offset(0, 2).build();
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "init")
|
||||
private void midnightlib$init(CallbackInfo ci) {
|
||||
if (shouldShowButton()){
|
||||
midnightlib$button.setWidth(20);
|
||||
midnightlib$button.setPosition(this.width / 2 + 158, this.height / 6 - 12);
|
||||
this.addRenderableWidget(midnightlib$button);
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
}
|
||||
@@ -38,8 +38,14 @@ public class MidnightConfigOverviewScreen extends Screen {
|
||||
}
|
||||
@Override
|
||||
public void render(GuiGraphics context, int mouseX, int mouseY, float delta) {
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
//? if >= 1.21 {
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
//?} else {
|
||||
/*super.renderBackground(context);
|
||||
*///?}
|
||||
this.list.render(context, mouseX, mouseY, delta);
|
||||
context.drawCenteredString(font, title, width / 2, 10, 0xFFFFFFFF);
|
||||
//? if < 1.21
|
||||
/*super.render(context, mouseX, mouseY, delta);*/
|
||||
}
|
||||
}
|
||||
@@ -7,16 +7,25 @@ import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class AutoCommand {
|
||||
//? fabric
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
|
||||
//? if >= 1.21.11
|
||||
import net.minecraft.server.permissions.*;
|
||||
|
||||
public class AutoCommand /*? fabric {*/ implements DedicatedServerModInitializer /*?}*/ {
|
||||
final static String VALUE = "value";
|
||||
final Field field;
|
||||
final Class<?> type;
|
||||
final String modid;
|
||||
final boolean isList;
|
||||
Field field;
|
||||
Class<?> type;
|
||||
String modid;
|
||||
boolean isList;
|
||||
|
||||
public AutoCommand() {}
|
||||
|
||||
public AutoCommand(Field field, String modid) {
|
||||
this.field = field; this.modid = modid;
|
||||
@@ -35,7 +44,8 @@ public class AutoCommand {
|
||||
.then(Commands.argument(VALUE, getArgType()).executes(ctx -> setValueFromArg(ctx, action))));
|
||||
} else command = command.then(Commands.argument(VALUE, getArgType()).executes(ctx -> setValueFromArg(ctx, "")));
|
||||
|
||||
PlatformFunctions.registerCommand(Commands.literal("midnightconfig").requires(source -> source.hasPermission(2)).then(Commands.literal(modid).then(command)));
|
||||
PlatformFunctions.registerCommand(Commands.literal("midnightconfig").requires(source ->
|
||||
source/*? if >= 1.21.11 {*/.permissions().hasPermission(new Permission.HasCommandLevel(PermissionLevel.GAMEMASTERS))/*?} else {*/ /*.hasPermission(2) *//*?}*/).then(Commands.literal(modid).then(command)));
|
||||
}
|
||||
|
||||
public ArgumentType<?> getArgType() {
|
||||
@@ -81,4 +91,15 @@ public class AutoCommand {
|
||||
}, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void onInitializeServer() {
|
||||
MidnightConfig.configInstances.forEach((modid, config) -> {
|
||||
for (Field field : config.configClass.getFields()) {
|
||||
if (field.isAnnotationPresent(MidnightConfig.Entry.class)
|
||||
&& !field.isAnnotationPresent(MidnightConfig.Client.class)
|
||||
&& !field.isAnnotationPresent(MidnightConfig.Hidden.class))
|
||||
new AutoCommand(field, modid);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package eu.midnightdust.lib.config;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -13,9 +15,9 @@ import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.screens.ConfirmLinkScreen;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
//? if >= 1.21.9 {
|
||||
import net.minecraft.client.input.MouseButtonEvent;
|
||||
import net.minecraft.client.input.MouseButtonEvent;
|
||||
//?}
|
||||
|
||||
public class ButtonEntry extends ContainerObjectSelectionList.Entry<ButtonEntry> {
|
||||
@@ -35,7 +37,7 @@ public class ButtonEntry extends ContainerObjectSelectionList.Entry<ButtonEntry>
|
||||
int scaledWidth = Minecraft.getInstance().getWindow().getGuiScaledWidth();
|
||||
|
||||
if (text != null && (!text.getString().contains("spacer") || !buttons.isEmpty())) {
|
||||
title = new MultiLineTextWidget(12, 0, Component.translationArg(text), textRenderer).setCentered(centered);
|
||||
title = new MultiLineTextWidget(12, 0, text.copy(), textRenderer).setCentered(centered);
|
||||
if (info != null)
|
||||
title.setTooltip(info.getTooltip(false));
|
||||
title.setMaxWidth(!buttons.isEmpty() ? buttons.get(buttons.size() > 2 ? buttons.size() - 1 : 0).getX() - 16 : scaledWidth - 24);
|
||||
@@ -58,17 +60,14 @@ public class ButtonEntry extends ContainerObjectSelectionList.Entry<ButtonEntry>
|
||||
title.setY(y + 5);
|
||||
title.render(context, mouseX, mouseY, tickDelta);
|
||||
|
||||
if (info.entry != null && !this.buttons.isEmpty() && this.buttons.getFirst() instanceof AbstractWidget widget) {
|
||||
int idMode = this.info.entry.idMode();
|
||||
if (idMode != -1) context.renderItem(idMode == 0 ?
|
||||
//? if >= 1.21.4 {
|
||||
BuiltInRegistries.ITEM.getValue(ResourceLocation.tryParse(this.info.tempValue)).getDefaultInstance()
|
||||
: BuiltInRegistries.BLOCK.getValue(ResourceLocation.tryParse(this.info.tempValue)).asItem().getDefaultInstance(),
|
||||
//?} else {
|
||||
/*BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(this.info.tempValue)).getDefaultInstance()
|
||||
: BuiltInRegistries.BLOCK.get(ResourceLocation.tryParse(this.info.tempValue)).asItem().getDefaultInstance(),
|
||||
*///?}
|
||||
widget.getX() + widget.getWidth() - 18, y + 2);
|
||||
if (info.entry != null && !this.buttons.isEmpty()) {
|
||||
Optional.ofNullable(this.buttons.get(0)).ifPresent(widget -> {
|
||||
int idMode = this.info.entry.idMode();
|
||||
if (idMode != -1) context.renderItem(idMode == 0 ?
|
||||
BuiltInRegistries.ITEM./*? if >= 1.21.4 {*/ getValue /*?} else {*/ /*get *//*?}*/(Identifier.tryParse(this.info.tempValue)).getDefaultInstance()
|
||||
: BuiltInRegistries.BLOCK./*? if >= 1.21.4 {*/ getValue /*?} else {*/ /*get *//*?}*/(Identifier.tryParse(this.info.tempValue)).asItem().getDefaultInstance(),
|
||||
widget.getX() + widget.getWidth() - 18, y + 2);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +79,11 @@ public class ButtonEntry extends ContainerObjectSelectionList.Entry<ButtonEntry>
|
||||
/*public boolean mouseClicked(double d, double e, int i) {
|
||||
*///?}
|
||||
if (this.info != null && this.info.comment != null && !this.info.comment.url().isBlank())
|
||||
ConfirmLinkScreen.confirmLinkNow(Minecraft.getInstance().screen, this.info.comment.url(), true);
|
||||
//? if >= 1.21 {
|
||||
ConfirmLinkScreen.confirmLinkNow(Minecraft.getInstance().screen, this.info.comment.url(), true);
|
||||
//?} else {
|
||||
/*ConfirmLinkScreen.confirmLinkNow(this.info.comment.url(), Minecraft.getInstance().screen, true);
|
||||
*///?}
|
||||
//? if >= 1.21.9 {
|
||||
return super.mouseClicked(click, doubled);
|
||||
//?} else {
|
||||
|
||||
@@ -3,6 +3,8 @@ package eu.midnightdust.lib.config;
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Tooltip;
|
||||
import net.minecraft.client.gui.components.tabs.Tab;
|
||||
@@ -81,8 +83,8 @@ public class EntryInfo {
|
||||
if (!condition.requiredModId().isEmpty() && !PlatformFunctions.isModLoaded(condition.requiredModId()))
|
||||
this.conditionsMet = false;
|
||||
String requiredOption = condition.requiredOption().contains(":") ? condition.requiredOption() : (this.modid + ":" + condition.requiredOption());
|
||||
if (MidnightConfig.entries.get(requiredOption) instanceof EntryInfo info)
|
||||
this.conditionsMet &= List.of(condition.requiredValue()).contains(info.tempValue);
|
||||
Optional.ofNullable(MidnightConfig.entries.get(requiredOption)).ifPresent(info -> this.conditionsMet &= List.of(condition.requiredValue()).contains(info.tempValue));
|
||||
|
||||
if (!this.conditionsMet) break;
|
||||
}
|
||||
if (prevConditionState != this.conditionsMet) MidnightConfig.configInstances.get(modid).reloadScreen = true;
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.util.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -29,12 +29,17 @@ import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** MidnightConfig by Martin "Motschen" Prokoph
|
||||
* Minimalist config library - feel free to copy!
|
||||
* Originally based on <a href="https://github.com/Minenash/TinyConfig">...</a>
|
||||
* Credits to Minenash */
|
||||
//? if < 1.21.6 {
|
||||
/*//? fabric
|
||||
import net.fabricmc.api.*;
|
||||
//? neoforge
|
||||
/^import net.neoforged.api.distmarker.*;^/
|
||||
//? forge
|
||||
/^import net.minecraftforge.api.distmarker.*;^/
|
||||
*///?}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
/** MidnightConfig is an incredibly lightweight, but still fully-featured config library for Minecraft mods.<br>
|
||||
* Originally based on <a href="https://github.com/Minenash/TinyConfig">TinyConfig</a> by Minenash.*/
|
||||
public abstract class MidnightConfig {
|
||||
private static final Pattern INTEGER_ONLY = Pattern.compile("(-?[0-9]*)");
|
||||
private static final Pattern DECIMAL_ONLY = Pattern.compile("-?(\\d+\\.?\\d*|\\d*\\.?\\d+|\\.)");
|
||||
@@ -45,10 +50,16 @@ public abstract class MidnightConfig {
|
||||
public boolean shouldSkipClass(Class<?> clazz) { return false; }
|
||||
public boolean shouldSkipField(FieldAttributes fieldAttributes) { return fieldAttributes.getAnnotation(Entry.class) == null; }
|
||||
})
|
||||
.registerTypeAdapter(ResourceLocation.class, new TypeAdapter<ResourceLocation>() {
|
||||
public void write(JsonWriter out, ResourceLocation id) throws IOException { out.value(id.toString()); }
|
||||
public ResourceLocation read(JsonReader in) throws IOException { return ResourceLocation.parse(in.nextString()); }
|
||||
}).setPrettyPrinting().create();
|
||||
.registerTypeAdapter(Identifier.class,
|
||||
//? if >= 1.21.4 {
|
||||
new TypeAdapter<Identifier>() {
|
||||
public void write(JsonWriter out, Identifier id) throws IOException { out.value(id.toString()); }
|
||||
public Identifier read(JsonReader in) throws IOException { return Identifier.parse(in.nextString()); }
|
||||
}
|
||||
//?} else {
|
||||
/*new Identifier.Serializer()
|
||||
*///?}
|
||||
).setPrettyPrinting().create();
|
||||
|
||||
protected static final LinkedHashMap<String, EntryInfo> entries = new LinkedHashMap<>(); // modid:fieldName -> EntryInfo
|
||||
|
||||
@@ -58,8 +69,13 @@ public abstract class MidnightConfig {
|
||||
protected boolean reloadScreen = false;
|
||||
public Class<? extends MidnightConfig> configClass;
|
||||
|
||||
public static <T extends MidnightConfig> T createInstance(String modid, Class<? extends MidnightConfig> configClass) { // This is basically an argumented constructor without the requirement of having one in each config class
|
||||
/**
|
||||
* This is basically an argumented constructor without the requirement of having one in each config class.<br>
|
||||
* Not meant to be used externally.
|
||||
* */
|
||||
protected static <T extends MidnightConfig> T createInstance(String modid, Class<? extends MidnightConfig> configClass) {
|
||||
try {
|
||||
//noinspection unchecked
|
||||
T instance = (T) configClass.getDeclaredConstructor().newInstance();
|
||||
instance.modid = modid;
|
||||
instance.configClass = configClass;
|
||||
@@ -69,11 +85,15 @@ public abstract class MidnightConfig {
|
||||
catch (Exception e) { throw new RuntimeException(e); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the config by registering all fields annotated with {@link Entry} or {@link Comment}<br>
|
||||
* @param modid Your mod's id
|
||||
* @param config The class containing your mod's config
|
||||
* */
|
||||
public static void init(String modid, Class<? extends MidnightConfig> config) {
|
||||
MidnightConfig instance = createInstance(modid, config);
|
||||
|
||||
for (Field field : config.getFields()) {
|
||||
//noinspection ConstantValue
|
||||
if ((field.isAnnotationPresent(Entry.class) || field.isAnnotationPresent(Comment.class))
|
||||
&& !field.isAnnotationPresent(Server.class)
|
||||
&& !field.isAnnotationPresent(Hidden.class)
|
||||
@@ -83,13 +103,18 @@ public abstract class MidnightConfig {
|
||||
instance.loadValuesFromJson();
|
||||
}
|
||||
|
||||
public void addClientEntry(Field field, EntryInfo info) {
|
||||
/**
|
||||
* Loads the config entry and saves relevant information into the {@link EntryInfo} object.
|
||||
* @param field The config entry's Java field
|
||||
* @param info The {@link EntryInfo} object to associate with this field
|
||||
* */
|
||||
protected void addClientEntry(Field field, EntryInfo info) {
|
||||
Entry e = info.entry;
|
||||
if (e != null && info.dataType != null) {
|
||||
if (info.dataType == int.class) textField(info, Integer::parseInt, INTEGER_ONLY, (int) e.min(), (int) e.max(), true);
|
||||
else if (info.dataType == float.class) textField(info, Float::parseFloat, DECIMAL_ONLY, (float) e.min(), (float) e.max(), false);
|
||||
else if (info.dataType == double.class) textField(info, Double::parseDouble, DECIMAL_ONLY, e.min(), e.max(), false);
|
||||
else if (info.dataType == String.class || info.dataType == ResourceLocation.class) textField(info, String::length, null, Math.min(e.min(), 0), Math.max(e.max(), 1), true);
|
||||
else if (info.dataType == String.class || info.dataType == Identifier.class) textField(info, String::length, null, Math.min(e.min(), 0), Math.max(e.max(), 1), true);
|
||||
else if (info.dataType == boolean.class) {
|
||||
Function<Object, Component> func = value -> Component.translatable((Boolean) value ? "gui.yes" : "gui.no").withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
info.function = new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(button -> {
|
||||
@@ -111,6 +136,12 @@ public abstract class MidnightConfig {
|
||||
entries.put(modid + ":" + field.getName(), info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies a field's underlying data type.<br>
|
||||
* For non-primitive data types, the class of the primitive equivalent is returned.<br>
|
||||
* For lists, this is the data type of list entries.
|
||||
* @param field The field to investigate
|
||||
* */
|
||||
public static Class<?> getUnderlyingType(Field field) {
|
||||
Class<?> rawType = field.getType();
|
||||
if (field.getType() == List.class)
|
||||
@@ -119,12 +150,15 @@ public abstract class MidnightConfig {
|
||||
} catch (NoSuchFieldException | IllegalAccessException ignored) { return rawType; }
|
||||
}
|
||||
|
||||
private static void textField(EntryInfo info, Function<String,Number> f, Pattern pattern, double min, double max, boolean cast) {
|
||||
/**
|
||||
* Defines a function to validate number, text, identifier or color inputs and saves it into the {@link EntryInfo} object.
|
||||
* */
|
||||
protected static void textField(EntryInfo info, Function<String,Number> f, Pattern pattern, double min, double max, boolean cast) {
|
||||
boolean isNumber = pattern != null;
|
||||
info.function = (BiFunction<EditBox, Button, Predicate<String>>) (t, b) -> s -> {
|
||||
s = s.trim();
|
||||
if (!(s.isEmpty() || !isNumber || pattern.matcher(s).matches()) ||
|
||||
(info.dataType == ResourceLocation.class && ResourceLocation.read(s).isError())) return false;
|
||||
(info.dataType == Identifier.class && Identifier.read(s)./*? if >= 1.21 {*/isError() /*?} else {*/ /*error().isPresent() *//*?}*/)) return false;
|
||||
|
||||
Number value = 0; boolean inLimits = false; info.error = null;
|
||||
if (!(isNumber && s.isEmpty()) && !s.equals("-") && !s.equals(".")) {
|
||||
@@ -142,8 +176,8 @@ public abstract class MidnightConfig {
|
||||
b.active = entries.values().stream().allMatch(e -> e.inLimits);
|
||||
|
||||
if (inLimits) {
|
||||
if (info.dataType == ResourceLocation.class)
|
||||
info.setValue(ResourceLocation.tryParse(s));
|
||||
if (info.dataType == Identifier.class)
|
||||
info.setValue(Identifier.tryParse(s));
|
||||
else info.setValue(isNumber ? value : s);
|
||||
}
|
||||
|
||||
@@ -157,13 +191,24 @@ public abstract class MidnightConfig {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translated title of an enum option
|
||||
* @param value the enum option to translate
|
||||
* @param info the associated {@link EntryInfo} object
|
||||
* */
|
||||
protected Component getEnumTranslatableText(Object value, EntryInfo info) {
|
||||
if (value instanceof OptionEnum translatableOption) return translatableOption.getCaption();
|
||||
if (value instanceof StringRepresentable option) return Component.translatable(option.getSerializedName());
|
||||
//? if < 1.21.11
|
||||
/*if (value instanceof OptionEnum option) return option.getCaption();*/
|
||||
|
||||
assert info.dataType != null;
|
||||
String translationKey = "%s.midnightconfig.enum.%s.%s".formatted(modid, info.dataType.getSimpleName(), info.toTemporaryValue());
|
||||
return I18n.exists(translationKey) ? Component.translatable(translationKey) : Component.literal(info.toTemporaryValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re-)Loads the config by reading json file defined at {@link #getJsonFilePath()}
|
||||
* */
|
||||
public void loadValuesFromJson() {
|
||||
try {
|
||||
gson.fromJson(Files.newBufferedReader(getJsonFilePath()), configClass);
|
||||
@@ -182,15 +227,28 @@ public abstract class MidnightConfig {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the mod's current config state to disk.
|
||||
* @param modid Specifies which mod's config to save.
|
||||
* */
|
||||
public static void write(String modid) {
|
||||
configInstances.get(modid).writeChanges(modid);
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE OR OVERRIDE!<br>
|
||||
* This is only present to keep compatibility with mods that were overriding the previous method.
|
||||
* */
|
||||
@Deprecated
|
||||
public void writeChanges(String modid) {
|
||||
this.writeChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the mod's current config state to disk.<br>
|
||||
* This method can be overridden to define custom onSave behaviour.<br>
|
||||
* Make sure to call {@code super.writeChanges()}!
|
||||
* */
|
||||
public void writeChanges() {
|
||||
try {
|
||||
Path path;
|
||||
@@ -200,30 +258,61 @@ public abstract class MidnightConfig {
|
||||
} catch (Exception e) { e.fillInStackTrace(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path to store the config json file at.<br>
|
||||
* Override to set a custom file path.
|
||||
* */
|
||||
public Path getJsonFilePath() {
|
||||
return PlatformFunctions.getConfigDirectory().resolve(modid + ".json");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // Utility for mod authors
|
||||
/**
|
||||
* Gets a config field's default value.
|
||||
* @param modid The entry's mod id
|
||||
* @param entry The entry's field name
|
||||
* */
|
||||
@SuppressWarnings("unused")
|
||||
public static @Nullable Object getDefaultValue(String modid, String entry) {
|
||||
String key = modid + ":" + entry;
|
||||
return entries.containsKey(key) ? entries.get(key).defaultValue : null;
|
||||
}
|
||||
|
||||
// Overridable method
|
||||
/**
|
||||
* Add custom widgets to the config screen by overriding this method.
|
||||
* @param tabName Name of the currently selected tab
|
||||
* @param list The scrollable list containing regular config entries
|
||||
* @param screen The entire config screen
|
||||
* */
|
||||
public void onTabInit(String tabName, MidnightConfigListWidget list, MidnightConfigScreen screen) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of the config screen.
|
||||
* @param parent The parent screen, which will be returned to when exiting the config
|
||||
* @param modid The mod of which to load the config screen
|
||||
* */
|
||||
//? if < 1.21.6 {
|
||||
/*/^? fabric {^/ @Environment(EnvType.CLIENT) /^?} else {^/ /^@OnlyIn(Dist.CLIENT) ^//^?}^/
|
||||
public static Screen getScreen(Screen parent, String modid) {
|
||||
*///?} else {
|
||||
public static MidnightConfigScreen getScreen(Screen parent, String modid) {
|
||||
//?}
|
||||
return configInstances.get(modid).getScreen(parent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates an instance of the config screen.
|
||||
* This can be overridden to return a fully custom config screen.
|
||||
* @param parent The parent screen, which will be returned to when exiting the config
|
||||
* */
|
||||
public MidnightConfigScreen getScreen(Screen parent) {
|
||||
return new MidnightConfigScreen(parent, modid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry Annotation<br>
|
||||
* - <b>width</b>: The maximum character length of the {@link String}, {@link ResourceLocation} or String/Identifier {@link List<>} field<br>
|
||||
* - <b>width</b>: The maximum character length of the {@link String}, {@link Identifier} or String/Identifier {@link List<>} field<br>
|
||||
* - <b>min</b>: The minimum value of the <code>int</code>, <code>float</code> or <code>double</code> field<br>
|
||||
* - <b>max</b>: The maximum value of the <code>int</code>, <code>float</code> or <code>double</code> field<br>
|
||||
* - <b>name</b>: Will be used instead of the default translation key, if not empty<br>
|
||||
|
||||
@@ -18,18 +18,15 @@ public class MidnightConfigListWidget extends ContainerObjectSelectionList<Butto
|
||||
public boolean renderHeaderSeparator = true;
|
||||
|
||||
public MidnightConfigListWidget(Minecraft client, int width, int height, int y, int itemHeight) {
|
||||
super(client, width, height, y, itemHeight);
|
||||
super(client, width, height, y, /*? if < 1.21 {*/ /*height + y, *//*?}*/ itemHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
//? if >= 1.21.4 {
|
||||
public int scrollBarX() {
|
||||
//?} else {
|
||||
/*public int getScrollbarPosition() {
|
||||
*///?}
|
||||
public int /*? if >= 1.21.4 {*/ scrollBarX() /*?} else {*/ /*getScrollbarPosition() *//*?}*/ {
|
||||
return this.width - 7;
|
||||
}
|
||||
|
||||
//? if >= 1.21 {
|
||||
@Override
|
||||
public void renderListSeparators(GuiGraphics context) {
|
||||
if (renderHeaderSeparator)
|
||||
@@ -39,10 +36,11 @@ public class MidnightConfigListWidget extends ContainerObjectSelectionList<Butto
|
||||
//? if >= 1.21.6 {
|
||||
RenderPipelines.GUI_TEXTURED,
|
||||
//?} else if >= 1.21.4 {
|
||||
//RenderType::guiTextured,
|
||||
//?}
|
||||
/*RenderType::guiTextured,
|
||||
*///?}
|
||||
this.minecraft.level == null ? Screen.FOOTER_SEPARATOR : Screen.INWORLD_FOOTER_SEPARATOR, this.getX(), this.getBottom(), 0, 0, this.getWidth(), 2, 32, 2);
|
||||
}
|
||||
//?}
|
||||
|
||||
public void addButton(List<AbstractWidget> buttons, Component text, EntryInfo info) {
|
||||
this.addEntry(new ButtonEntry(buttons, text, info));
|
||||
|
||||
@@ -2,13 +2,10 @@ package eu.midnightdust.lib.config;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.*;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.EditBox;
|
||||
import net.minecraft.client.gui.components.SpriteIconButton;
|
||||
import net.minecraft.client.gui.components.Tooltip;
|
||||
import net.minecraft.client.gui.components.tabs.GridLayoutTab;
|
||||
import net.minecraft.client.gui.components.tabs.Tab;
|
||||
import net.minecraft.client.gui.components.tabs.TabManager;
|
||||
@@ -19,7 +16,7 @@ import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import java.awt.*;
|
||||
@@ -32,6 +29,10 @@ import java.util.function.Predicate;
|
||||
import net.minecraft.client.input.KeyEvent;
|
||||
//?}
|
||||
|
||||
//? if >=1.21 {
|
||||
import net.minecraft.client.gui.components.SpriteIconButton;
|
||||
//?}
|
||||
|
||||
public class MidnightConfigScreen extends Screen {
|
||||
public MidnightConfig instance;
|
||||
public final String translationPrefix, modid;
|
||||
@@ -78,11 +79,7 @@ public class MidnightConfigScreen extends Screen {
|
||||
updateList();
|
||||
list.setScrollAmount(0);
|
||||
}
|
||||
//? >= 1.21.4 {
|
||||
scrollProgress = list.scrollAmount();
|
||||
//?} else {
|
||||
/*scrollProgress = list.getScrollAmount();
|
||||
*///?}
|
||||
scrollProgress = /*? if < 1.21.4 {*/ /*list.getScrollAmount() *//*?} else {*/ list.scrollAmount() /*?}*/;
|
||||
for (EntryInfo info : MidnightConfig.entries.values())
|
||||
if (Objects.equals(modid, info.modid)) info.updateFieldValue();
|
||||
updateButtons();
|
||||
@@ -97,9 +94,10 @@ public class MidnightConfigScreen extends Screen {
|
||||
|
||||
for (ButtonEntry entry : this.list.children()) {
|
||||
if (entry.buttons != null && entry.buttons.size() > 1 && entry.info.field != null) {
|
||||
if (entry.buttons.get(0) instanceof AbstractWidget widget)
|
||||
Optional.ofNullable(entry.buttons.get(0)).ifPresent(widget -> {
|
||||
if (widget.isFocused() || widget.isHovered())
|
||||
widget.setTooltip(entry.info.getTooltip(true));
|
||||
});
|
||||
if (entry.buttons.get(1) instanceof Button button)
|
||||
button.active = !Objects.equals(String.valueOf(entry.info.value), String.valueOf(entry.info.defaultValue)) && entry.info.conditionsMet;
|
||||
}
|
||||
@@ -169,12 +167,24 @@ public class MidnightConfigScreen extends Screen {
|
||||
if (!visibleButLocked) continue;
|
||||
}
|
||||
if (info.modid.equals(modid) && (info.tab == null || info.tab == tabManager.getCurrentTab())) {
|
||||
SpriteIconButton resetButton = SpriteIconButton.builder(Component.translatable("controls.reset"), (button -> {
|
||||
//? if >= 1.21 {
|
||||
SpriteIconButton resetButton = SpriteIconButton.builder(Component.translatable("controls.reset"),
|
||||
//?} else {
|
||||
/*TextAndImageButton resetButton = TextAndImageButton.builder(Component.translatable("controls.reset"), new Identifier("midnightlib", "icon/reset.png"),
|
||||
*///?}
|
||||
(button -> {
|
||||
info.value = info.defaultValue;
|
||||
info.listIndex = 0;
|
||||
info.tempValue = info.toTemporaryValue();
|
||||
updateList();
|
||||
}), true).sprite(ResourceLocation.fromNamespaceAndPath("midnightlib", "icon/reset"), 12, 12).size(20, 20).build();
|
||||
})
|
||||
//? if >= 1.21 {
|
||||
, true).sprite(Identifier.fromNamespaceAndPath("midnightlib", "icon/reset"), 12, 12).size(20, 20).build();
|
||||
//?} else {
|
||||
/*).textureSize(12, 12).usedTextureSize(12, 12).offset(0, 4).build();
|
||||
resetButton.setWidth(20);
|
||||
*///?}
|
||||
|
||||
resetButton.setPosition(width - 205 + 150 + 25, 0);
|
||||
|
||||
if (info.function != null) {
|
||||
@@ -225,7 +235,12 @@ public class MidnightConfigScreen extends Screen {
|
||||
}
|
||||
info.actionButton = colorButton;
|
||||
} else if (e.selectionMode() > -1) {
|
||||
Button explorerButton = SpriteIconButton.builder(Component.empty(),
|
||||
Button explorerButton =
|
||||
//? if >= 1.21 {
|
||||
SpriteIconButton.builder(Component.empty(),
|
||||
//?} else {
|
||||
/*TextAndImageButton.builder(Component.empty(), new Identifier("midnightlib", "icon/explorer.png"),
|
||||
*///?}
|
||||
button -> new Thread(() -> {
|
||||
JFileChooser fileChooser = new JFileChooser(info.tempValue);
|
||||
fileChooser.setFileSelectionMode(e.selectionMode());
|
||||
@@ -238,8 +253,13 @@ public class MidnightConfigScreen extends Screen {
|
||||
info.setValue(fileChooser.getSelectedFile().getAbsolutePath());
|
||||
updateList();
|
||||
}
|
||||
}).start(), true
|
||||
).sprite(ResourceLocation.fromNamespaceAndPath("midnightlib", "icon/explorer"), 12, 12).size(20, 20).build();
|
||||
}).start()
|
||||
//? if >= 1.21 {
|
||||
, true).sprite(Identifier.fromNamespaceAndPath("midnightlib", "icon/explorer"), 12, 12).size(20, 20)
|
||||
//?} else {
|
||||
/*).textureSize(12, 12).usedTextureSize(12, 12).offset(0, 4)
|
||||
*///?}
|
||||
.build();
|
||||
explorerButton.setTooltip(Tooltip.create(Component.translatable("midnightconfig.action.file_chooser")));
|
||||
explorerButton.setPosition(width - 185, 0);
|
||||
info.actionButton = explorerButton;
|
||||
@@ -269,8 +289,14 @@ public class MidnightConfigScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics context, int mouseX, int mouseY, float delta) {
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
//? if >= 1.21 {
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
//?} else {
|
||||
/*super.renderBackground(context);
|
||||
*///?}
|
||||
this.list.render(context, mouseX, mouseY, delta);
|
||||
if (tabs.size() < 2) context.drawCenteredString(font, title, width / 2, 10, 0xFFFFFFFF);
|
||||
//? if < 1.21
|
||||
/*super.render(context, mouseX, mouseY, delta);*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,12 @@ import net.neoforged.fml.ModList;
|
||||
import net.neoforged.fml.loading.FMLEnvironment;
|
||||
import net.neoforged.fml.loading.FMLPaths;
|
||||
*///?}
|
||||
//? if forge {
|
||||
/*import eu.midnightdust.core.MidnightLib;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
*///?}
|
||||
|
||||
public class PlatformFunctions {
|
||||
//? if fabric {
|
||||
@@ -55,6 +61,20 @@ public class PlatformFunctions {
|
||||
MidnightLib.commands.add(command);
|
||||
}
|
||||
*///?} else if forge {
|
||||
//
|
||||
//?}
|
||||
/*public static String getPlatformName() {
|
||||
return "forge";
|
||||
}
|
||||
public static Path getConfigDirectory() {
|
||||
return FMLPaths.CONFIGDIR.get();
|
||||
}
|
||||
public static boolean isClientEnv() {
|
||||
return FMLEnvironment.dist.isClient();
|
||||
}
|
||||
public static boolean isModLoaded(String modid) {
|
||||
return ModList.get().isLoaded(modid);
|
||||
}
|
||||
public static void registerCommand(LiteralArgumentBuilder<CommandSourceStack> command) {
|
||||
MidnightLib.commands.add(command);
|
||||
}
|
||||
*///?}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 734 B |
@@ -1,5 +1,6 @@
|
||||
package eu.midnightdust.test;
|
||||
|
||||
//? if >= 1.21.10 {
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import eu.midnightdust.lib.config.EntryInfo;
|
||||
@@ -15,7 +16,7 @@ import net.minecraft.client.gui.components.Tooltip;
|
||||
import net.minecraft.client.input.KeyEvent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@@ -32,7 +33,7 @@ public class MidnightLibExtras {
|
||||
SpriteIconButton resetButton = SpriteIconButton.builder(Component.translatable("controls.reset"), (button -> {
|
||||
binding.setKey(binding.getDefaultKey());
|
||||
screen.updateList();
|
||||
}), true).sprite(ResourceLocation.fromNamespaceAndPath("midnightlib","icon/reset"), 12, 12).size(20, 20).build();
|
||||
}), true).sprite(Identifier.fromNamespaceAndPath("midnightlib","icon/reset"), 12, 12).size(20, 20).build();
|
||||
resetButton.setPosition(screen.width - 205 + 150 + 25, 0);
|
||||
editButton.resetButton = resetButton;
|
||||
editButton.updateMessage(false);
|
||||
@@ -97,3 +98,4 @@ public class MidnightLibExtras {
|
||||
}
|
||||
}
|
||||
}
|
||||
//?}
|
||||
@@ -1,5 +1,6 @@
|
||||
package eu.midnightdust.test.config;
|
||||
|
||||
//? if >= 1.21.10 {
|
||||
import com.google.common.collect.Lists;
|
||||
import eu.midnightdust.lib.config.MidnightConfigListWidget;
|
||||
import eu.midnightdust.lib.config.MidnightConfigScreen;
|
||||
@@ -9,7 +10,7 @@ import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.util.OptionEnum;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -37,7 +38,7 @@ public class MidnightConfigExample extends MidnightConfig {
|
||||
@Entry(category = TEXT, name="I am a (non-primitive) Boolean") public static Boolean nonPrimitive = true; // Example for a non-primative boolean option
|
||||
@Entry(category = TEXT) public static String name = "Hello World!"; // Example for a string option, which is in a category!
|
||||
@Entry(category = TEXT, width = 7, min = 7, isColor = true, name = "I am a color!") public static String titleColor = "#ffffff"; // The isColor property adds a color chooser for a hexadecimal color
|
||||
@Entry(category = TEXT, idMode = 0) public static ResourceLocation id = ResourceLocation.withDefaultNamespace("diamond"); // Example for an identifier with matching items displayed next to it!
|
||||
@Entry(category = TEXT, idMode = 0) public static Identifier id = Identifier.withDefaultNamespace("diamond"); // Example for an identifier with matching items displayed next to it!
|
||||
@Entry(category = TEXT) public static ModPlatform modPlatform = ModPlatform.FABRIC; // Example for an enum option
|
||||
public enum ModPlatform { // Enums allow the user to cycle through predefined options
|
||||
QUILT, FABRIC, FORGE, NEOFORGE, VANILLA
|
||||
@@ -55,7 +56,7 @@ public class MidnightConfigExample extends MidnightConfig {
|
||||
// The name field can be used to specify a custom translation string or plain text
|
||||
@Entry(category = LISTS, name = "I am a string list!") public static List<String> stringList = Lists.newArrayList("String1", "String2"); // Array String Lists are also supported
|
||||
@Entry(category = LISTS, isColor = true, name = "I am a color list!") public static List<String> colorList = Lists.newArrayList("#ac5f99", "#11aa44"); // Lists also support colors
|
||||
@Entry(category = LISTS, name = "I am an identifier list!", idMode = 1) public static List<ResourceLocation> idList = Lists.newArrayList(ResourceLocation.withDefaultNamespace("dirt")); // A list of block identifiers
|
||||
@Entry(category = LISTS, name = "I am an identifier list!", idMode = 1) public static List<Identifier> idList = Lists.newArrayList(Identifier.withDefaultNamespace("dirt")); // A list of block identifiers
|
||||
@Entry(category = LISTS, name = "I am an integer list!") public static List<Integer> intList = Lists.newArrayList(69, 420);
|
||||
@Entry(category = LISTS, name = "I am a float list!") public static List<Float> floatList = Lists.newArrayList(4.1f, -1.3f, -1f);
|
||||
|
||||
@@ -169,5 +170,5 @@ public class MidnightConfigExample extends MidnightConfig {
|
||||
MidnightLibExtras.KeybindButton.add(Minecraft.getInstance().options.keyDrop, list, screen);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//?}
|
||||
@@ -1,49 +1,11 @@
|
||||
plugins {
|
||||
id("dev.kikugie.stonecutter")
|
||||
id("dev.architectury.loom") version "1.11-SNAPSHOT" apply false
|
||||
id("dev.architectury.loom") version "1.13-SNAPSHOT" apply false
|
||||
id("architectury-plugin") version "3.4-SNAPSHOT" apply false
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("me.modmuss50.mod-publish-plugin") version "0.8.4" apply false
|
||||
}
|
||||
stonecutter active "1.21.10-fabric" /* [SC] DO NOT EDIT */
|
||||
|
||||
// Builds every version into `build/libs/{mod.version}/{loader}`
|
||||
//stonecutter registerChiseled tasks.register("chiseledBuild", stonecutter.chiseled) {
|
||||
// group = "project"
|
||||
// ofTask("buildAndCollect")
|
||||
//}
|
||||
//stonecutter registerChiseled tasks.register("chiseledPublishMods", stonecutter.chiseled) {
|
||||
// group = "project"
|
||||
// ofTask("publishMods")
|
||||
//}
|
||||
//stonecutter registerChiseled tasks.register("chiseledRunAllClients", stonecutter.chiseled) {
|
||||
// group = "project"
|
||||
// ofTask("runClient")
|
||||
//}
|
||||
|
||||
|
||||
|
||||
// Builds loader-specific versions into `build/libs/{mod.version}/{loader}`
|
||||
//for (it in stonecutter.tree.branches) {
|
||||
// if (it.id.isEmpty()) continue
|
||||
// val loader = it.id.upperCaseFirst()
|
||||
// stonecutter registerChiseled tasks.register("chiseledBuild$loader", stonecutter.chiseled) {
|
||||
// group = "project"
|
||||
// versions { branch, _ -> branch == it.id }
|
||||
// ofTask("buildAndCollect")
|
||||
// }
|
||||
//}
|
||||
|
||||
// Runs active versions for each loader
|
||||
for (it in stonecutter.tree.nodes) {
|
||||
if (it.metadata != stonecutter.current || it.branch.id.isEmpty()) continue
|
||||
val types = listOf("Client", "Server")
|
||||
val loader = it.branch.id.upperCaseFirst()
|
||||
// for (type in types) it.tasks.register("runActive$type$loader") {
|
||||
// group = "project"
|
||||
// dependsOn("run$type")
|
||||
// }
|
||||
}
|
||||
stonecutter active "1.21.11-fabric" /* [SC] DO NOT EDIT */
|
||||
|
||||
// See https://stonecutter.kikugie.dev/wiki/config/params
|
||||
stonecutter parameters {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
mod.mc_dep_fabric==1.20.1
|
||||
mod.mc_dep_fabric=>=1.20 <=1.20.1
|
||||
mod.mc_dep_forgelike=[1.20, 1.20.1]
|
||||
mod.mc_title=1.20.1
|
||||
mod.mc_targets=1.20.1
|
||||
mod.mc_targets=1.20 1.20.1
|
||||
|
||||
deps.forge_loader=47.3.0
|
||||
deps.neoforge_loader=[UNSUPPORTED]
|
||||
|
||||
|
After Width: | Height: | Size: 136 B |
|
After Width: | Height: | Size: 136 B |
|
After Width: | Height: | Size: 114 B |
@@ -23,18 +23,18 @@
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"server": [
|
||||
"eu.midnightdust.core.MidnightLib"
|
||||
"eu.midnightdust.lib.config.AutoCommand"
|
||||
],
|
||||
"client": [
|
||||
"eu.midnightdust.core.MidnightLib"
|
||||
],
|
||||
"modmenu": [
|
||||
"eu.midnightdust.core.MidnightLib"
|
||||
"eu.midnightdust.core.MidnightLib\$ModMenuInit"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabric-resource-loader-v0": "*",
|
||||
"minecraft": ">=1.21"
|
||||
"minecraft": "${minecraft}"
|
||||
},
|
||||
|
||||
"mixins": [
|
||||
@@ -1,7 +1,7 @@
|
||||
mod.mc_dep_fabric==1.20.1
|
||||
mod.mc_dep_fabric=>=1.20 <=1.20.1
|
||||
mod.mc_dep_forgelike=[1.20, 1.20.1]
|
||||
mod.mc_title=1.20.1
|
||||
mod.mc_targets=1.20.1
|
||||
mod.mc_targets=1.20 1.20.1
|
||||
|
||||
deps.forge_loader=47.3.0
|
||||
deps.neoforge_loader=[UNSUPPORTED]
|
||||
|
||||
31
versions/1.20.1-forge/src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,31 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[43,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[mods]]
|
||||
modId = "midnightlib"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
logoFile = "midnightlib.png"
|
||||
authors = "TeamMidnightDust, Motschen"
|
||||
description = '''
|
||||
Lightweight config library with config screens and commands.
|
||||
'''
|
||||
|
||||
[[mixins]]
|
||||
config = "midnightlib.mixins.json"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
versionRange = "[43,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "${minecraft}"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
After Width: | Height: | Size: 136 B |
|
After Width: | Height: | Size: 136 B |
|
After Width: | Height: | Size: 114 B |
BIN
versions/1.20.1-forge/src/main/resources/midnightlib.png
Normal file
|
After Width: | Height: | Size: 734 B |
6
versions/1.20.1-forge/src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "MidnightLib",
|
||||
"pack_format": 9
|
||||
}
|
||||
}
|
||||
54
versions/1.21.1-fabric/src/main/resources/fabric.mod.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "${id}",
|
||||
"version": "${version}",
|
||||
"name": "${name}",
|
||||
"description": "Lightweight config library with config screens and commands.",
|
||||
"authors": [
|
||||
"Motschen"
|
||||
],
|
||||
"contributors": [
|
||||
"maloryware",
|
||||
"Jaffe2718"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://www.midnightdust.eu/",
|
||||
"sources": "https://github.com/TeamMidnightDust/MidnightLib",
|
||||
"issues": "https://github.com/TeamMidnightDust/MidnightLib/issues"
|
||||
},
|
||||
|
||||
"license": "MIT",
|
||||
"icon": "assets/midnightlib/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"server": [
|
||||
"eu.midnightdust.lib.config.AutoCommand"
|
||||
],
|
||||
"client": [
|
||||
"eu.midnightdust.core.MidnightLib"
|
||||
],
|
||||
"modmenu": [
|
||||
"eu.midnightdust.core.MidnightLib\$ModMenuInit"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabric-resource-loader-v0": "*",
|
||||
"minecraft": "${minecraft}"
|
||||
},
|
||||
|
||||
"mixins": [
|
||||
"midnightlib.mixins.json"
|
||||
],
|
||||
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"links": {
|
||||
"modmenu.discord": "http://discord.midnightdust.eu/",
|
||||
"modmenu.website": "https://midnightdust.eu/midnightlib",
|
||||
"midnightlib.wiki": "https://midnightdust.eu/wiki/midnightlib"
|
||||
},
|
||||
"badges": [ "library" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,6 @@ side = "BOTH"
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[1.20.5,)"
|
||||
versionRange = "${minecraft}"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
BIN
versions/1.21.1-neoforge/src/main/resources/midnightlib.png
Normal file
|
After Width: | Height: | Size: 734 B |
@@ -1,7 +1,7 @@
|
||||
mod.mc_dep_fabric=>=1.21.9
|
||||
mod.mc_dep_forgelike=[1.21.10,)
|
||||
mod.mc_dep_fabric=>=1.21.9 <=1.21.10
|
||||
mod.mc_dep_forgelike=[1.21.9,1.21.10]
|
||||
mod.mc_title=1.21.10
|
||||
mod.mc_targets=1.21.9, 1.21.10
|
||||
mod.mc_targets=1.21.9 1.21.10
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.10.47-beta
|
||||
|
||||
54
versions/1.21.10-fabric/src/main/resources/fabric.mod.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "${id}",
|
||||
"version": "${version}",
|
||||
"name": "${name}",
|
||||
"description": "Lightweight config library with config screens and commands.",
|
||||
"authors": [
|
||||
"Motschen"
|
||||
],
|
||||
"contributors": [
|
||||
"maloryware",
|
||||
"Jaffe2718"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://www.midnightdust.eu/",
|
||||
"sources": "https://github.com/TeamMidnightDust/MidnightLib",
|
||||
"issues": "https://github.com/TeamMidnightDust/MidnightLib/issues"
|
||||
},
|
||||
|
||||
"license": "MIT",
|
||||
"icon": "assets/midnightlib/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"server": [
|
||||
"eu.midnightdust.lib.config.AutoCommand"
|
||||
],
|
||||
"client": [
|
||||
"eu.midnightdust.core.MidnightLib"
|
||||
],
|
||||
"modmenu": [
|
||||
"eu.midnightdust.core.MidnightLib\$ModMenuInit"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabric-resource-loader-v0": "*",
|
||||
"minecraft": "${minecraft}"
|
||||
},
|
||||
|
||||
"mixins": [
|
||||
"midnightlib.mixins.json"
|
||||
],
|
||||
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"links": {
|
||||
"modmenu.discord": "http://discord.midnightdust.eu/",
|
||||
"modmenu.website": "https://midnightdust.eu/midnightlib",
|
||||
"midnightlib.wiki": "https://midnightdust.eu/wiki/midnightlib"
|
||||
},
|
||||
"badges": [ "library" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
mod.mc_dep_fabric=>=1.21.9
|
||||
mod.mc_dep_forgelike=[1.21.10,)
|
||||
mod.mc_dep_fabric=>=1.21.9 <= 1.21.10
|
||||
mod.mc_dep_forgelike=[1.21.9,1.21.10]
|
||||
mod.mc_title=1.21.10
|
||||
mod.mc_targets=1.21.9, 1.21.10
|
||||
mod.mc_targets=1.21.9 1.21.10
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.10.47-beta
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[2,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[mods]]
|
||||
modId = "midnightlib"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
logoFile = "midnightlib.png"
|
||||
authors = "TeamMidnightDust, Motschen"
|
||||
description = '''
|
||||
Lightweight config library with config screens and commands.
|
||||
'''
|
||||
|
||||
[[mixins]]
|
||||
config = "midnightlib.mixins.json"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "neoforge"
|
||||
mandatory = true
|
||||
versionRange = "[20.5,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "${minecraft}"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
BIN
versions/1.21.10-neoforge/src/main/resources/midnightlib.png
Normal file
|
After Width: | Height: | Size: 734 B |
12
versions/1.21.11-fabric/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
mod.mc_dep_fabric=>=1.21.11
|
||||
mod.mc_dep_forgelike=[1.21.11,)
|
||||
mod.mc_title=1.21.11
|
||||
mod.mc_targets=1.21.11
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.11.3-beta
|
||||
|
||||
deps.fabric_version=0.139.4+1.21.11
|
||||
deps.modmenu_version=17.0.0-alpha.1
|
||||
|
||||
loom.platform=fabric
|
||||
54
versions/1.21.11-fabric/src/main/resources/fabric.mod.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "${id}",
|
||||
"version": "${version}",
|
||||
"name": "${name}",
|
||||
"description": "Lightweight config library with config screens and commands.",
|
||||
"authors": [
|
||||
"Motschen"
|
||||
],
|
||||
"contributors": [
|
||||
"maloryware",
|
||||
"Jaffe2718"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://www.midnightdust.eu/",
|
||||
"sources": "https://github.com/TeamMidnightDust/MidnightLib",
|
||||
"issues": "https://github.com/TeamMidnightDust/MidnightLib/issues"
|
||||
},
|
||||
|
||||
"license": "MIT",
|
||||
"icon": "assets/midnightlib/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"server": [
|
||||
"eu.midnightdust.lib.config.AutoCommand"
|
||||
],
|
||||
"client": [
|
||||
"eu.midnightdust.core.MidnightLib"
|
||||
],
|
||||
"modmenu": [
|
||||
"eu.midnightdust.core.MidnightLib\$ModMenuInit"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabric-resource-loader-v0": "*",
|
||||
"minecraft": "${minecraft}"
|
||||
},
|
||||
|
||||
"mixins": [
|
||||
"midnightlib.mixins.json"
|
||||
],
|
||||
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"links": {
|
||||
"modmenu.discord": "http://discord.midnightdust.eu/",
|
||||
"modmenu.website": "https://midnightdust.eu/midnightlib",
|
||||
"midnightlib.wiki": "https://midnightdust.eu/wiki/midnightlib"
|
||||
},
|
||||
"badges": [ "library" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
12
versions/1.21.11-neoforge/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
mod.mc_dep_fabric=>=1.21.11
|
||||
mod.mc_dep_forgelike=[1.21.11,)
|
||||
mod.mc_title=1.21.11
|
||||
mod.mc_targets=1.21.11
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.11.3-beta
|
||||
|
||||
deps.fabric_version=0.139.4+1.21.11
|
||||
deps.modmenu_version=17.0.0-alpha.1
|
||||
|
||||
loom.platform=neoforge
|
||||
@@ -0,0 +1,31 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[2,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[mods]]
|
||||
modId = "midnightlib"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
logoFile = "midnightlib.png"
|
||||
authors = "TeamMidnightDust, Motschen"
|
||||
description = '''
|
||||
Lightweight config library with config screens and commands.
|
||||
'''
|
||||
|
||||
[[mixins]]
|
||||
config = "midnightlib.mixins.json"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "neoforge"
|
||||
mandatory = true
|
||||
versionRange = "[20.5,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "${minecraft}"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
BIN
versions/1.21.11-neoforge/src/main/resources/midnightlib.png
Normal file
|
After Width: | Height: | Size: 734 B |
@@ -1,7 +1,7 @@
|
||||
mod.mc_dep_fabric==1.21.5
|
||||
mod.mc_dep_forgelike=[1.21.5]
|
||||
mod.mc_dep_fabric=>=1.21.4 <=1.21.5
|
||||
mod.mc_dep_forgelike=[1.21.4, 1.21.5]
|
||||
mod.mc_title=1.21.5
|
||||
mod.mc_targets=1.21.5
|
||||
mod.mc_targets=1.21.4 1.21.5
|
||||
|
||||
deps.forge_loader=54.0.13
|
||||
deps.neoforge_loader=21.4.47-beta
|
||||
|
||||
54
versions/1.21.5-fabric/src/main/resources/fabric.mod.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "${id}",
|
||||
"version": "${version}",
|
||||
"name": "${name}",
|
||||
"description": "Lightweight config library with config screens and commands.",
|
||||
"authors": [
|
||||
"Motschen"
|
||||
],
|
||||
"contributors": [
|
||||
"maloryware",
|
||||
"Jaffe2718"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://www.midnightdust.eu/",
|
||||
"sources": "https://github.com/TeamMidnightDust/MidnightLib",
|
||||
"issues": "https://github.com/TeamMidnightDust/MidnightLib/issues"
|
||||
},
|
||||
|
||||
"license": "MIT",
|
||||
"icon": "assets/midnightlib/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"server": [
|
||||
"eu.midnightdust.lib.config.AutoCommand"
|
||||
],
|
||||
"client": [
|
||||
"eu.midnightdust.core.MidnightLib"
|
||||
],
|
||||
"modmenu": [
|
||||
"eu.midnightdust.core.MidnightLib\$ModMenuInit"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabric-resource-loader-v0": "*",
|
||||
"minecraft": "${minecraft}"
|
||||
},
|
||||
|
||||
"mixins": [
|
||||
"midnightlib.mixins.json"
|
||||
],
|
||||
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"links": {
|
||||
"modmenu.discord": "http://discord.midnightdust.eu/",
|
||||
"modmenu.website": "https://midnightdust.eu/midnightlib",
|
||||
"midnightlib.wiki": "https://midnightdust.eu/wiki/midnightlib"
|
||||
},
|
||||
"badges": [ "library" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
mod.mc_dep_fabric==1.21.5
|
||||
mod.mc_dep_forgelike=[1.21.5]
|
||||
mod.mc_dep_fabric=>=1.21.4 <=1.21.5
|
||||
mod.mc_dep_forgelike=[1.21.4, 1.21.5]
|
||||
mod.mc_title=1.21.5
|
||||
mod.mc_targets=1.21.5
|
||||
mod.mc_targets=1.21.4 1.21.5
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.5.54-beta
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[2,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[mods]]
|
||||
modId = "midnightlib"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
logoFile = "midnightlib.png"
|
||||
authors = "TeamMidnightDust, Motschen"
|
||||
description = '''
|
||||
Lightweight config library with config screens and commands.
|
||||
'''
|
||||
|
||||
[[mixins]]
|
||||
config = "midnightlib.mixins.json"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "neoforge"
|
||||
mandatory = true
|
||||
versionRange = "[20.5,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "${minecraft}"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
BIN
versions/1.21.5-neoforge/src/main/resources/midnightlib.png
Normal file
|
After Width: | Height: | Size: 734 B |
@@ -1,7 +1,7 @@
|
||||
mod.mc_dep_fabric==1.21.8
|
||||
mod.mc_dep_forgelike=[1.21.8]
|
||||
mod.mc_dep_fabric=>=1.21.6 <=1.21.8
|
||||
mod.mc_dep_forgelike=[1.21.6, 1.21.8]
|
||||
mod.mc_title=1.21.8
|
||||
mod.mc_targets=1.21.8
|
||||
mod.mc_targets=1.21.6 1.21.7 1.21.8
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.8.50
|
||||
|
||||
54
versions/1.21.8-fabric/src/main/resources/fabric.mod.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "${id}",
|
||||
"version": "${version}",
|
||||
"name": "${name}",
|
||||
"description": "Lightweight config library with config screens and commands.",
|
||||
"authors": [
|
||||
"Motschen"
|
||||
],
|
||||
"contributors": [
|
||||
"maloryware",
|
||||
"Jaffe2718"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://www.midnightdust.eu/",
|
||||
"sources": "https://github.com/TeamMidnightDust/MidnightLib",
|
||||
"issues": "https://github.com/TeamMidnightDust/MidnightLib/issues"
|
||||
},
|
||||
|
||||
"license": "MIT",
|
||||
"icon": "assets/midnightlib/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"server": [
|
||||
"eu.midnightdust.lib.config.AutoCommand"
|
||||
],
|
||||
"client": [
|
||||
"eu.midnightdust.core.MidnightLib"
|
||||
],
|
||||
"modmenu": [
|
||||
"eu.midnightdust.core.MidnightLib\$ModMenuInit"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabric-resource-loader-v0": "*",
|
||||
"minecraft": "${minecraft}"
|
||||
},
|
||||
|
||||
"mixins": [
|
||||
"midnightlib.mixins.json"
|
||||
],
|
||||
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
"links": {
|
||||
"modmenu.discord": "http://discord.midnightdust.eu/",
|
||||
"modmenu.website": "https://midnightdust.eu/midnightlib",
|
||||
"midnightlib.wiki": "https://midnightdust.eu/wiki/midnightlib"
|
||||
},
|
||||
"badges": [ "library" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
mod.mc_dep_fabric==1.21.5
|
||||
mod.mc_dep_forgelike=[1.21.5]
|
||||
mod.mc_title=1.21.5
|
||||
mod.mc_targets=1.21.5
|
||||
mod.mc_dep_fabric=>=1.21.6 <=1.21.8
|
||||
mod.mc_dep_forgelike=[1.21.6, 1.21.8]
|
||||
mod.mc_title=1.21.8
|
||||
mod.mc_targets=1.21.6 1.21.7 1.21.8
|
||||
|
||||
deps.forge_loader=0
|
||||
deps.neoforge_loader=21.8.50
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[2,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[mods]]
|
||||
modId = "midnightlib"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
logoFile = "midnightlib.png"
|
||||
authors = "TeamMidnightDust, Motschen"
|
||||
description = '''
|
||||
Lightweight config library with config screens and commands.
|
||||
'''
|
||||
|
||||
[[mixins]]
|
||||
config = "midnightlib.mixins.json"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "neoforge"
|
||||
mandatory = true
|
||||
versionRange = "[20.5,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "${minecraft}"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
BIN
versions/1.21.8-neoforge/src/main/resources/midnightlib.png
Normal file
|
After Width: | Height: | Size: 734 B |