mirror of
https://github.com/TeamMidnightDust/MidnightLib.git
synced 2025-12-15 09:05:08 +01:00
stonecutter: various fixes & improvements
This commit is contained in:
@@ -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,22 +50,14 @@ loom {
|
||||
}
|
||||
}
|
||||
if (loader == "forge") {
|
||||
forge.mixinConfigs(
|
||||
"midnightlib.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
|
||||
@@ -105,7 +89,52 @@ publishMods {
|
||||
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 {
|
||||
// publications {
|
||||
// create<MavenPublication>("mavenJava") {
|
||||
// pom {
|
||||
// groupId = "eu.midnightdust"
|
||||
// artifactId = "midnightlib"
|
||||
// version = project.version
|
||||
//
|
||||
// from(components["java"])
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "MidnightDust"
|
||||
url = uri("https://maven.midnightdust.eu/snapshots")
|
||||
credentials(PasswordCredentials::class)
|
||||
}
|
||||
}
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
pom {
|
||||
groupId = "eu.midnightdust"
|
||||
artifactId = project.mod.id
|
||||
version = "${project.version}-${loader}"
|
||||
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
|
||||
@@ -7,7 +7,7 @@ org.gradle.parallel=false
|
||||
#org.gradle.configureondemand=true
|
||||
|
||||
# Mod properties
|
||||
mod.version=1.8.3
|
||||
mod.version=1.9.0-alpha.1
|
||||
mod.group=eu.midnightdust
|
||||
mod.id=midnightlib
|
||||
mod.name=MidnightLib
|
||||
|
||||
@@ -80,7 +80,9 @@ public class MidnightLib {
|
||||
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))
|
||||
if (field.isAnnotationPresent(MidnightConfig.Entry.class)
|
||||
&& !field.isAnnotationPresent(MidnightConfig.Client.class)
|
||||
&& !field.isAnnotationPresent(MidnightConfig.Hidden.class))
|
||||
new AutoCommand(field, modid);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,18 +3,26 @@ 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(), "fabric");
|
||||
|
||||
@Entry public static ConfigButton config_screen_list = HAS_MODMENU ? ConfigButton.MODMENU : ConfigButton.TRUE;
|
||||
//? if fabric {
|
||||
@Entry public static ConfigButton config_screen_list = PlatformFunctions.isModLoaded("modmenu") ? ConfigButton.MODMENU : ConfigButton.TRUE;
|
||||
|
||||
public enum ConfigButton {
|
||||
TRUE, FALSE, MODMENU
|
||||
}
|
||||
|
||||
public static boolean shouldShowButton() {
|
||||
return config_screen_list.equals(ConfigButton.TRUE) || (config_screen_list.equals(ConfigButton.MODMENU) && !HAS_MODMENU);
|
||||
return config_screen_list.equals(ConfigButton.TRUE) || (config_screen_list.equals(ConfigButton.MODMENU) && !PlatformFunctions.isModLoaded("modmenu"));
|
||||
}
|
||||
//?} else {
|
||||
/*@Entry public static ConfigButton config_screen_list = ConfigButton.FALSE;
|
||||
|
||||
public enum ConfigButton {
|
||||
TRUE, FALSE
|
||||
}
|
||||
|
||||
public static boolean shouldShowButton() {
|
||||
return config_screen_list.equals(ConfigButton.TRUE);
|
||||
}
|
||||
*///?}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,6 @@ public class MidnightConfigScreen extends Screen {
|
||||
}
|
||||
info.actionButton = colorButton;
|
||||
} else if (e.selectionMode() > -1) {
|
||||
|
||||
Button explorerButton =
|
||||
//? if >= 1.21 {
|
||||
SpriteIconButton.builder(Component.empty(),
|
||||
|
||||
@@ -3,11 +3,7 @@ package eu.midnightdust.lib.util;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import eu.midnightdust.core.MidnightLib;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
|
||||
//? if fabric {
|
||||
import net.fabricmc.api.EnvType;
|
||||
@@ -20,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 {
|
||||
|
||||
@@ -1,50 +1,12 @@
|
||||
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")
|
||||
// }
|
||||
}
|
||||
|
||||
// See https://stonecutter.kikugie.dev/wiki/config/params
|
||||
stonecutter parameters {
|
||||
swaps["mod_version"] = "\"" + property("mod.version") + "\";"
|
||||
|
||||
Reference in New Issue
Block a user