Skip to content

Commit 24d9183

Browse files
committed
Port to Minecraft 1.21
1 parent 758229b commit 24d9183

File tree

24 files changed

+568
-479
lines changed

24 files changed

+568
-479
lines changed

.github/workflows/test-build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ jobs:
55
name: Java ${{ matrix.java }} test build (on ${{ matrix.os }})
66
strategy:
77
matrix:
8-
os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, windows-2016, windows-2019, macos-10.15 ]
9-
java: [ 16 ]
8+
os: [ ubuntu-latest, windows-latest, macos-latest ]
9+
java: [ 21 ]
1010
runs-on: ${{ matrix.os }}
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
- name: Setup java
14-
uses: actions/setup-java@v1
14+
uses: actions/setup-java@v4
1515
with:
16+
distribution: 'adopt'
1617
java-version: ${{ matrix.java }}
1718
- name: Build mod
1819
run: gradle build

build.gradle

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,80 @@
11
plugins {
2-
id 'fabric-loom' version '0.10.3'
2+
id 'fabric-loom' version '1.10-SNAPSHOT'
33
id 'maven-publish'
44
}
55

6-
sourceCompatibility = JavaVersion.VERSION_16
7-
targetCompatibility = JavaVersion.VERSION_16
8-
9-
archivesBaseName = project.archives_base_name
106
version = project.mod_version
117
group = project.maven_group
128

13-
repositories {
14-
// Add repositories to retrieve artifacts from in here.
15-
// You should only use this when depending on other mods because
16-
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
17-
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
18-
// for more information about repositories.
9+
base {
10+
archivesName = project.archives_base_name
11+
}
12+
13+
loom {
14+
splitEnvironmentSourceSets()
15+
16+
mods {
17+
"fidelity" {
18+
sourceSet sourceSets.main
19+
sourceSet sourceSets.client
20+
}
21+
}
22+
23+
}
24+
25+
sourceSets {
26+
main {
27+
java.srcDirs = ['src/main/java']
28+
resources.srcDirs = ['src/main/resources']
29+
}
30+
client {
31+
java.srcDirs = ['src/client/java']
32+
resources.srcDirs = ['src/client/resources']
33+
}
1934
}
2035

2136
dependencies {
22-
// To change the versions see the gradle.properties file
2337
minecraft "com.mojang:minecraft:${project.minecraft_version}"
2438
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
2539
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
2640

27-
// Fabric API. This is technically optional, but you probably want it anyway.
2841
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
2942

30-
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
31-
// You may need to force-disable transitiveness on them.
3243
}
3344

3445
processResources {
3546
inputs.property "version", project.version
3647

3748
filesMatching("fabric.mod.json") {
38-
expand "version": project.version
49+
expand "version": inputs.properties.version
3950
}
4051
}
4152

4253
tasks.withType(JavaCompile).configureEach {
43-
// ensure that the encoding is set to UTF-8, no matter what the system default is
44-
// this fixes some edge cases with special characters not displaying correctly
45-
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
46-
// If Javadoc is generated, this must be specified in that task too.
47-
it.options.encoding = "UTF-8"
48-
49-
// Minecraft 1.17 (21w19a) upwards uses Java 16.
50-
it.options.release = 16
54+
it.options.release = 17
5155
}
5256

5357
java {
54-
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
55-
// if it is present.
56-
// If you remove this line, sources will not be generated.
5758
withSourcesJar()
59+
60+
sourceCompatibility = JavaVersion.VERSION_17
61+
targetCompatibility = JavaVersion.VERSION_17
5862
}
5963

6064
jar {
65+
inputs.property "archivesName", project.base.archivesName
66+
6167
from("LICENSE") {
62-
rename { "${it}_${project.archivesBaseName}"}
68+
rename { "${it}_${inputs.properties.archivesName}"}
6369
}
6470
}
6571

6672
// configure the maven publication
6773
publishing {
6874
publications {
69-
mavenJava(MavenPublication) {
70-
// add all the jars that should be included when publishing to maven
71-
artifact(remapJar) {
72-
builtBy remapJar
73-
}
74-
artifact(sourcesJar) {
75-
builtBy remapSourcesJar
76-
}
75+
create("mavenJava", MavenPublication) {
76+
artifactId = project.archives_base_name
77+
from components.java
7778
}
7879
}
79-
80-
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
81-
repositories {
82-
// Add repositories to publish to here.
83-
// Notice: This block does NOT have the same function as the block in the top level.
84-
// The repositories here will be used for publishing your artifact, not for
85-
// retrieving dependencies.
86-
}
8780
}

gradle.properties

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# Done to increase the memory available to gradle.
2-
org.gradle.jvmargs=-Xmx1G
2+
org.gradle.jvmargs=-Xmx2G
3+
org.gradle.parallel=true
34

45
# Fabric Properties
5-
# check these on https://fabricmc.net/versions.html
6-
minecraft_version=1.17.1
7-
yarn_mappings=1.17.1+build.59
8-
loader_version=0.11.6
6+
# check these on https://modmuss50.me/fabric.html
7+
minecraft_version=1.21.5
8+
yarn_mappings=1.21.5+build.1
9+
loader_version=0.16.14
910

1011
# Mod Properties
11-
mod_version = 1.0.0
12-
maven_group = org.scbrm
13-
archives_base_name = fidelity-mod
12+
mod_version=1.0.1
13+
maven_group=org.scbrm
14+
archives_base_name=fidelity-mod
1415

1516
# Dependencies
16-
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
17-
fabric_version=0.40.1+1.17
17+
# check this on https://modmuss50.me/fabric.html
18+
fabric_version=0.123.2+1.21.5

gradle/wrapper/gradle-wrapper.jar

-14.8 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)