From 62646f367226606c9f5c8e2aad1b9d0831638a41 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Mon, 29 Nov 2021 01:44:54 +0800 Subject: [PATCH] Fix Java version for forge only template --- generator.config.json | 6 ++++++ templates/forge/build.gradle | 9 +++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/generator.config.json b/generator.config.json index 088c9a2..b0d4926 100644 --- a/generator.config.json +++ b/generator.config.json @@ -4,6 +4,8 @@ "COMPILE_JAVA_16": " options.release = 16", "COMPILE_JAVA_8_ARCH": "\n // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too\n // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.\n // We'll use that if it's available, but otherwise we'll use the older option.\n def targetVersion = 8\n if (JavaVersion.current().isJava9Compatible()) {\n options.release = targetVersion\n }", "COMPILE_JAVA_16_ARCH": " options.release = 16", + "JAVA_8": "VERSION_8", + "JAVA_16": "VERSION_16", "FABRIC_LOADER": { "filter": ".*", "pom": "https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml" @@ -17,6 +19,7 @@ ], "tokens": { "MINECRAFT": "1.16.5", + "JAVA_VERSION": "#JAVA_8", "COMPILE_JAVA": "#COMPILE_JAVA_8", "MCMETA_FORMAT": "6", "JEI_MAJOR": "7", @@ -39,6 +42,7 @@ ], "tokens": { "MINECRAFT": "1.16.5", + "JAVA_VERSION": "#JAVA_8", "COMPILE_JAVA": "#COMPILE_JAVA_8_ARCH", "FABRIC_LOADER": "#FABRIC_LOADER", "LOOM_FORGE_EXT": "", @@ -84,6 +88,7 @@ ], "tokens": { "MINECRAFT": "1.17.1", + "JAVA_VERSION": "#JAVA_16", "COMPILE_JAVA": "#COMPILE_JAVA_16", "MCMETA_FORMAT": "7", "JEI_MAJOR": "8", @@ -106,6 +111,7 @@ ], "tokens": { "MINECRAFT": "1.17.1", + "JAVA_VERSION": "#JAVA_16", "COMPILE_JAVA": "#COMPILE_JAVA_16_ARCH", "FABRIC_LOADER": "#FABRIC_LOADER", "LOOM_FORGE_EXT": "", diff --git a/templates/forge/build.gradle b/templates/forge/build.gradle index f25dddd..cfe5a70 100644 --- a/templates/forge/build.gradle +++ b/templates/forge/build.gradle @@ -1,12 +1,9 @@ plugins { - id 'dev.architectury.loom' version '0.10.0-SNAPSHOT' - id 'maven-publish' + id "dev.architectury.loom" version "0.10.0-SNAPSHOT" + id "maven-publish" } -// when using loom 0.10.0 with minecraft 1.16, -// be sure to set this (and other references to Java 16) -// to Java 8, obviously -sourceCompatibility = targetCompatibility = JavaVersion.VERSION_16 +sourceCompatibility = targetCompatibility = JavaVersion.@JAVA_VERSION@ archivesBaseName = project.archives_base_name version = project.mod_version