6 Commits

Author SHA1 Message Date
liach
fd92928700 Slurp mod version from json to avoid issues in IDE
See FabricMC/fabric-loader#457

Signed-off-by: liach <liach@users.noreply.github.com>
2021-06-24 11:00:17 -05:00
jackassmc
b662ed74bf Update Fabric versions link (#111) 2021-06-23 15:31:54 +01:00
Qwinci
28e2282fc9 Update gradle.properties (#110) 2021-06-23 15:31:42 +01:00
modmuss50
fda2a1cf1e 1.17 stable 2021-06-08 16:55:16 +01:00
modmuss50
b51afe9fc0 1.17-pre1 2021-05-27 22:13:12 +01:00
modmuss50
50f0be767c 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
2021-05-12 20:41:38 +01:00
6 changed files with 118 additions and 127 deletions

View File

@@ -12,9 +12,7 @@ jobs:
matrix: matrix:
# Use these Java versions # Use these Java versions
java: [ java: [
8.0, # Minimum supported by Minecraft 16 # Minimum supported by Minecraft
11, # Current Java LTS
16 # Latest version
] ]
# and run on both Linux and Windows # and run on both Linux and Windows
os: [ubuntu-20.04, windows-latest] os: [ubuntu-20.04, windows-latest]
@@ -25,9 +23,8 @@ jobs:
- name: validate gradle wrapper - name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1 uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }} - name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v2 uses: actions/setup-java@v1
with: with:
distribution: adopt
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
- name: make gradle wrapper executable - name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }} if: ${{ runner.os != 'Windows' }}
@@ -35,7 +32,7 @@ jobs:
- name: build - name: build
run: ./gradlew build run: ./gradlew build
- name: capture build artifacts - name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS if: ${{ runner.os == 'Linux' && matrix.java == '16' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: Artifacts name: Artifacts

View File

@@ -1,15 +1,25 @@
plugins { plugins {
id 'fabric-loom' version '0.7-SNAPSHOT' id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_16
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group group = project.maven_group
// Obtains mod version. change file reference if your fabric.mod.json is located elsewhere
import groovy.json.JsonSlurper
version = new JsonSlurper().parse(file('src/main/resources/fabric.mod.json')).version
// You can use logger.lifecycle to print out messages like System.out; double-quote strings convert
// ${statement} templates to statement values, such as method calls, while single-quote strings don't.
// getXxx() calls can be simplified to xxx, like project.getGradle().getGradleVersion() is project.gradle.gradleVersion.
// Since the buildscript is provided with a project, you can call project methods without qualification if there is no
// ambiguity, such as file() call to retrieve version is project.file(), and gradle is project.getGradle()
logger.lifecycle "Setting up ${archivesBaseName} ${version} with Gradle ${gradle.gradleVersion}"
repositories { repositories {
// Add repositories to retrieve artifacts from in here. // Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because // You should only use this when depending on other mods because
@@ -26,17 +36,6 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway. // Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
@@ -46,13 +45,8 @@ tasks.withType(JavaCompile).configureEach {
// If Javadoc is generated, this must be specified in that task too. // If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8" it.options.encoding = "UTF-8"
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too // Minecraft 1.17 (21w19a) upwards uses Java 16.
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. it.options.release = 16
// 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
}
} }
java { java {

View File

@@ -3,15 +3,14 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/versions.html # check these on https://fabricmc.net/versions.html
minecraft_version=1.16.5 minecraft_version=1.17
yarn_mappings=1.16.5+build.9 yarn_mappings=1.17+build.13
loader_version=0.11.3 loader_version=0.11.6
# Mod Properties # Mod Properties
mod_version = 1.0.0 # edit your mod version in fabric.mod.json
maven_group = com.example maven_group = com.example
archives_base_name = fabric-example-mod archives_base_name = fabric-example-mod
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api (or https://fabricmc.net/versions.html) fabric_version=0.36.0+1.17
fabric_version=0.34.2+1.16

View File

@@ -1,7 +1,7 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "modid", "id": "modid",
"version": "${version}", "version": "1.0.0",
"name": "Example Mod", "name": "Example Mod",
"description": "This is an example description! Tell everyone what your mod is about!", "description": "This is an example description! Tell everyone what your mod is about!",
@@ -27,9 +27,10 @@
], ],
"depends": { "depends": {
"fabricloader": ">=0.7.4", "fabricloader": ">=0.11.3",
"fabric": "*", "fabric": "*",
"minecraft": "1.16.x" "minecraft": "1.17.x",
"java": ">=16"
}, },
"suggests": { "suggests": {
"another-mod": "*" "another-mod": "*"

View File

@@ -2,7 +2,7 @@
"required": true, "required": true,
"minVersion": "0.8", "minVersion": "0.8",
"package": "net.fabricmc.example.mixin", "package": "net.fabricmc.example.mixin",
"compatibilityLevel": "JAVA_8", "compatibilityLevel": "JAVA_16",
"mixins": [ "mixins": [
], ],
"client": [ "client": [