Skip to content

Commit

Permalink
Add support for mc1.21.4 (#136)
Browse files Browse the repository at this point in the history
* Add support for mc1.21.2 and up
* update expanded storage version
  • Loading branch information
ChristopherHaws authored Feb 15, 2025
1 parent 87f7685 commit ed2bfe9
Show file tree
Hide file tree
Showing 36 changed files with 1,548 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
minecraft_version: [1.20.1, 1.20.4, 1.21.0]
minecraft_version: [1.20.1, 1.20.4, 1.21.0, 1.21.2]
env:
project_name: fabric-${{ matrix.minecraft_version }}
artifact_dir: modules/fabric-${{ matrix.minecraft_version }}/build/libs
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
run: ./gradlew :${{ env.project_name }}:build --no-daemon

- name: capture build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.minecraft_version }}
path: ${{ env.artifact_dir }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
minecraft_version: [1.20.1, 1.20.4, 1.21.0]
minecraft_version: [1.20.1, 1.20.4, 1.21.0, 1.21.2]
env:
project_name: fabric-${{ matrix.minecraft_version }}
artifact_dir: modules/fabric-${{ matrix.minecraft_version }}/build/libs
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
MOD_VERSION: ${{ steps.version.outputs.release }}

- name: capture build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.minecraft_version }}
path: ${{ env.artifact_dir }}
Expand Down
33 changes: 1 addition & 32 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,8 @@
// Disable the java formatter because we are using prettier
"java.format.enabled": false,
"java.maxConcurrentBuilds": 4,
"java.project.sourcePaths": ["modules/fabric-1.20.4/src", "modules/fabric-1.21.0/src"],
"java.project.sourcePaths": ["modules/fabric-1.20.1/src", "modules/fabric-1.20.4/src", "modules/fabric-1.21.0/src", "modules/fabric-1.21.2/src"],
"java.configuration.detectJdksAtStart": true,
"java.gradle.buildServer.enabled": "on",
"java.references.includeDecompiledSources": true,
"todo-tree.highlights.defaultHighlight": {
"background": "#000000",
"fontWeight": "900",
"opacity": 0
},
"todohighlight.defaultStyle": {
"backgroundColor": "editor.background"
},
// https://code.visualstudio.com/api/references/theme-color
"todohighlight.keywords": [
{
"backgroundColor": "editor.background",
"color": "yellow",
"text": "TODO:"
},
{
"backgroundColor": "editor.background",
"color": "orange",
"text": "FIXME:"
},
{
"backgroundColor": "editor.background",
"color": "red",
"text": "HACK:"
},
{
"backgroundColor": "editor.background",
"color": "#00FF00",
"text": "HINT:"
}
]
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
// https://fabricmc.net/wiki/documentation:fabric_loom
id 'fabric-loom' version '1.7-SNAPSHOT' apply false
id 'fabric-loom' version '1.9-SNAPSHOT' apply false
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion modules/fabric-1.20.1/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ auth_me_version = 7.0.2+1.20
expanded_storage_version = 10.3.0-beta.5+fabric

# Unit Testing: https://mvnrepository.com/artifact/org.junit/junit-bom
junit_bom_version = 5.11.0-M2
junit_bom_version = 5.11.4
2 changes: 1 addition & 1 deletion modules/fabric-1.20.4/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ auth_me_version = 8.0.0+1.20.4
expanded_storage_version = 12.1.0-beta.4+fabric

# Unit Testing: https://mvnrepository.com/artifact/org.junit/junit-bom
junit_bom_version = 5.11.0-M2
junit_bom_version = 5.11.4
28 changes: 14 additions & 14 deletions modules/fabric-1.21.0/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Fabric Properties: https://fabricmc.net/develop
minecraft_version=1.21
yarn_mappings=1.21+build.7
loader_version=0.15.11
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.10

#Fabric api
fabric_version=0.100.4+1.21
# Fabric API
fabric_version=0.115.0+1.21.1

# Shedaniel API's: https://linkie.shedaniel.me/dependencies
modmenu_version = 11.0.1
cloth_config_version = 15.0.127
modmenu_version = 11.0.3
cloth_config_version = 15.0.140

# Local dev mod versions
rei_version = 16.0.729
rei_version = 16.0.797
// lazydfu_version = 0.1.3
lithium_version = mc1.21-0.12.7
sodium_version = mc1.21-0.5.11
architectury_api_version = 13.0.3+fabric
auth_me_version = 8.0.0+1.21
expanded_storage_version = 14.0.0+fabric
lithium_version = mc1.21.1-0.14.7-fabric
sodium_version = mc1.21.1-0.6.7-fabric
architectury_api_version = 13.0.8+fabric
auth_me_version = v9.0.1+1.21.1
expanded_storage_version = 3a5207ab384845f8aa0ead7776bff68c

# Unit Testing: https://mvnrepository.com/artifact/org.junit/junit-bom
junit_bom_version = 5.11.0-M2
junit_bom_version = 5.11.4
135 changes: 135 additions & 0 deletions modules/fabric-1.21.2/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
plugins {
id 'fabric-loom'
id 'maven-publish'
id 'idea'
}

String buildNumber = System.getenv("GITHUB_RUN_NUMBER")
Boolean appendBuildNumber = System.getenv("APPEND_BUILD_NUMBER") == "true" && buildNumber != null
String modVersion = System.getenv("MOD_VERSION") ?: "0.0.1"

version = modVersion +
(appendBuildNumber ? "-build${buildNumber}" : "") +
"+${project.minecraft_version}"

base {
archivesName = "${project.mod_slug}-fabric"
}

loom {
splitEnvironmentSourceSets()

mods {
"textutilities" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}

// https://github.com/SpongePowered/Mixin/wiki/Mixin-Java-System-Properties
def applyCommonRunConfig = { run ->
// run.runDir = "run/${project.minecraft_version}/${run.name}"
// run.vmArg('-XX:+ShowCodeDetailsInExceptionMessages')
run.property("mixin.debug.export", "true")
run.property("mixin.debug.export.decompile", "true")
run.property("mixin.dumpTargetOnFailure", "true")
run.property("mixin.debug.verify", "true")
run.property("mixin.debug.verbose", "true")
run.property("mixin.env.remapRefMap", "true")
run.property("mixin.checks", "true")
run.property("mixin.hotSwap", "true")
}

runs {
client {
runDir = "run/${project.minecraft_version}/client"
vmArg "-XX:+ShowCodeDetailsInExceptionMessages"
applyCommonRunConfig(client)
}
server {
runDir = "run/${project.minecraft_version}/server"
vmArg "-XX:+ShowCodeDetailsInExceptionMessages"
applyCommonRunConfig(server)
}
}
}

sourceSets {
test {
compileClasspath += sourceSets.client.compileClasspath
runtimeClasspath += sourceSets.client.runtimeClasspath
}
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

// ====== Mod Compatibility (optional dependencies) ======
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"

// ======= Unit Tests ======
testImplementation(platform("org.junit:junit-bom:${project.junit_bom_version}"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation(sourceSets.client.output)

// ====== Mods that are useful for local development ======
// modLocalRuntime("maven.modrinth:lazydfu:${project.lazydfu_version}")
modLocalRuntime("maven.modrinth:lithium:${project.lithium_version}")
modLocalRuntime("maven.modrinth:sodium:${project.sodium_version}")
// modLocalRuntime("maven.modrinth:starlight:${project.starlight_version}")
modLocalRuntime("maven.modrinth:architectury-api:${project.architectury_api_version}")
modLocalRuntime("maven.modrinth:auth-me:${project.auth_me_version}")
modLocalRuntime("maven.modrinth:expanded-storage:${project.expanded_storage_version}")
}

processResources {
Map<String, Object> properties = new HashMap<>()
properties.put("version", project.version)
properties.put("mod_id", project.mod_id)
properties.put("mod_name", project.mod_name)
properties.put("mod_slug", project.mod_slug)
properties.put("mod_author", project.mod_author)
properties.put("loader_version", project.loader_version)
properties.put("fabric_version", project.fabric_version)
properties.put("minecraft_version", project.minecraft_version)
// properties.put("java_version", sourceCompatibility)

properties.each { k, v -> inputs.property(k, v) }

filesMatching("fabric.mod.json") {
expand properties
}
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.21 upwards uses Java 21.
it.options.release = 21
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
23 changes: 23 additions & 0 deletions modules/fabric-1.21.2/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Fabric Properties: https://fabricmc.net/develop
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.8
loader_version=0.16.10

# Fabric API
fabric_version=0.117.0+1.21.4

# Shedaniel API's: https://linkie.shedaniel.me/dependencies
modmenu_version = 13.0.2
cloth_config_version = 17.0.144

# Local dev mod versions
rei_version = 18.0.796+fabric
// lazydfu_version = 0.1.3
lithium_version = mc1.21.4-0.14.7-fabric
sodium_version = mc1.21.4-0.6.7-fabric
architectury_api_version = 15.0.1+fabric
auth_me_version = v9.0.1+1.21.4
expanded_storage_version = eed6ef0400f1dabb19acbf56edc9aa99

# Unit Testing: https://mvnrepository.com/artifact/org.junit/junit-bom
junit_bom_version = 5.11.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.chaws.textutilities.client;

import io.chaws.textutilities.client.handlers.FormatButtonsHandler;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

@Environment(EnvType.CLIENT)
public class TextUtilitiesClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
FormatButtonsHandler.initialize();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.chaws.textutilities.client.config;

import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import io.chaws.textutilities.config.TextUtilitiesConfig;
import me.shedaniel.autoconfig.AutoConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

@Environment(EnvType.CLIENT)
public class ModMenuIntegration implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> AutoConfig.getConfigScreen(TextUtilitiesConfig.class, parent).get();
}
}
Loading

0 comments on commit ed2bfe9

Please sign in to comment.