dev: switch to stonecutter build system
- This will allow us to build the library for different Minecraft versions at the same time - Right now, only Fabric and Neoforge 1.21.10 are fully working - As a bonus, the jar is now even smaller!
0
CHANGELOG.md
Normal file
72
build.gradle
@@ -1,72 +0,0 @@
|
|||||||
import groovy.json.JsonSlurper
|
|
||||||
import groovy.json.JsonOutput
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
|
||||||
id "dev.architectury.loom" version "1.11-SNAPSHOT" apply false
|
|
||||||
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
|
||||||
}
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
minecraft = rootProject.minecraft_version
|
|
||||||
}
|
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply plugin: "dev.architectury.loom"
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
|
||||||
mappings loom.officialMojangMappings()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
apply plugin: "java"
|
|
||||||
apply plugin: "architectury-plugin"
|
|
||||||
apply plugin: "maven-publish"
|
|
||||||
|
|
||||||
archivesBaseName = rootProject.archives_base_name
|
|
||||||
version = rootProject.mod_version
|
|
||||||
group = rootProject.maven_group
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
// Add repositories to retrieve artifacts from in here.
|
|
||||||
// You should only use this when depending on other mods because
|
|
||||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
|
||||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
|
||||||
// for more information about repositories.
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
options.release = 21
|
|
||||||
}
|
|
||||||
ext {
|
|
||||||
releaseChangelog = {
|
|
||||||
def changes = new StringBuilder()
|
|
||||||
changes << "## MidnightLib v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/MidnightLib/commits/)"
|
|
||||||
def proc = "git log --max-count=1 --pretty=format:%s".execute()
|
|
||||||
proc.in.eachLine { line ->
|
|
||||||
def processedLine = line.toString()
|
|
||||||
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
|
|
||||||
changes << "\n- ${processedLine.capitalize()}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proc.waitFor()
|
|
||||||
return changes.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
processResources {
|
|
||||||
// Minify json resources
|
|
||||||
doLast {
|
|
||||||
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
|
|
||||||
File file -> file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
withSourcesJar()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
192
build.gradle.kts
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
import java.util.*
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("dev.architectury.loom")
|
||||||
|
id("architectury-plugin")
|
||||||
|
id("me.modmuss50.mod-publish-plugin")
|
||||||
|
id("com.github.johnrengelman.shadow")
|
||||||
|
}
|
||||||
|
|
||||||
|
val minecraft = stonecutter.current.version
|
||||||
|
val loader = loom.platform.get().name.lowercase()
|
||||||
|
|
||||||
|
version = "${mod.version}+$minecraft"
|
||||||
|
group = mod.group
|
||||||
|
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
|
||||||
|
maven("https://maven.terraformersmc.com/")
|
||||||
|
//placeholder api (modmenu depencency)
|
||||||
|
maven("https://maven.nucleoid.xyz/")
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
minecraft("com.mojang:minecraft:$minecraft")
|
||||||
|
|
||||||
|
if (loader == "fabric") {
|
||||||
|
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
|
||||||
|
modImplementation("net.fabricmc.fabric-api:fabric-api:${mod.dep("fabric_version")}")
|
||||||
|
}
|
||||||
|
if (loader == "forge") {
|
||||||
|
"forge"("net.minecraftforge:forge:${minecraft}-${mod.dep("forge_loader")}")
|
||||||
|
}
|
||||||
|
if (loader == "neoforge") {
|
||||||
|
"neoForge"("net.neoforged:neoforge:${mod.dep("neoforge_loader")}")
|
||||||
|
}
|
||||||
|
mappings (loom.officialMojangMappings())
|
||||||
|
}
|
||||||
|
|
||||||
|
loom {
|
||||||
|
//accessWidenerPath = rootProject.file("src/main/resources/template.accesswidener")
|
||||||
|
|
||||||
|
decompilers {
|
||||||
|
get("vineflower").apply { // Adds names to lambdas - useful for mixins
|
||||||
|
options.put("mark-corresponding-synthetics", "1")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (loader == "forge") {
|
||||||
|
forge.mixinConfigs(
|
||||||
|
"template-common.mixins.json",
|
||||||
|
"template-forge.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"))
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
changelog = rootProject.file("CHANGELOG.md").readText()
|
||||||
|
type = BETA
|
||||||
|
|
||||||
|
modLoaders.add(loader)
|
||||||
|
|
||||||
|
val targets = property("mod.mc_targets").toString().split(' ')
|
||||||
|
modrinth {
|
||||||
|
projectId = property("publish.modrinth").toString()
|
||||||
|
accessToken = modrinthToken
|
||||||
|
targets.forEach(minecraftVersions::add)
|
||||||
|
if (loader == "fabric") {
|
||||||
|
requires("fabric-api")
|
||||||
|
optional("modmenu")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curseforge {
|
||||||
|
projectId = property("publish.curseforge").toString()
|
||||||
|
accessToken = curseforgeToken.toString()
|
||||||
|
targets.forEach(minecraftVersions::add)
|
||||||
|
if (loader == "fabric") {
|
||||||
|
requires("fabric-api")
|
||||||
|
optional("modmenu")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
withSourcesJar()
|
||||||
|
val java = if (stonecutter.eval(minecraft, ">=1.20.5")) JavaVersion.VERSION_21 else JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = java
|
||||||
|
sourceCompatibility = java
|
||||||
|
}
|
||||||
|
|
||||||
|
val shadowBundle: Configuration by configurations.creating {
|
||||||
|
isCanBeConsumed = false
|
||||||
|
isCanBeResolved = true
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.shadowJar {
|
||||||
|
configurations = listOf(shadowBundle)
|
||||||
|
archiveClassifier = "dev-shadow"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.remapJar {
|
||||||
|
injectAccessWidener = true
|
||||||
|
input = tasks.shadowJar.get().archiveFile
|
||||||
|
archiveClassifier = null
|
||||||
|
dependsOn(tasks.shadowJar)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.jar {
|
||||||
|
archiveClassifier = "dev"
|
||||||
|
}
|
||||||
|
|
||||||
|
val buildAndCollect = tasks.register<Copy>("buildAndCollect") {
|
||||||
|
group = "build"
|
||||||
|
from(tasks.remapJar.get().archiveFile, tasks.remapSourcesJar.get().archiveFile)
|
||||||
|
into(rootProject.layout.buildDirectory.file("libs/${mod.version}/$loader"))
|
||||||
|
dependsOn("build")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stonecutter.current.isActive) {
|
||||||
|
rootProject.tasks.register("buildActive") {
|
||||||
|
group = "project"
|
||||||
|
dependsOn(buildAndCollect)
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.tasks.register("runActive") {
|
||||||
|
group = "project"
|
||||||
|
dependsOn(tasks.named("runClient"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.processResources {
|
||||||
|
properties(
|
||||||
|
listOf("fabric.mod.json"),
|
||||||
|
"id" to mod.id,
|
||||||
|
"name" to mod.name,
|
||||||
|
"version" to mod.version,
|
||||||
|
"minecraft" to mod.prop("mc_dep_fabric")
|
||||||
|
)
|
||||||
|
properties(
|
||||||
|
listOf("META-INF/mods.toml", "pack.mcmeta"),
|
||||||
|
"id" to mod.id,
|
||||||
|
"name" to mod.name,
|
||||||
|
"version" to mod.version,
|
||||||
|
"minecraft" to mod.prop("mc_dep_forgelike")
|
||||||
|
)
|
||||||
|
properties(
|
||||||
|
listOf("META-INF/neoforge.mods.toml", "pack.mcmeta"),
|
||||||
|
"id" to mod.id,
|
||||||
|
"name" to mod.name,
|
||||||
|
"version" to mod.version,
|
||||||
|
"minecraft" to mod.prop("mc_dep_forgelike")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.build {
|
||||||
|
group = "versioned"
|
||||||
|
description = "Must run through 'chiseledBuild'"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
stonecutter {
|
||||||
|
constants {
|
||||||
|
arrayOf("fabric", "neoforge", "forge").forEach { it -> put(it, loader == it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
8
buildSrc/build.gradle.kts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
kotlin("jvm") version "2.0.20"
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
33
buildSrc/src/main/kotlin/build-extensions.kt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||||
|
import org.gradle.kotlin.dsl.expand
|
||||||
|
import org.gradle.kotlin.dsl.maven
|
||||||
|
import org.gradle.language.jvm.tasks.ProcessResources
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
val Project.mod: ModData get() = ModData(this)
|
||||||
|
fun Project.prop(key: String): String? = findProperty(key)?.toString()
|
||||||
|
fun String.upperCaseFirst() = replaceFirstChar { if (it.isLowerCase()) it.uppercaseChar() else it }
|
||||||
|
|
||||||
|
fun RepositoryHandler.strictMaven(url: String, alias: String, vararg groups: String) = exclusiveContent {
|
||||||
|
forRepository { maven(url) { name = alias } }
|
||||||
|
filter { groups.forEach(::includeGroup) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ProcessResources.properties(files: Iterable<String>, vararg properties: Pair<String, Any>) {
|
||||||
|
for ((name, value) in properties) inputs.property(name, value)
|
||||||
|
filesMatching(files) {
|
||||||
|
expand(properties.toMap())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class ModData(private val project: Project) {
|
||||||
|
val id: String get() = requireNotNull(project.prop("mod.id")) { "Missing 'mod.id'" }
|
||||||
|
val name: String get() = requireNotNull(project.prop("mod.name")) { "Missing 'mod.name'" }
|
||||||
|
val version: String get() = requireNotNull(project.prop("mod.version")) { "Missing 'mod.version'" }
|
||||||
|
val group: String get() = requireNotNull(project.prop("mod.group")) { "Missing 'mod.group'" }
|
||||||
|
|
||||||
|
fun prop(key: String) = requireNotNull(project.prop("mod.$key")) { "Missing 'mod.$key'" }
|
||||||
|
fun dep(key: String) = requireNotNull(project.prop("deps.$key")) { "Missing 'deps.$key'" }
|
||||||
|
}
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'java'
|
|
||||||
}
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
common(rootProject.enabled_platforms.split(","))
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
|
||||||
// Do NOT use other classes from fabric loader
|
|
||||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenCommon(MavenPublication) {
|
|
||||||
artifactId = rootProject.archives_base_name
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
|
||||||
repositories {
|
|
||||||
// Add repositories to publish to here.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
testOutput.extendsFrom(testImplementation)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register('testJar', Jar) {
|
|
||||||
from sourceSets.test.output
|
|
||||||
archiveClassifier = 'tests'
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
testOutput testJar
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
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 java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MidnightLib {
|
|
||||||
public static List<String> hiddenMods = new ArrayList<>();
|
|
||||||
public static final String MOD_ID = "midnightlib";
|
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
|
||||||
|
|
||||||
public static void onInitializeClient() {
|
|
||||||
try {
|
|
||||||
if (Util.getPlatform() != Util.OS.OSX) {
|
|
||||||
System.setProperty("java.awt.headless", "false");
|
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
|
||||||
}
|
|
||||||
} catch (Exception | Error e) { LOGGER.error("Error setting system look and feel", e); }
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package eu.midnightdust.lib.util;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
||||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
|
|
||||||
public class PlatformFunctions {
|
|
||||||
@ExpectPlatform
|
|
||||||
public static String getPlatformName() {
|
|
||||||
// Just throw an error, the content should get replaced at runtime.
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
@ExpectPlatform
|
|
||||||
public static Path getConfigDirectory() {
|
|
||||||
// Just throw an error, the content should get replaced at runtime.
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
@ExpectPlatform
|
|
||||||
public static boolean isClientEnv() {
|
|
||||||
// Just throw an error, the content should get replaced at runtime.
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
@ExpectPlatform
|
|
||||||
public static boolean isModLoaded(String modid) {
|
|
||||||
// Just throw an error, the content should get replaced at runtime.
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
@ExpectPlatform
|
|
||||||
public static void registerCommand(LiteralArgumentBuilder<CommandSourceStack> command) {
|
|
||||||
// Just throw an error, the content should get replaced at runtime.
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.github.johnrengelman.shadow'
|
|
||||||
id "me.shedaniel.unified-publishing"
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
maven { url "https://maven.terraformersmc.com/releases" }
|
|
||||||
}
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
platformSetupLoomIde()
|
|
||||||
fabric()
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
test {
|
|
||||||
compileClasspath += main.compileClasspath
|
|
||||||
runtimeClasspath += main.runtimeClasspath
|
|
||||||
java {
|
|
||||||
srcDirs.add('src/test/java' as File)
|
|
||||||
}
|
|
||||||
resources {
|
|
||||||
srcDirs.add('src/test/resources' as File)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loom {
|
|
||||||
runs {
|
|
||||||
testClient {
|
|
||||||
client()
|
|
||||||
configName = "Test Minecraft Client"
|
|
||||||
source sourceSets.test
|
|
||||||
}
|
|
||||||
testServer {
|
|
||||||
server()
|
|
||||||
configName = "Test Minecraft Server"
|
|
||||||
source sourceSets.test
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
common
|
|
||||||
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
|
||||||
compileClasspath.extendsFrom common
|
|
||||||
runtimeClasspath.extendsFrom common
|
|
||||||
developmentFabric.extendsFrom common
|
|
||||||
archivesBaseName = rootProject.archives_base_name
|
|
||||||
version = rootProject.mod_version + "-" + project.name + "+" + rootProject.minecraft_version
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
|
||||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
|
||||||
modCompileOnly("com.terraformersmc:modmenu:${rootProject.mod_menu_version}")
|
|
||||||
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
|
||||||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
|
||||||
|
|
||||||
testImplementation common(project(path: ':common', configuration: 'testOutput'))
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
inputs.property "version", rootProject.version
|
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
|
||||||
expand "version": rootProject.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processTestResources {
|
|
||||||
inputs.property "version", rootProject.version
|
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
|
||||||
expand "version": rootProject.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
exclude "architectury.common.json"
|
|
||||||
|
|
||||||
configurations = [project.configurations.shadowCommon]
|
|
||||||
archiveClassifier = "dev-shadow"
|
|
||||||
}
|
|
||||||
|
|
||||||
remapJar {
|
|
||||||
input.set shadowJar.archiveFile
|
|
||||||
dependsOn shadowJar
|
|
||||||
}
|
|
||||||
|
|
||||||
sourcesJar {
|
|
||||||
def commonSources = project(":common").sourcesJar
|
|
||||||
dependsOn commonSources
|
|
||||||
from commonSources.archiveFile.map { zipTree(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
components.java {
|
|
||||||
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
|
||||||
skip()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unifiedPublishing {
|
|
||||||
project {
|
|
||||||
displayName = "MidnightLib $rootProject.version - Fabric $project.minecraft_version"
|
|
||||||
releaseType = "$project.release_type"
|
|
||||||
changelog = releaseChangelog()
|
|
||||||
gameVersions = []
|
|
||||||
gameLoaders = ["fabric", "quilt"]
|
|
||||||
mainPublication remapJar
|
|
||||||
relations {
|
|
||||||
depends {
|
|
||||||
curseforge = "fabric-api"
|
|
||||||
modrinth = "fabric-api"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
|
|
||||||
if (CURSEFORGE_TOKEN != null) {
|
|
||||||
curseforge {
|
|
||||||
token = CURSEFORGE_TOKEN
|
|
||||||
id = rootProject.curseforge_id
|
|
||||||
gameVersions.addAll "Java 21", project.minecraft_version
|
|
||||||
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
|
|
||||||
if (MODRINTH_TOKEN != null) {
|
|
||||||
modrinth {
|
|
||||||
token = MODRINTH_TOKEN
|
|
||||||
id = rootProject.modrinth_id
|
|
||||||
version = rootProject.mod_version + "+" + rootProject.minecraft_version + "-" + project.name
|
|
||||||
gameVersions.addAll project.minecraft_version
|
|
||||||
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package eu.midnightdust.fabric.core;
|
|
||||||
|
|
||||||
import eu.midnightdust.core.MidnightLib;
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
|
||||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
|
||||||
|
|
||||||
public class MidnightLibFabric implements DedicatedServerModInitializer, ClientModInitializer {
|
|
||||||
@Override
|
|
||||||
public void onInitializeClient() {
|
|
||||||
MidnightLib.onInitializeClient();
|
|
||||||
MidnightLib.registerAutoCommand();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onInitializeServer() {MidnightLib.registerAutoCommand();}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package eu.midnightdust.lib.config;
|
|
||||||
|
|
||||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
|
||||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
|
||||||
import eu.midnightdust.core.MidnightLib;
|
|
||||||
import eu.midnightdust.core.config.MidnightLibConfig;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class AutoModMenu implements ModMenuApi {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
|
||||||
return parent -> MidnightLibConfig.getScreen(parent,"midnightlib");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
|
||||||
HashMap<String, ConfigScreenFactory<?>> map = new HashMap<>();
|
|
||||||
MidnightConfig.configInstances.forEach((modid, cClass) -> {
|
|
||||||
if (!MidnightLib.hiddenMods.contains(modid))
|
|
||||||
map.put(modid, parent -> MidnightConfig.getScreen(parent, modid));
|
|
||||||
});
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package eu.midnightdust.lib.util.fabric;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
||||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
|
||||||
import net.fabricmc.api.EnvType;
|
|
||||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public class PlatformFunctionsImpl {
|
|
||||||
public static String getPlatformName() {
|
|
||||||
return "fabric";
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This is our actual method to {@link PlatformFunctions#getConfigDirectory()}.
|
|
||||||
*/
|
|
||||||
public static Path getConfigDirectory() {
|
|
||||||
return FabricLoader.getInstance().getConfigDir();
|
|
||||||
}
|
|
||||||
public static boolean isClientEnv() {
|
|
||||||
return FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT;
|
|
||||||
}
|
|
||||||
public static boolean isModLoaded(String modid) {
|
|
||||||
return FabricLoader.getInstance().isModLoaded(modid);
|
|
||||||
}
|
|
||||||
public static void registerCommand(LiteralArgumentBuilder<CommandSourceStack> command) {
|
|
||||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated, registrationEnvironment) -> dispatcher.register(command));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package eu.midnightdust.test.fabric;
|
|
||||||
|
|
||||||
import eu.midnightdust.test.config.MidnightConfigExample;
|
|
||||||
import eu.midnightdust.lib.config.MidnightConfig;
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
|
||||||
|
|
||||||
public class MLExampleFabric implements ModInitializer {
|
|
||||||
@Override
|
|
||||||
public void onInitialize() {
|
|
||||||
MidnightConfig.init("modid", MidnightConfigExample.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"schemaVersion": 1,
|
|
||||||
"id": "modid",
|
|
||||||
"version": "${version}",
|
|
||||||
|
|
||||||
"name": "MidnightLib Test Mod",
|
|
||||||
"description": "Example Mod for Team MidnightDust's mods.",
|
|
||||||
"authors": [ "MidnightDust" ],
|
|
||||||
|
|
||||||
"license": "CC0",
|
|
||||||
"icon": "assets/midnightlib/icon.png",
|
|
||||||
|
|
||||||
"environment": "*",
|
|
||||||
"entrypoints": {
|
|
||||||
"main": [
|
|
||||||
"eu.midnightdust.test.fabric.MLExampleFabric"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"depends": {
|
|
||||||
"fabric-resource-loader-v0": "*",
|
|
||||||
"midnightlib": ">=1.6.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +1,37 @@
|
|||||||
org.gradle.jvmargs=-Xmx3172M
|
# Done to increase the memory available to gradle.
|
||||||
|
org.gradle.jvmargs=-Xmx3G
|
||||||
|
#org.gradle.parallel=true
|
||||||
|
org.gradle.caching=false
|
||||||
|
org.gradle.caching.debug=false
|
||||||
|
org.gradle.parallel=false
|
||||||
|
#org.gradle.configureondemand=true
|
||||||
|
|
||||||
minecraft_version=1.21.10
|
# Mod properties
|
||||||
supported_versions=1.21.9
|
mod.version=1.8.3
|
||||||
yarn_mappings=1.21.10+build.2
|
mod.group=eu.midnightdust
|
||||||
enabled_platforms=fabric,neoforge
|
mod.id=midnightlib
|
||||||
|
mod.name=MidnightLib
|
||||||
|
|
||||||
archives_base_name=midnightlib
|
# Used for the mod metadata
|
||||||
mod_version=1.8.3
|
mod.mc_dep_fabric=[VERSIONED]
|
||||||
maven_group=eu.midnightdust
|
mod.mc_dep_forgelike=[VERSIONED]
|
||||||
release_type=release
|
# Used for the release title. I.e. '1.20.x'
|
||||||
curseforge_id=488090
|
mod.mc_title=[VERSIONED]
|
||||||
modrinth_id=codAaoxh
|
# Space separated versions for publishing. I.e. '1.20, 1.20.1'
|
||||||
|
mod.mc_targets=[VERSIONED]
|
||||||
|
|
||||||
fabric_loader_version=0.17.3
|
# Mod setup
|
||||||
fabric_api_version=0.138.0+1.21.10
|
deps.fabric_loader=0.17.3
|
||||||
|
deps.fabric_version=[VERSIONED]
|
||||||
|
|
||||||
neoforge_version=21.10.47-beta
|
deps.forge_loader=[VERSIONED]
|
||||||
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
deps.neoforge_loader=[VERSIONED]
|
||||||
|
deps.neoforge_patch=[VERSIONED]
|
||||||
|
|
||||||
mod_menu_version = 9.0.0
|
# Mod dependencies
|
||||||
|
deps.yarn_build=[VERSIONED]
|
||||||
|
deps.modmenu_version=[VERSIONED]
|
||||||
|
|
||||||
|
# Publishing
|
||||||
|
publish.modrinth=codAaoxh
|
||||||
|
publish.curseforge=488090
|
||||||
@@ -1,167 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.github.johnrengelman.shadow'
|
|
||||||
id "me.shedaniel.unified-publishing"
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = 'NeoForged'
|
|
||||||
url = 'https://maven.neoforged.net/releases'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
platformSetupLoomIde()
|
|
||||||
neoForge {
|
|
||||||
platformPackage = "neoforge"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
test {
|
|
||||||
compileClasspath += main.compileClasspath
|
|
||||||
runtimeClasspath += main.runtimeClasspath
|
|
||||||
java {
|
|
||||||
srcDirs.add('src/test/java' as File)
|
|
||||||
}
|
|
||||||
resources {
|
|
||||||
srcDirs.add('src/test/resources' as File)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loom {
|
|
||||||
accessWidenerPath = project(":common").loom.accessWidenerPath
|
|
||||||
|
|
||||||
runs {
|
|
||||||
testClient {
|
|
||||||
client()
|
|
||||||
name = "Test Minecraft Client"
|
|
||||||
|
|
||||||
mods {
|
|
||||||
create('midnightlib') {
|
|
||||||
sourceSet sourceSets.main
|
|
||||||
}
|
|
||||||
create('modid') { // test mod
|
|
||||||
sourceSet sourceSets.test
|
|
||||||
}
|
|
||||||
}
|
|
||||||
source sourceSets.test
|
|
||||||
}
|
|
||||||
testServer {
|
|
||||||
server()
|
|
||||||
name = "Test Minecraft Server"
|
|
||||||
|
|
||||||
mods {
|
|
||||||
create('midnightlib') {
|
|
||||||
sourceSet sourceSets.main
|
|
||||||
}
|
|
||||||
create('modid') { // test mod
|
|
||||||
sourceSet sourceSets.test
|
|
||||||
}
|
|
||||||
}
|
|
||||||
source sourceSets.test
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
common {
|
|
||||||
canBeResolved = true
|
|
||||||
canBeConsumed = false
|
|
||||||
}
|
|
||||||
compileClasspath.extendsFrom common
|
|
||||||
runtimeClasspath.extendsFrom common
|
|
||||||
developmentNeoForge.extendsFrom common
|
|
||||||
|
|
||||||
// Files in this configuration will be bundled into your mod using the Shadow plugin.
|
|
||||||
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
|
|
||||||
shadowBundle {
|
|
||||||
canBeResolved = true
|
|
||||||
canBeConsumed = false
|
|
||||||
}
|
|
||||||
archivesBaseName = rootProject.archives_base_name
|
|
||||||
version = rootProject.mod_version + "-" + project.name + "+" + rootProject.minecraft_version
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
|
|
||||||
|
|
||||||
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
|
||||||
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
|
|
||||||
|
|
||||||
// testImplementation common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
|
||||||
testImplementation common(project(path: ':common', configuration: 'testOutput')) { transitive false }
|
|
||||||
testImplementation sourceSets.main.output
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
inputs.property 'version', rootProject.version
|
|
||||||
|
|
||||||
filesMatching('META-INF/neoforge.mods.toml') {
|
|
||||||
expand version: rootProject.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processTestResources {
|
|
||||||
inputs.property 'version', rootProject.version
|
|
||||||
|
|
||||||
filesMatching('META-INF/neoforge.mods.toml') {
|
|
||||||
expand version: rootProject.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
configurations = [project.configurations.shadowBundle]
|
|
||||||
archiveClassifier = 'dev-shadow'
|
|
||||||
}
|
|
||||||
|
|
||||||
remapJar {
|
|
||||||
input.set shadowJar.archiveFile
|
|
||||||
}
|
|
||||||
|
|
||||||
sourcesJar {
|
|
||||||
def commonSources = project(":common").sourcesJar
|
|
||||||
dependsOn commonSources
|
|
||||||
from commonSources.archiveFile.map { zipTree(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
components.java {
|
|
||||||
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
|
||||||
skip()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unifiedPublishing {
|
|
||||||
project {
|
|
||||||
displayName = "MidnightLib $rootProject.version - NeoForge $project.minecraft_version"
|
|
||||||
releaseType = "$project.release_type"
|
|
||||||
changelog = releaseChangelog()
|
|
||||||
gameVersions = []
|
|
||||||
gameLoaders = ["neoforge"]
|
|
||||||
mainPublication remapJar
|
|
||||||
|
|
||||||
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
|
|
||||||
if (CURSEFORGE_TOKEN != null) {
|
|
||||||
curseforge {
|
|
||||||
token = CURSEFORGE_TOKEN
|
|
||||||
id = rootProject.curseforge_id
|
|
||||||
gameVersions.addAll "Java 21", project.minecraft_version
|
|
||||||
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
|
|
||||||
if (MODRINTH_TOKEN != null) {
|
|
||||||
modrinth {
|
|
||||||
token = MODRINTH_TOKEN
|
|
||||||
id = rootProject.modrinth_id
|
|
||||||
version = rootProject.mod_version + "+" + rootProject.minecraft_version + "-" + project.name
|
|
||||||
gameVersions.addAll project.minecraft_version
|
|
||||||
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
loom.platform=neoforge
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package eu.midnightdust.lib.util.neoforge;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
||||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.neoforged.fml.ModList;
|
|
||||||
import net.neoforged.fml.loading.FMLEnvironment;
|
|
||||||
import net.neoforged.fml.loading.FMLPaths;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
import static eu.midnightdust.neoforge.MidnightLibNeoForge.commands;
|
|
||||||
|
|
||||||
public class PlatformFunctionsImpl {
|
|
||||||
public static String getPlatformName() {
|
|
||||||
return "neoforge";
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This is our actual method to {@link PlatformFunctions#getConfigDirectory()}.
|
|
||||||
*/
|
|
||||||
public static Path getConfigDirectory() {
|
|
||||||
return FMLPaths.CONFIGDIR.get();
|
|
||||||
}
|
|
||||||
public static boolean isClientEnv() {
|
|
||||||
return FMLEnvironment.getDist().isClient();
|
|
||||||
}
|
|
||||||
public static boolean isModLoaded(String modid) {
|
|
||||||
return ModList.get().isLoaded(modid);
|
|
||||||
}
|
|
||||||
public static void registerCommand(LiteralArgumentBuilder<CommandSourceStack> command) {
|
|
||||||
commands.add(command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package eu.midnightdust.neoforge;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
||||||
import eu.midnightdust.core.MidnightLib;
|
|
||||||
import eu.midnightdust.lib.config.MidnightConfig;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.neoforged.api.distmarker.Dist;
|
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
|
||||||
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.loading.FMLEnvironment;
|
|
||||||
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")
|
|
||||||
public class MidnightLibNeoForge {
|
|
||||||
public static List<LiteralArgumentBuilder<CommandSourceStack>> commands = new ArrayList<>();
|
|
||||||
|
|
||||||
public MidnightLibNeoForge() {
|
|
||||||
if (FMLEnvironment.getDist() == Dist.CLIENT) MidnightLib.onInitializeClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventBusSubscriber(modid = "midnightlib", 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(IConfigScreenFactory.class, (minecraftClient, screen) -> MidnightConfig.getScreen(screen, modid));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
MidnightLib.registerAutoCommand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventBusSubscriber(modid = "midnightlib")
|
|
||||||
public static class MidnightLibEvents {
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void registerCommands(RegisterCommandsEvent event) {
|
|
||||||
try {
|
|
||||||
commands.forEach(command -> event.getDispatcher().register(command));
|
|
||||||
}
|
|
||||||
catch (ConcurrentModificationException ignored) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 2.7 KiB |
@@ -1,12 +0,0 @@
|
|||||||
package eu.midnightdust.test.neoforge;
|
|
||||||
|
|
||||||
import eu.midnightdust.test.config.MidnightConfigExample;
|
|
||||||
import net.neoforged.fml.common.Mod;
|
|
||||||
|
|
||||||
@Mod(MLExampleNeoForge.MODID)
|
|
||||||
public class MLExampleNeoForge {
|
|
||||||
public static final String MODID = "modid";
|
|
||||||
public MLExampleNeoForge() {
|
|
||||||
MidnightConfigExample.init(MODID, MidnightConfigExample.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
modLoader = "javafml"
|
|
||||||
loaderVersion = "[2,)"
|
|
||||||
#issueTrackerURL = ""
|
|
||||||
license = "MIT License"
|
|
||||||
|
|
||||||
[[mods]]
|
|
||||||
modId = "modid"
|
|
||||||
version = "${version}"
|
|
||||||
displayName = "MidnightLib Test Mod"
|
|
||||||
authors = "TeamMidnightDust, Motschen"
|
|
||||||
description = '''
|
|
||||||
Example Mod for Team MidnightDust's mods.
|
|
||||||
'''
|
|
||||||
|
|
||||||
[[dependencies.modid]]
|
|
||||||
modId = "neoforge"
|
|
||||||
mandatory = true
|
|
||||||
versionRange = "[20.5,)"
|
|
||||||
ordering = "NONE"
|
|
||||||
side = "BOTH"
|
|
||||||
|
|
||||||
[[dependencies.modid]]
|
|
||||||
modId = "minecraft"
|
|
||||||
mandatory = true
|
|
||||||
versionRange = "[1.20.5,)"
|
|
||||||
ordering = "NONE"
|
|
||||||
side = "BOTH"
|
|
||||||
|
|
||||||
[[dependencies.modid]]
|
|
||||||
modId = "midnightlib"
|
|
||||||
mandatory = true
|
|
||||||
versionRange = "[1.0,)"
|
|
||||||
ordering = "NONE"
|
|
||||||
side = "BOTH"
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id "com.github.johnrengelman.shadow" version "7.1.2"
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven { url "https://maven.quiltmc.org/repository/release/" }
|
|
||||||
}
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
platformSetupLoomIde()
|
|
||||||
loader("quilt")
|
|
||||||
}
|
|
||||||
|
|
||||||
loom {
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
common
|
|
||||||
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
|
|
||||||
compileClasspath.extendsFrom common
|
|
||||||
runtimeClasspath.extendsFrom common
|
|
||||||
developmentQuilt.extendsFrom common
|
|
||||||
archivesBaseName = rootProject.archives_base_name + "-quilt"
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
modImplementation "org.quiltmc:quilt-loader:${rootProject.quilt_loader_version}"
|
|
||||||
modApi "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.quilt_fabric_api_version}"
|
|
||||||
// Remove the next few lines if you don't want to depend on the API
|
|
||||||
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
|
||||||
shadowCommon(project(path: ":common", configuration: "transformProductionQuilt")) { transitive false }
|
|
||||||
common(project(path: ":fabric-like", configuration: "namedElements")) { transitive false }
|
|
||||||
shadowCommon(project(path: ":fabric-like", configuration: "transformProductionQuilt")) { transitive false }
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
inputs.property "group", rootProject.maven_group
|
|
||||||
inputs.property "version", project.version
|
|
||||||
|
|
||||||
filesMatching("quilt.mod.json") {
|
|
||||||
expand "group": rootProject.maven_group,
|
|
||||||
"version": project.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
exclude "architectury.common.json"
|
|
||||||
|
|
||||||
configurations = [project.configurations.shadowCommon]
|
|
||||||
classifier "dev-shadow"
|
|
||||||
}
|
|
||||||
|
|
||||||
remapJar {
|
|
||||||
input.set shadowJar.archiveFile
|
|
||||||
dependsOn shadowJar
|
|
||||||
classifier null
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
classifier "dev"
|
|
||||||
}
|
|
||||||
|
|
||||||
sourcesJar {
|
|
||||||
def commonSources = project(":common").sourcesJar
|
|
||||||
dependsOn commonSources
|
|
||||||
from commonSources.archiveFile.map { zipTree(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
components.java {
|
|
||||||
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
|
||||||
skip()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenQuilt(MavenPublication) {
|
|
||||||
artifactId = rootProject.archives_base_name + "-" + project.name
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
|
||||||
repositories {
|
|
||||||
// Add repositories to publish to here.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
loom.platform=quilt
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package eu.midnightdust.lib.util.fabric;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
||||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
|
||||||
import net.fabricmc.api.EnvType;
|
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
|
||||||
import org.quiltmc.loader.api.QuiltLoader;
|
|
||||||
import org.quiltmc.loader.api.minecraft.MinecraftQuiltLoader;
|
|
||||||
import org.quiltmc.qsl.command.api.CommandRegistrationCallback;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public class PlatformFunctionsImpl {
|
|
||||||
/**
|
|
||||||
* This is our actual method to {@link PlatformFunctions#getConfigDirectory()}.
|
|
||||||
*/
|
|
||||||
public static Path getConfigDirectory() {
|
|
||||||
return QuiltLoader.getConfigDir();
|
|
||||||
}
|
|
||||||
public static boolean isClientEnv() {
|
|
||||||
return MinecraftQuiltLoader.getEnvironmentType() == EnvType.CLIENT;
|
|
||||||
}
|
|
||||||
public static boolean isModLoaded(String modid) {
|
|
||||||
return QuiltLoader.isModLoaded(modid);
|
|
||||||
}
|
|
||||||
public static void registerCommand(LiteralArgumentBuilder<ServerCommandSource> command) {
|
|
||||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated, registrationEnvironment) -> dispatcher.register(command));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package eu.midnightdust.quilt.core;
|
|
||||||
|
|
||||||
import eu.midnightdust.core.MidnightLibClient;
|
|
||||||
import eu.midnightdust.lib.util.MidnightColorUtil;
|
|
||||||
import org.quiltmc.loader.api.ModContainer;
|
|
||||||
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
|
|
||||||
import org.quiltmc.qsl.lifecycle.api.client.event.ClientTickEvents;
|
|
||||||
|
|
||||||
public class MidnightLibClientQuilt implements ClientModInitializer {
|
|
||||||
@Override
|
|
||||||
public void onInitializeClient(ModContainer mod) {
|
|
||||||
MidnightLibClient.onInitializeClient();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package eu.midnightdust.quilt.core;
|
|
||||||
|
|
||||||
import eu.midnightdust.core.MidnightLibServer;
|
|
||||||
import org.quiltmc.loader.api.ModContainer;
|
|
||||||
import org.quiltmc.qsl.base.api.entrypoint.server.DedicatedServerModInitializer;
|
|
||||||
|
|
||||||
public class MidnightLibServerQuilt implements DedicatedServerModInitializer {
|
|
||||||
@Override
|
|
||||||
public void onInitializeServer(ModContainer mod) {
|
|
||||||
MidnightLibServer.onInitializeServer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
{
|
|
||||||
"schema_version": 1,
|
|
||||||
"quilt_loader": {
|
|
||||||
"group": "${group}",
|
|
||||||
"id": "midnightlib",
|
|
||||||
"version": "${version}",
|
|
||||||
"intermediate_mappings": "net.fabricmc:intermediary",
|
|
||||||
"entrypoints": {
|
|
||||||
"client_init": [
|
|
||||||
"eu.midnightdust.quilt.core.MidnightLibClientQuilt"
|
|
||||||
],
|
|
||||||
"server_init": [
|
|
||||||
"eu.midnightdust.quilt.core.MidnightLibServerQuilt"
|
|
||||||
],
|
|
||||||
"modmenu": [
|
|
||||||
"eu.midnightdust.lib.config.AutoModMenu"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"depends": [
|
|
||||||
{
|
|
||||||
"id": "quilt_loader",
|
|
||||||
"version": "*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "quilt_base",
|
|
||||||
"version": "*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "minecraft",
|
|
||||||
"version": ">=1.19.4"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"metadata": {
|
|
||||||
"name": "MidnightLib (Quilt)",
|
|
||||||
"description": "Common Library for Team MidnightDust's mods. Provides a config api, automatic integration with other mods, common utils, and cosmetics.",
|
|
||||||
"license": "MIT",
|
|
||||||
"environment": "*",
|
|
||||||
"contributors": {
|
|
||||||
"Motschen": "Author",
|
|
||||||
"TeamMidnightDust": "Mascot"
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"email": "mail@midnightdust.eu",
|
|
||||||
"homepage": "https://modrinth.com/mod/midnightlib",
|
|
||||||
"issues": "https://github.com/TeamMidnightDust/MidnightLib/issues",
|
|
||||||
"sources": "https://github.com/TeamMidnightDust/MidnightLib"
|
|
||||||
},
|
|
||||||
"icon": "assets/midnightlib/icon.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mixin": [
|
|
||||||
"midnightlib.mixins.json"
|
|
||||||
],
|
|
||||||
"modmenu": {
|
|
||||||
"links": {
|
|
||||||
"modmenu.discord": "https://discord.midnightdust.eu/",
|
|
||||||
"modmenu.website": "https://www.midnightdust.eu/",
|
|
||||||
"midnightlib.curseforge": "https://www.curseforge.com/minecraft/mc-mods/midnightlib",
|
|
||||||
"midnightlib.modrinth": "https://modrinth.com/mod/midnightlib",
|
|
||||||
"midnightlib.wiki": "https://github.com/TeamMidnightDust/MidnightLib/wiki"
|
|
||||||
},
|
|
||||||
"badges": [ "library" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
maven { url "https://maven.fabricmc.net/" }
|
|
||||||
maven { url "https://maven.architectury.dev/" }
|
|
||||||
maven { url "https://maven.neoforged.net/releases" }
|
|
||||||
gradlePluginPortal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
include("common")
|
|
||||||
include("fabric")
|
|
||||||
include("neoforge")
|
|
||||||
//include("quilt")
|
|
||||||
|
|
||||||
rootProject.name = "midnightlib"
|
|
||||||
33
settings.gradle.kts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven("https://maven.fabricmc.net/")
|
||||||
|
maven("https://maven.architectury.dev")
|
||||||
|
maven("https://maven.minecraftforge.net")
|
||||||
|
maven("https://maven.neoforged.net/releases/")
|
||||||
|
maven("https://maven.kikugie.dev/snapshots")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("dev.kikugie.stonecutter") version "0.7"
|
||||||
|
}
|
||||||
|
|
||||||
|
stonecutter {
|
||||||
|
centralScript = "build.gradle.kts"
|
||||||
|
kotlinController = true
|
||||||
|
shared {
|
||||||
|
fun mc(loader: String, vararg versions: String) {
|
||||||
|
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("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")
|
||||||
|
}
|
||||||
|
create(rootProject)
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "MidnightLib"
|
||||||
125
src/main/java/eu/midnightdust/core/MidnightLib.java
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
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 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;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class MidnightLib implements DedicatedServerModInitializer, ClientModInitializer, ModMenuApi {
|
||||||
|
//?} else if neoforge {
|
||||||
|
/*import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
|
||||||
|
import net.neoforged.api.distmarker.Dist;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.fml.ModList;
|
||||||
|
import net.neoforged.fml.common.Mod;
|
||||||
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
|
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
|
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||||
|
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||||
|
|
||||||
|
import java.util.ConcurrentModificationException;
|
||||||
|
|
||||||
|
@Mod("midnightlib")
|
||||||
|
public class MidnightLib {
|
||||||
|
*///?}
|
||||||
|
public static List<String> hiddenMods = new ArrayList<>();
|
||||||
|
public static final String MOD_ID = "midnightlib";
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||||
|
|
||||||
|
public void onInitializeClient() {
|
||||||
|
try {
|
||||||
|
if (Util.getPlatform() != Util.OS.OSX) {
|
||||||
|
System.setProperty("java.awt.headless", "false");
|
||||||
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
|
}
|
||||||
|
} catch (Exception | Error e) { LOGGER.error("Error setting system look and feel", e); }
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||||
|
return parent -> MidnightLibConfig.getScreen(parent,"midnightlib");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||||
|
HashMap<String, ConfigScreenFactory<?>> map = new HashMap<>();
|
||||||
|
MidnightConfig.configInstances.forEach((modid, cClass) -> {
|
||||||
|
if (!MidnightLib.hiddenMods.contains(modid))
|
||||||
|
map.put(modid, parent -> MidnightConfig.getScreen(parent, modid));
|
||||||
|
});
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
//?}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*? if neoforge {*/
|
||||||
|
|
||||||
|
/*public static List<LiteralArgumentBuilder<CommandSourceStack>> commands = new ArrayList<>();
|
||||||
|
|
||||||
|
public MidnightLib() {
|
||||||
|
if (PlatformFunctions.isClientEnv()) this.onInitializeClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventBusSubscriber(modid = "midnightlib", 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(IConfigScreenFactory.class, (minecraftClient, screen) -> MidnightConfig.getScreen(screen, modid));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
MidnightLib.registerAutoCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventBusSubscriber(modid = "midnightlib")
|
||||||
|
public static class MidnightLibEvents {
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void registerCommands(RegisterCommandsEvent event) {
|
||||||
|
try {
|
||||||
|
commands.forEach(command -> event.getDispatcher().register(command));
|
||||||
|
}
|
||||||
|
catch (ConcurrentModificationException ignored) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*///?}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package eu.midnightdust.lib.config;
|
package eu.midnightdust.lib.config;
|
||||||
|
|
||||||
import com.mojang.brigadier.arguments.*;
|
import com.mojang.brigadier.arguments.*;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
import eu.midnightdust.lib.config.MidnightConfig.Entry;
|
import eu.midnightdust.lib.config.MidnightConfig.Entry;
|
||||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||||
@@ -12,8 +11,6 @@ import net.minecraft.commands.CommandSourceStack;
|
|||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
import static eu.midnightdust.lib.config.MidnightConfig.Entry;
|
|
||||||
|
|
||||||
public class AutoCommand {
|
public class AutoCommand {
|
||||||
final static String VALUE = "value";
|
final static String VALUE = "value";
|
||||||
final Field field;
|
final Field field;
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package eu.midnightdust.lib.util;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
|
||||||
|
//? if fabric {
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
//?}
|
||||||
|
//? if neoforge {
|
||||||
|
/*import eu.midnightdust.core.MidnightLib;
|
||||||
|
import net.neoforged.fml.ModList;
|
||||||
|
import net.neoforged.fml.loading.FMLEnvironment;
|
||||||
|
import net.neoforged.fml.loading.FMLPaths;
|
||||||
|
*///?}
|
||||||
|
|
||||||
|
public class PlatformFunctions {
|
||||||
|
//? if fabric {
|
||||||
|
public static String getPlatformName() {
|
||||||
|
return "fabric";
|
||||||
|
}
|
||||||
|
public static Path getConfigDirectory() {
|
||||||
|
return FabricLoader.getInstance().getConfigDir();
|
||||||
|
}
|
||||||
|
public static boolean isClientEnv() {
|
||||||
|
return FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT;
|
||||||
|
}
|
||||||
|
public static boolean isModLoaded(String modid) {
|
||||||
|
return FabricLoader.getInstance().isModLoaded(modid);
|
||||||
|
}
|
||||||
|
public static void registerCommand(LiteralArgumentBuilder<CommandSourceStack> command) {
|
||||||
|
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated, registrationEnvironment) -> dispatcher.register(command));
|
||||||
|
}
|
||||||
|
//?} else if neoforge {
|
||||||
|
/*public static String getPlatformName() {
|
||||||
|
return "neoforge";
|
||||||
|
}
|
||||||
|
public static Path getConfigDirectory() {
|
||||||
|
return FMLPaths.CONFIGDIR.get();
|
||||||
|
}
|
||||||
|
public static boolean isClientEnv() {
|
||||||
|
//? if >= 1.21.9 {
|
||||||
|
return FMLEnvironment.getDist().isClient();
|
||||||
|
//?} else {
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
*///?} else if forge {
|
||||||
|
//
|
||||||
|
//?}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ license = "MIT License"
|
|||||||
[[mods]]
|
[[mods]]
|
||||||
modId = "midnightlib"
|
modId = "midnightlib"
|
||||||
version = "${version}"
|
version = "${version}"
|
||||||
displayName = "MidnightLib"
|
displayName = "${name}"
|
||||||
logoFile = "midnightlib.png"
|
logoFile = "midnightlib.png"
|
||||||
authors = "TeamMidnightDust, Motschen"
|
authors = "TeamMidnightDust, Motschen"
|
||||||
description = '''
|
description = '''
|
||||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -8,7 +8,6 @@
|
|||||||
"midnightlib.modrinth":"Modrinth",
|
"midnightlib.modrinth":"Modrinth",
|
||||||
"midnightlib.curseforge":"CurseForge",
|
"midnightlib.curseforge":"CurseForge",
|
||||||
"midnightlib.wiki":"Wiki",
|
"midnightlib.wiki":"Wiki",
|
||||||
"modmenu.summaryTranslation.midnightlib": "Common Library for easy configuration.",
|
|
||||||
"midnightconfig.colorChooser.title": "Choose a color",
|
"midnightconfig.colorChooser.title": "Choose a color",
|
||||||
"midnightconfig.action.list_index": "Editing list at index %s",
|
"midnightconfig.action.list_index": "Editing list at index %s",
|
||||||
"midnightconfig.action.color_chooser": "Open color chooser",
|
"midnightconfig.action.color_chooser": "Open color chooser",
|
||||||
|
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 136 B |
|
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 136 B |
|
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 114 B |
@@ -1,13 +1,11 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "midnightlib",
|
"id": "${id}",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
|
"name": "${name}",
|
||||||
"name": "MidnightLib",
|
"description": "Lightweight config library with config screens and commands.",
|
||||||
"description": "Common Library for Team MidnightDust's mods.",
|
|
||||||
"authors": [
|
"authors": [
|
||||||
"Motschen",
|
"Motschen"
|
||||||
"TeamMidnightDust"
|
|
||||||
],
|
],
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"maloryware",
|
"maloryware",
|
||||||
@@ -25,13 +23,13 @@
|
|||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"server": [
|
"server": [
|
||||||
"eu.midnightdust.fabric.core.MidnightLibFabric"
|
"eu.midnightdust.core.MidnightLib"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"eu.midnightdust.fabric.core.MidnightLibFabric"
|
"eu.midnightdust.core.MidnightLib"
|
||||||
],
|
],
|
||||||
"modmenu": [
|
"modmenu": [
|
||||||
"eu.midnightdust.lib.config.AutoModMenu"
|
"eu.midnightdust.core.MidnightLib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
54
stonecutter.gradle.kts
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
plugins {
|
||||||
|
id("dev.kikugie.stonecutter")
|
||||||
|
id("dev.architectury.loom") version "1.11-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") + "\";"
|
||||||
|
swaps["minecraft"] = "\"" + node.metadata.version + "\";"
|
||||||
|
constants["release"] = property("mod.id") != "template"
|
||||||
|
dependencies["fapi"] = node.project.property("deps.fabric_version") as String
|
||||||
|
}
|
||||||
12
versions/1.20.1-fabric/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
mod.mc_dep_fabric==1.20.1
|
||||||
|
mod.mc_dep_forgelike=[1.20, 1.20.1]
|
||||||
|
mod.mc_title=1.20.1
|
||||||
|
mod.mc_targets=1.20.1
|
||||||
|
|
||||||
|
deps.forge_loader=47.3.0
|
||||||
|
deps.neoforge_loader=[UNSUPPORTED]
|
||||||
|
|
||||||
|
deps.fabric_version=0.92.3+1.20.1
|
||||||
|
deps.modmenu_version=7.2.2
|
||||||
|
|
||||||
|
loom.platform=fabric
|
||||||
13
versions/1.20.1-forge/gradle.properties
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
mod.mc_dep_fabric==1.20.1
|
||||||
|
mod.mc_dep_forgelike=[1.20, 1.20.1]
|
||||||
|
mod.mc_title=1.20.1
|
||||||
|
mod.mc_targets=1.20.1
|
||||||
|
|
||||||
|
deps.forge_loader=47.3.0
|
||||||
|
deps.neoforge_loader=[UNSUPPORTED]
|
||||||
|
|
||||||
|
deps.fabric_version=0.92.3+1.20.1
|
||||||
|
|
||||||
|
deps.modmenu_version=[UNSUPPORTED]
|
||||||
|
|
||||||
|
loom.platform=forge
|
||||||
13
versions/1.21.1-fabric/gradle.properties
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
mod.mc_dep_fabric=>=1.21 <=1.21.1
|
||||||
|
mod.mc_dep_forgelike=[1.21, 1.21.1]
|
||||||
|
mod.mc_title=1.21.1
|
||||||
|
mod.mc_targets=1.21 1.21.1
|
||||||
|
|
||||||
|
deps.forge_loader=0
|
||||||
|
deps.neoforge_loader=21.1.66
|
||||||
|
|
||||||
|
deps.fabric_version=0.114.0+1.21.1
|
||||||
|
|
||||||
|
deps.modmenu_version=11.0.3
|
||||||
|
|
||||||
|
loom.platform=fabric
|
||||||
13
versions/1.21.1-neoforge/gradle.properties
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
mod.mc_dep_fabric=>=1.21 <=1.21.1
|
||||||
|
mod.mc_dep_forgelike=[1.21, 1.21.1]
|
||||||
|
mod.mc_title=1.21.1
|
||||||
|
mod.mc_targets=1.21 1.21.1
|
||||||
|
|
||||||
|
deps.forge_loader=0
|
||||||
|
deps.neoforge_loader=21.1.66
|
||||||
|
|
||||||
|
deps.fabric_version=0.114.0+1.21.1
|
||||||
|
|
||||||
|
deps.modmenu_version=[UNSUPPORTED]
|
||||||
|
|
||||||
|
loom.platform=neoforge
|
||||||
12
versions/1.21.10-fabric/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
mod.mc_dep_fabric=>=1.21.9
|
||||||
|
mod.mc_dep_forgelike=[1.21.10,)
|
||||||
|
mod.mc_title=1.21.10
|
||||||
|
mod.mc_targets=1.21.9, 1.21.10
|
||||||
|
|
||||||
|
deps.forge_loader=0
|
||||||
|
deps.neoforge_loader=21.10.47-beta
|
||||||
|
|
||||||
|
deps.fabric_version=0.138.0+1.21.10
|
||||||
|
deps.modmenu_version=16.0.0-rc.1
|
||||||
|
|
||||||
|
loom.platform=fabric
|
||||||
12
versions/1.21.10-neoforge/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
mod.mc_dep_fabric=>=1.21.9
|
||||||
|
mod.mc_dep_forgelike=[1.21.10,)
|
||||||
|
mod.mc_title=1.21.10
|
||||||
|
mod.mc_targets=1.21.9, 1.21.10
|
||||||
|
|
||||||
|
deps.forge_loader=0
|
||||||
|
deps.neoforge_loader=21.10.47-beta
|
||||||
|
|
||||||
|
deps.fabric_version=0.138.0+1.21.10
|
||||||
|
deps.modmenu_version=16.0.0-rc.1
|
||||||
|
|
||||||
|
loom.platform=neoforge
|
||||||
12
versions/1.21.5-fabric/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
deps.forge_loader=54.0.13
|
||||||
|
deps.neoforge_loader=21.4.47-beta
|
||||||
|
|
||||||
|
deps.fabric_version=0.121.0+1.21.5
|
||||||
|
deps.modmenu_version=14.0.0-rc.1
|
||||||
|
|
||||||
|
loom.platform=fabric
|
||||||
12
versions/1.21.5-neoforge/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
deps.forge_loader=0
|
||||||
|
deps.neoforge_loader=21.5.54-beta
|
||||||
|
|
||||||
|
deps.fabric_version=0.121.0+1.21.5
|
||||||
|
deps.modmenu_version=[UNSUPPORTED]
|
||||||
|
|
||||||
|
loom.platform=neoforge
|
||||||
12
versions/1.21.8-fabric/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
mod.mc_dep_fabric==1.21.8
|
||||||
|
mod.mc_dep_forgelike=[1.21.8]
|
||||||
|
mod.mc_title=1.21.8
|
||||||
|
mod.mc_targets=1.21.8
|
||||||
|
|
||||||
|
deps.forge_loader=0
|
||||||
|
deps.neoforge_loader=21.8.50
|
||||||
|
|
||||||
|
deps.fabric_version=0.136.0+1.21.8
|
||||||
|
deps.modmenu_version=15.0.0
|
||||||
|
|
||||||
|
loom.platform=fabric
|
||||||
12
versions/1.21.8-neoforge/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
deps.forge_loader=0
|
||||||
|
deps.neoforge_loader=21.8.50
|
||||||
|
|
||||||
|
deps.fabric_version=0.136.0+1.21.8
|
||||||
|
deps.modmenu_version=[UNSUPPORTED]
|
||||||
|
|
||||||
|
loom.platform=neoforge
|
||||||