mirror of
https://github.com/TeamMidnightDust/MidnightLib.git
synced 2025-12-15 17:05:09 +01:00
Merge 0d2c952a54 into 9602736335
This commit is contained in:
@@ -3,7 +3,7 @@ import groovy.json.JsonOutput
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
|
id "dev.architectury.loom" version "1.10.+" apply false
|
||||||
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
common(rootProject.enabled_platforms.split(","))
|
common(rootProject.enabled_platforms.split(","))
|
||||||
}
|
}
|
||||||
@@ -21,3 +25,16 @@ publishing {
|
|||||||
// Add repositories to publish to here.
|
// Add repositories to publish to here.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
testOutput.extendsFrom(testImplementation)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('testJar', Jar) {
|
||||||
|
from sourceSets.test.output
|
||||||
|
archiveClassifier = 'tests'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
testOutput testJar
|
||||||
|
}
|
||||||
@@ -132,7 +132,7 @@ public abstract class MidnightConfig {
|
|||||||
entries.values().forEach(info -> {
|
entries.values().forEach(info -> {
|
||||||
if (info.field != null && info.entry != null) {
|
if (info.field != null && info.entry != null) {
|
||||||
try {
|
try {
|
||||||
info.value = info.field.get(null);
|
info.value = info.field.get(null) == null ? info.defaultValue : info.field.get(null);
|
||||||
info.tempValue = info.toTemporaryValue();
|
info.tempValue = info.toTemporaryValue();
|
||||||
info.updateConditions();
|
info.updateConditions();
|
||||||
} catch (IllegalAccessException ignored) {}
|
} catch (IllegalAccessException ignored) {}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package eu.midnightdust.lib.util;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
|
|
||||||
public class MidnightColorUtil {
|
|
||||||
/**
|
|
||||||
* @param colorStr e.g. "FFFFFF" or "#FFFFFF"
|
|
||||||
* @return Color as RGB
|
|
||||||
*/
|
|
||||||
public static Color hex2Rgb(String colorStr) {
|
|
||||||
try { return Color.decode("#" + colorStr.replace("#", ""));
|
|
||||||
} catch (Exception ignored) { return Color.BLACK; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package eu.midnightdust.fabric.example;
|
package eu.midnightdust.test;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import eu.midnightdust.lib.config.MidnightConfig;
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package eu.midnightdust.fabric.example.config;
|
package eu.midnightdust.test.config;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import eu.midnightdust.fabric.example.MidnightLibExtras;
|
import eu.midnightdust.test.MidnightLibExtras;
|
||||||
import eu.midnightdust.lib.config.MidnightConfig;
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
import net.minecraft.text.MutableText;
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
@@ -11,7 +11,27 @@ architectury {
|
|||||||
fabric()
|
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 {
|
loom {
|
||||||
|
runs {
|
||||||
|
testClient {
|
||||||
|
client()
|
||||||
|
configName = "Test Minecraft Client"
|
||||||
|
source sourceSets.test
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -27,10 +47,12 @@ configurations {
|
|||||||
dependencies {
|
dependencies {
|
||||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||||
modCompileOnly ("com.terraformersmc:modmenu:${rootProject.mod_menu_version}")
|
modCompileOnly("com.terraformersmc:modmenu:${rootProject.mod_menu_version}")
|
||||||
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||||
|
|
||||||
|
testImplementation common(project(path: ':common', configuration: 'testOutput'))
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
@@ -41,6 +63,14 @@ processResources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processTestResources {
|
||||||
|
inputs.property "version", rootProject.version
|
||||||
|
|
||||||
|
filesMatching("fabric.mod.json") {
|
||||||
|
expand "version": rootProject.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
exclude "architectury.common.json"
|
exclude "architectury.common.json"
|
||||||
|
|
||||||
@@ -71,7 +101,7 @@ unifiedPublishing {
|
|||||||
releaseType = "$project.release_type"
|
releaseType = "$project.release_type"
|
||||||
changelog = releaseChangelog()
|
changelog = releaseChangelog()
|
||||||
gameVersions = []
|
gameVersions = []
|
||||||
gameLoaders = ["fabric","quilt"]
|
gameLoaders = ["fabric", "quilt"]
|
||||||
mainPublication remapJar
|
mainPublication remapJar
|
||||||
relations {
|
relations {
|
||||||
depends {
|
depends {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
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,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "midnightlib-example",
|
"id": "modid",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
|
|
||||||
"name": "MidnightLib Example",
|
"name": "MidnightLib Test Mod",
|
||||||
"description": "Wow, you can do so much.",
|
"description": "Example Mod for Team MidnightDust's mods.",
|
||||||
"authors": [ "MidnightDust" ],
|
"authors": [ "MidnightDust" ],
|
||||||
|
|
||||||
"license": "CC0",
|
"license": "CC0",
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"main": [
|
||||||
"eu.midnightdust.fabric.example.MLExampleFabric"
|
"eu.midnightdust.test.fabric.MLExampleFabric"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
@@ -6,7 +6,7 @@ yarn_mappings=1.21.6+build.1
|
|||||||
enabled_platforms=fabric,neoforge
|
enabled_platforms=fabric,neoforge
|
||||||
|
|
||||||
archives_base_name=midnightlib
|
archives_base_name=midnightlib
|
||||||
mod_version=1.7.5
|
mod_version=1.7.6-rc.1
|
||||||
maven_group=eu.midnightdust
|
maven_group=eu.midnightdust
|
||||||
release_type=release
|
release_type=release
|
||||||
curseforge_id=488090
|
curseforge_id=488090
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
distributionUrl=https://mirrors.aliyun.com/gradle/distributions/v8.14.3/gradle-8.14.3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -13,11 +13,44 @@ repositories {
|
|||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
platformSetupLoomIde()
|
platformSetupLoomIde()
|
||||||
neoForge()
|
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 {
|
loom {
|
||||||
accessWidenerPath = project(":common").loom.accessWidenerPath
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -44,6 +77,10 @@ dependencies {
|
|||||||
|
|
||||||
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||||
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
|
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 {
|
processResources {
|
||||||
@@ -54,6 +91,14 @@ processResources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processTestResources {
|
||||||
|
inputs.property 'version', rootProject.version
|
||||||
|
|
||||||
|
filesMatching('META-INF/neoforge.mods.toml') {
|
||||||
|
expand version: rootProject.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
configurations = [project.configurations.shadowBundle]
|
configurations = [project.configurations.shadowBundle]
|
||||||
archiveClassifier = 'dev-shadow'
|
archiveClassifier = 'dev-shadow'
|
||||||
@@ -105,4 +150,4 @@ unifiedPublishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
34
neoforge/src/test/resources/META-INF/neoforge.mods.toml
Normal file
34
neoforge/src/test/resources/META-INF/neoforge.mods.toml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
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"
|
||||||
@@ -9,9 +9,7 @@ pluginManagement {
|
|||||||
|
|
||||||
include("common")
|
include("common")
|
||||||
include("fabric")
|
include("fabric")
|
||||||
include("test-fabric")
|
|
||||||
include("neoforge")
|
include("neoforge")
|
||||||
include("test-neoforge")
|
|
||||||
//include("quilt")
|
//include("quilt")
|
||||||
|
|
||||||
rootProject.name = "midnightlib"
|
rootProject.name = "midnightlib"
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.github.johnrengelman.shadow'
|
|
||||||
id "me.shedaniel.unified-publishing"
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
maven { url "https://maven.terraformersmc.com/releases" }
|
|
||||||
}
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
platformSetupLoomIde()
|
|
||||||
fabric()
|
|
||||||
}
|
|
||||||
|
|
||||||
loom {
|
|
||||||
}
|
|
||||||
|
|
||||||
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 + "-fabric"
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
|
||||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
|
||||||
|
|
||||||
implementation project(path: ":fabric", configuration: "namedElements")
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package eu.midnightdust.fabric.example;
|
|
||||||
|
|
||||||
import eu.midnightdust.fabric.example.config.MidnightConfigExample;
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
|
||||||
|
|
||||||
public class MLExampleFabric implements ModInitializer {
|
|
||||||
@Override
|
|
||||||
public void onInitialize() {
|
|
||||||
MidnightConfigExample.init("modid", MidnightConfigExample.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user