支持Minecraft 26.1
This commit is contained in:
TheWhiteDog9487
2026-03-26 10:13:37 +08:00
parent 8b03098280
commit 4137a166ae
6 changed files with 25 additions and 28 deletions

View File

@@ -12,7 +12,7 @@ jobs:
matrix:
# Use these Java versions
java: [
21, # Current Java LTS
25, # Current Java LTS
]
runs-on: ubuntu-22.04
steps:

View File

@@ -1,5 +1,5 @@
plugins {
id("fabric-loom") version "1.15-SNAPSHOT"
id("net.fabricmc.fabric-loom") version "1.15-SNAPSHOT"
id("maven-publish")
}
@@ -34,18 +34,17 @@ loom {
dependencies {
// To change the versions see the gradle.properties file
minecraft("com.mojang:minecraft:${project.extra["minecraft_version"]}")
mappings(loom.officialMojangMappings())
modImplementation("net.fabricmc:fabric-loader:${project.extra["loader_version"]}")
implementation("net.fabricmc:fabric-loader:${project.extra["loader_version"]}")
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.extra["fabric_version"]}")
implementation("net.fabricmc.fabric-api:fabric-api:${project.extra["fabric_api_version"]}")
// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
// "modImplementation"("net.fabricmc.fabric-api:fabric-api-deprecated:${project.extra["fabric_version"]}")
// ↓ 开发测试用
modRuntimeOnly("com.terraformersmc:modmenu:${project.extra["modmenu_version"]}")
runtimeOnly("com.terraformersmc:modmenu:${project.extra["modmenu_version"]}")
}
tasks.processResources {
@@ -57,7 +56,7 @@ tasks.processResources {
}
tasks.withType<JavaCompile> {
options.release.set(21)
options.release.set(25)
}
java {
@@ -66,21 +65,18 @@ java {
// If you remove this line, sources will not be generated.
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
}
tasks.jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}" } }
}
tasks.remapJar{
// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveFileName
// 用这个属性设置jar包的文件名格式
// 别用上面那个Jar任务的配置会被remapJar覆盖掉
archiveFileName = "${project.base.archivesName.get()}-${project.version} mc${project.extra["minecraft_version"]}.jar"}
tasks.remapSourcesJar{
tasks.named<Jar>("sourcesJar") {
archiveFileName = "${project.base.archivesName.get()}-${project.version} mc${project.extra["minecraft_version"]}-sources.jar"}
// configure the maven publication

View File

@@ -4,17 +4,17 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.11
loader_version=0.18.2
minecraft_version=26.1
loader_version=0.18.4
# Mod Properties
mod_version=0.5.0
mod_version=0.5.1
maven_group=xyz.thewhitedog9487
archives_base_name=RandomTeleporter
# Dependencies
fabric_version=0.139.4+1.21.11
fabric_api_version=0.144.3+26.1
# https://modrinth.com/mod/modmenu/versions
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
modmenu_version=17.0.0-beta.2
modmenu_version=18.0.0-alpha.8

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-9.2.0-bin.zip
distributionUrl=https://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@@ -1,9 +1,10 @@
package xyz.thewhitedog9487;
import net.fabricmc.fabric.api.resource.v1.ResourceLoader;
import net.fabricmc.fabric.api.resource.v1.reloader.SimpleResourceReloader;
import net.fabricmc.fabric.api.resource.v1.reloader.SimpleReloadListener;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.server.packs.resources.PreparableReloadListener;
import org.jspecify.annotations.NonNull;
import static net.minecraft.server.packs.PackType.CLIENT_RESOURCES;
@@ -23,16 +24,16 @@ public class ResourceReloaderListener {
public static String CommandArgumentName_RegionToEntity = "RegionTo(随机范围结束位置,实体)";
public static void Register(){
ResourceLoader.get(CLIENT_RESOURCES).registerReloader(Identifier.fromNamespaceAndPath(MOD_ID, "translate_text_apply"), new SimpleResourceReloader<Void>() {
ResourceLoader.get(CLIENT_RESOURCES).registerReloadListener(Identifier.fromNamespaceAndPath(MOD_ID, "translate_text_apply"), new SimpleReloadListener<Void>() {
/**
* 用不到,不用管
*/
@Override
protected Void prepare(@NonNull SharedState store) {
protected Void prepare(PreparableReloadListener.@NonNull SharedState store) {
return null; }
@Override
protected void apply(Void prepared, @NonNull SharedState store) {
protected void apply(Void prepared, PreparableReloadListener.@NonNull SharedState store) {
CommandArgumentName_Radius = Component.translatableWithFallback("command.argument.radius", "Radius(半径)").getString();
CommandArgumentName_Target = Component.translatableWithFallback("command.argument.target", "PlayerID(被传送玩家名)").getString();
CommandArgumentName_OriginPosition = Component.translatableWithFallback("command.argument.origin_pos", "OriginPos(随机中心,坐标)").getString();

View File

@@ -27,10 +27,10 @@
}
],
"depends": {
"fabricloader": ">=0.18.2",
"minecraft": "1.21.11",
"java": ">=21",
"fabric-api": ">=0.139.4"
"fabricloader": ">=0.18.4",
"minecraft": "26.1",
"java": ">=25",
"fabric-api": ">=0.144.3"
},
"suggests": {
"another-mod": "*"