升级游戏兼容性到1.21
移除翻译键中手动添加的命名空间
编译版本升级至JDK21
This commit is contained in:
TheWhiteDog9487 2024-06-14 14:33:33 +08:00
parent 8186159653
commit 6eb98f1f94
8 changed files with 26 additions and 25 deletions

View File

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.5-SNAPSHOT' id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
@ -54,7 +54,7 @@ processResources {
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
it.options.release = 17 it.options.release = 21
} }
java { java {
@ -63,8 +63,8 @@ java {
// If you remove this line, sources will not be generated. // If you remove this line, sources will not be generated.
withSourcesJar() withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_21
} }
jar { jar {

View File

@ -4,17 +4,17 @@ org.gradle.parallel=true
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.20.4 minecraft_version=1.21
yarn_mappings=1.20.4+build.3 yarn_mappings=1.21+build.1
loader_version=0.15.7 loader_version=0.15.11
# Mod Properties # Mod Properties
mod_version=0.2.5 mod_version=0.3.0
maven_group=xyz.thewhitedog9487 maven_group=xyz.thewhitedog9487
archives_base_name=randomteleporter archives_base_name=randomteleporter
# Dependencies # Dependencies
fabric_version=0.96.1+1.20.4 fabric_version=0.100.1+1.21
loom_libraries_base=https://bmclapi2.bangbang93.com/maven/ loom_libraries_base=https://bmclapi2.bangbang93.com/maven/
loom_resources_base=https://bmclapi2.bangbang93.com/assets/ loom_resources_base=https://bmclapi2.bangbang93.com/assets/

View File

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

View File

@ -12,6 +12,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.HashSet;
import java.util.SplittableRandom; import java.util.SplittableRandom;
import static net.minecraft.server.command.CommandManager.argument; import static net.minecraft.server.command.CommandManager.argument;
@ -166,7 +167,7 @@ public class CommandRegister {
static int execute_command(ServerCommandSource Source, @Nullable Long Radius, @Nullable Entity Player, @Nullable Vec3d Origin){ static int execute_command(ServerCommandSource Source, @Nullable Long Radius, @Nullable Entity Player, @Nullable Vec3d Origin){
Entity entity = Player == null ? Source.getPlayer() : Player; Entity entity = Player == null ? Source.getPlayer() : Player;
if (entity == null) { if (entity == null) {
Source.sendFeedback(()->{ return Text.translatable("error.twd.rtp.not_player"); }, true); Source.sendFeedback(()->{ return Text.translatable("error.not_player"); }, true);
return -1;} return -1;}
if (Radius == null){Radius = WorldBorder - (long) 1e4;} if (Radius == null){Radius = WorldBorder - (long) 1e4;}
Radius = Math.abs(Radius); Radius = Math.abs(Radius);
@ -198,12 +199,12 @@ public class CommandRegister {
execute_command(Source, Radius,null, Origin); execute_command(Source, Radius,null, Origin);
return 0;} return 0;}
if (Retry >= 126){ if (Retry >= 126){
Source.sendFeedback(()->{ return Text.translatable("warning.twd.rtp.retry"); }, true);} Source.sendFeedback(()->{ return Text.translatable("warning.retry"); }, true);}
entity.teleport(Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5); entity.teleport(Source.getWorld(),Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5, new HashSet<>(), entity.getYaw(), entity.getPitch());
final long FinalCoordinate_X = Coordinate_X; final long FinalCoordinate_X = Coordinate_X;
final int FinalCoordinate_Y = Coordinate_Y; final int FinalCoordinate_Y = Coordinate_Y;
final long FinalCoordinate_Z = Coordinate_Z; final long FinalCoordinate_Z = Coordinate_Z;
Source.sendFeedback(()->{ return Text.translatable("info.twd.rtp.success", entity.getName(), FinalCoordinate_X, FinalCoordinate_Y, FinalCoordinate_Z); },true); Source.sendFeedback(()->{ return Text.translatable("info.success", entity.getName(), FinalCoordinate_X, FinalCoordinate_Y, FinalCoordinate_Z); },true);
return 0;} return 0;}
static int execute_command_origin(ServerCommandSource Source, @Nullable Long Radius, @Nullable Entity Player, Entity Origin){ static int execute_command_origin(ServerCommandSource Source, @Nullable Long Radius, @Nullable Entity Player, Entity Origin){
return execute_command(Source, Radius, Player, Origin.getPos());} return execute_command(Source, Radius, Player, Origin.getPos());}

View File

@ -17,6 +17,6 @@ public class RandomTeleporter implements ModInitializer {
// However, some things (like resources) may still be uninitialized. // However, some things (like resources) may still be uninitialized.
// Proceed with mild caution. // Proceed with mild caution.
CommandRegister.Register(); CommandRegister.Register();
LOGGER.info("Hello Fabric world!"); LOGGER.info("RandomTeleporter Loading!");
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"modmenu.nameTranslation.randomteleporter": "RandomTeleporter", "modmenu.nameTranslation.randomteleporter": "RandomTeleporter",
"modmenu.descriptionTranslation.randomteleporter": "Added two commands for random teleportation", "modmenu.descriptionTranslation.randomteleporter": "Added two commands for random teleportation",
"twd.bilibili": "Bilibili", "bilibili": "Bilibili",
"twd.blog": "Blog" "blog": "Blog"
} }

View File

@ -1,9 +1,9 @@
{ {
"modmenu.nameTranslation.randomteleporter": "随机传送", "modmenu.nameTranslation.randomteleporter": "随机传送",
"modmenu.descriptionTranslation.randomteleporter": "增加了两个用于随机传送的命令", "modmenu.descriptionTranslation.randomteleporter": "增加了两个用于随机传送的命令",
"info.twd.rtp.success": "已将玩家%s传送到%d %d %d", "info.success": "已将玩家%s传送到%d %d %d",
"error.twd.rtp.not_player": "执行命令的不是玩家", "error.not_player": "执行命令的不是玩家",
"warning.twd.rtp.retry": "重试次数过大,为避免死循环将在本次传送中取消距离保护", "warning.retry": "重试次数过大,为避免死循环将在本次传送中取消距离保护",
"twd.bilibili": "哔哩哔哩主页", "bilibili": "哔哩哔哩主页",
"twd.blog": "TheWhiteDog9487的博客" "blog": "TheWhiteDog9487的博客"
} }

View File

@ -27,9 +27,9 @@
} }
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": "~1.20.4", "minecraft": "~1.21",
"java": ">=17", "java": ">=21",
"fabric-api": "*" "fabric-api": "*"
}, },
"suggests": { "suggests": {