summary refs log tree commit diff stats
path: root/build.gradle
diff options
context:
space:
mode:
authormodmuss50 <modmuss50@gmail.com>2021-05-12 20:41:38 +0100
committermodmuss50 <modmuss50@gmail.com>2021-05-12 20:41:38 +0100
commit50f0be767c69f3ac49c3a2c4c8669354a39fd9b3 (patch)
treebdc742db4382ca89f9c87ba6d6854c5fe0157f80 /build.gradle
parent29c522536fc16233833221e22eed3f106c0726bc (diff)
Update to 21w19a and Java 16
This commit can be used as an example on how to update your mod to Java 16. You will need to ensure you have Java 16 installed and set as the active version to run this.

Gradle 7 is required along with loom 0.8
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle15
1 files changed, 5 insertions, 10 deletions
diff --git a/build.gradle b/build.gradle
index a4b5de7..f807b77 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,10 @@
 plugins {
-	id 'fabric-loom' version '0.6-SNAPSHOT'
+	id 'fabric-loom' version '0.8-SNAPSHOT'
 	id 'maven-publish'
 }
 
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
+sourceCompatibility = JavaVersion.VERSION_16
+targetCompatibility = JavaVersion.VERSION_16
 
 archivesBaseName = project.archives_base_name
 version = project.mod_version
@@ -46,13 +46,8 @@ tasks.withType(JavaCompile).configureEach {
 	// If Javadoc is generated, this must be specified in that task too.
 	it.options.encoding = "UTF-8"
 
-	// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
-	// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
-	// We'll use that if it's available, but otherwise we'll use the older option.
-	def targetVersion = 8
-	if (JavaVersion.current().isJava9Compatible()) {
-		 it.options.release = targetVersion
-	}
+	// Minecraft 1.17 (21w19a) upwards uses Java 16.
+	it.options.release = 16
 }
 
 java {