Skip to content

Commit

Permalink
proper mixin compatibilityLevel, and some constants collecting
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Aug 18, 2023
1 parent 0e92b8b commit bf4c5ea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
29 changes: 18 additions & 11 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ dependencies {
// include(modImplementation(fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version)))
}

String MIXIN_CONFIG_PATH = 'template_mod.mixins.json'
String LANG_DIR = 'assets/template_mod/lang'
JavaVersion JAVA_COMPATIBILITY
if (mcVersion >= 11800) {
JAVA_COMPATIBILITY = JavaVersion.VERSION_17
} else if (mcVersion >= 11700) {
JAVA_COMPATIBILITY = JavaVersion.VERSION_16
} else {
JAVA_COMPATIBILITY = JavaVersion.VERSION_1_8
}

loom {
runConfigs.all {
// to make sure it generates all "Minecraft Client (:subproject_name)" applications
Expand All @@ -53,16 +64,8 @@ remapJar {
remapperIsolation = true
}

if (mcVersion >= 11800) {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
} else if (mcVersion >= 11700) {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
} else {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
sourceCompatibility = JAVA_COMPATIBILITY
targetCompatibility = JAVA_COMPATIBILITY

String versionSuffix = ''
// detect github action environment variables
Expand Down Expand Up @@ -94,12 +97,16 @@ processResources {
]
expand valueMap
}

filesMatching(MIXIN_CONFIG_PATH) {
expand "compatibility_level": "JAVA_${JAVA_COMPATIBILITY.ordinal() + 1}"
}
}

// https://github.com/Fallen-Breath/yamlang
yamlang {
targetSourceSets = [sourceSets.main]
inputDir = 'assets/template_mod/lang'
inputDir = LANG_DIR
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/template_mod.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "me.fallenbreath.template_mod.mixins",
"compatibilityLevel": "JAVA_8",
"compatibilityLevel": "${compatibility_level}",
"mixins": [
"MinecraftServerMixin"
],
Expand Down

0 comments on commit bf4c5ea

Please sign in to comment.