From 6eb98f1f94877c5462c35cfcd43dd3e04c149db6 Mon Sep 17 00:00:00 2001 From: TheWhiteDog9487 Date: Fri, 14 Jun 2024 14:33:33 +0800 Subject: [PATCH] =?UTF-8?q?0.3.0=20=E5=8D=87=E7=BA=A7=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=E5=88=B01.21=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E9=94=AE=E4=B8=AD=E6=89=8B=E5=8A=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=9A=84=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=20?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7=E8=87=B3?= =?UTF-8?q?JDK21?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 8 ++++---- gradle.properties | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/java/xyz/thewhitedog9487/CommandRegister.java | 9 +++++---- .../java/xyz/thewhitedog9487/RandomTeleporter.java | 2 +- .../resources/assets/randomteleporter/lang/en_us.json | 4 ++-- .../resources/assets/randomteleporter/lang/zh_cn.json | 10 +++++----- src/main/resources/fabric.mod.json | 6 +++--- 8 files changed, 26 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 0ef5277..47b135a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.5-SNAPSHOT' + id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' } @@ -54,7 +54,7 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } java { @@ -63,8 +63,8 @@ java { // If you remove this line, sources will not be generated. withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { diff --git a/gradle.properties b/gradle.properties index f8db583..f05a5b2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,17 +4,17 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.4 -yarn_mappings=1.20.4+build.3 -loader_version=0.15.7 +minecraft_version=1.21 +yarn_mappings=1.21+build.1 +loader_version=0.15.11 # Mod Properties -mod_version=0.2.5 +mod_version=0.3.0 maven_group=xyz.thewhitedog9487 archives_base_name=randomteleporter # 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_resources_base=https://bmclapi2.bangbang93.com/assets/ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac72c34..a441313 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME 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 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/xyz/thewhitedog9487/CommandRegister.java b/src/main/java/xyz/thewhitedog9487/CommandRegister.java index 0c0dfb7..ece6a6a 100644 --- a/src/main/java/xyz/thewhitedog9487/CommandRegister.java +++ b/src/main/java/xyz/thewhitedog9487/CommandRegister.java @@ -12,6 +12,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import org.jetbrains.annotations.Nullable; +import java.util.HashSet; import java.util.SplittableRandom; 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){ Entity entity = Player == null ? Source.getPlayer() : Player; 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;} if (Radius == null){Radius = WorldBorder - (long) 1e4;} Radius = Math.abs(Radius); @@ -198,12 +199,12 @@ public class CommandRegister { execute_command(Source, Radius,null, Origin); return 0;} if (Retry >= 126){ - Source.sendFeedback(()->{ return Text.translatable("warning.twd.rtp.retry"); }, true);} - entity.teleport(Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5); + Source.sendFeedback(()->{ return Text.translatable("warning.retry"); }, true);} + 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 int FinalCoordinate_Y = Coordinate_Y; 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;} static int execute_command_origin(ServerCommandSource Source, @Nullable Long Radius, @Nullable Entity Player, Entity Origin){ return execute_command(Source, Radius, Player, Origin.getPos());} diff --git a/src/main/java/xyz/thewhitedog9487/RandomTeleporter.java b/src/main/java/xyz/thewhitedog9487/RandomTeleporter.java index 79a762f..1dca3d3 100644 --- a/src/main/java/xyz/thewhitedog9487/RandomTeleporter.java +++ b/src/main/java/xyz/thewhitedog9487/RandomTeleporter.java @@ -17,6 +17,6 @@ public class RandomTeleporter implements ModInitializer { // However, some things (like resources) may still be uninitialized. // Proceed with mild caution. CommandRegister.Register(); - LOGGER.info("Hello Fabric world!"); + LOGGER.info("RandomTeleporter Loading!"); } } \ No newline at end of file diff --git a/src/main/resources/assets/randomteleporter/lang/en_us.json b/src/main/resources/assets/randomteleporter/lang/en_us.json index 83f2c2d..0abd4b5 100644 --- a/src/main/resources/assets/randomteleporter/lang/en_us.json +++ b/src/main/resources/assets/randomteleporter/lang/en_us.json @@ -1,6 +1,6 @@ { "modmenu.nameTranslation.randomteleporter": "RandomTeleporter", "modmenu.descriptionTranslation.randomteleporter": "Added two commands for random teleportation", - "twd.bilibili": "Bilibili", - "twd.blog": "Blog" + "bilibili": "Bilibili", + "blog": "Blog" } \ No newline at end of file diff --git a/src/main/resources/assets/randomteleporter/lang/zh_cn.json b/src/main/resources/assets/randomteleporter/lang/zh_cn.json index 9dd4a25..440cf1e 100644 --- a/src/main/resources/assets/randomteleporter/lang/zh_cn.json +++ b/src/main/resources/assets/randomteleporter/lang/zh_cn.json @@ -1,9 +1,9 @@ { "modmenu.nameTranslation.randomteleporter": "随机传送", "modmenu.descriptionTranslation.randomteleporter": "增加了两个用于随机传送的命令", - "info.twd.rtp.success": "已将玩家%s传送到%d %d %d", - "error.twd.rtp.not_player": "执行命令的不是玩家", - "warning.twd.rtp.retry": "重试次数过大,为避免死循环将在本次传送中取消距离保护", - "twd.bilibili": "哔哩哔哩主页", - "twd.blog": "TheWhiteDog9487的博客" + "info.success": "已将玩家%s传送到%d %d %d", + "error.not_player": "执行命令的不是玩家", + "warning.retry": "重试次数过大,为避免死循环将在本次传送中取消距离保护", + "bilibili": "哔哩哔哩主页", + "blog": "TheWhiteDog9487的博客" } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9a2510a..d460103 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -27,9 +27,9 @@ } ], "depends": { - "fabricloader": ">=0.15.6", - "minecraft": "~1.20.4", - "java": ">=17", + "fabricloader": ">=0.15.11", + "minecraft": "~1.21", + "java": ">=21", "fabric-api": "*" }, "suggests": {