9 Commits

Author SHA1 Message Date
TheWhiteDog9487
e7f9ac069a 将 随机数生成器 需要被替换的方块列表 和 替换目标方块 提取到静态常量
并且让随机数的上界+1以使随机范围成为完整闭区间
2025-10-05 14:11:00 +08:00
TheWhiteDog9487
eb85fff326 使单个根名称的命令树一次性完成注册
并且现在由Minecraft自己的命令解析器确保用户输入的随机半径>=0
返回标准Command.SINGLE_SUCCESS
2025-10-05 14:09:11 +08:00
TheWhiteDog9487
48a5027cce 更新至Minecraft 1.21.9 2025-10-03 16:51:17 +08:00
TheWhiteDog9487
62c3484c5e 更新Gradle到9.1.0 2025-10-03 16:50:50 +08:00
d47907cdf4 更新至Minecraft 1.21.8
Feature Drop和Bugfix混用小版本号的话,年底,不,甚至暑假结束之前有望突破1.21.10
2025-07-18 11:19:41 +08:00
8c55311f27 更新至Minecraft 1.21.7
La-la-la-lava, ch-ch-ch-chicken
Steve's Lava Chicken, yeah, it's tasty as hell
Ooh, mamacita, now you're ringin' the bell
Crispy and juicy, now you're havin' a snack
Ooh, super spicy, it's a lava attack
2025-07-01 08:49:58 +08:00
35ac4dd842 0.3.6
小更改,正常用应该是感受不到的。
当随机半径被设置为0的时候不会再抛出异常而导致命令运行失败了。
手动处理了这个部分,向玩家发送警告并根据随机中心点是否被设置而决定是否进行传送。
2025-06-18 12:24:29 +08:00
34ea09dfd9 依赖项更新至Minecraft 1.21.6 2025-06-18 10:31:14 +08:00
ad014a2b1b 更新Gradle至8.14 2025-06-18 10:30:20 +08:00
7 changed files with 140 additions and 131 deletions

View File

@@ -1,9 +1,9 @@
plugins { plugins {
id("fabric-loom") version "1.10-SNAPSHOT" id("fabric-loom") version "1.11-SNAPSHOT"
id("maven-publish") id("maven-publish")
} }
version = "${project.extra["mod_version"]}" version = project.extra["mod_version"] as String
group = project.extra["maven_group"] as String group = project.extra["maven_group"] as String
base { base {

View File

@@ -4,18 +4,18 @@ 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.21.5 minecraft_version=1.21.9
yarn_mappings=1.21.5+build.1 yarn_mappings=1.21.9+build.1
loader_version=0.16.10 loader_version=0.17.2
# Mod Properties # Mod Properties
mod_version=0.3.5 mod_version=0.3.6
maven_group=xyz.thewhitedog9487 maven_group=xyz.thewhitedog9487
archives_base_name=RandomTeleporter archives_base_name=RandomTeleporter
# Dependencies # Dependencies
fabric_version=0.119.5+1.21.5 fabric_version=0.133.14+1.21.9
# https://modrinth.com/mod/modmenu/versions # https://modrinth.com/mod/modmenu/versions
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu # https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
modmenu_version=14.0.0-rc.2 modmenu_version=16.0.0-rc.1

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.13-bin.zip distributionUrl=https://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@@ -1,5 +1,6 @@
package xyz.thewhitedog9487; package xyz.thewhitedog9487;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.IntegerArgumentType;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@@ -13,6 +14,7 @@ import net.minecraft.util.math.Vec2f;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
import java.util.SplittableRandom; import java.util.SplittableRandom;
import static net.minecraft.server.command.CommandManager.argument; import static net.minecraft.server.command.CommandManager.argument;
@@ -20,6 +22,32 @@ import static net.minecraft.server.command.CommandManager.literal;
public class CommandRegister { public class CommandRegister {
/**
* 随机数生成器
*/
final static SplittableRandom SR = new SplittableRandom();
/**
* 传送后用于生成保护平台的方块
*/
final static Block TargetBlock = Blocks.GLASS;
/**
* 传送后会被 {@link CommandRegister#TargetBlock} 替换掉的方块
* <br>
* 替换中心:被传送目标脚下方块
* <br>
* 替换范围:替换中心周围半径为一的正方形区域
*/
final static Set<Block> ReplaceToTargetBlock = Set.of(
Blocks.AIR,
Blocks.VOID_AIR,
Blocks.CAVE_AIR,
Blocks.WATER,
Blocks.LAVA,
Blocks.SHORT_GRASS,
Blocks.VINE );
/** /**
* 世界边界 * 世界边界
* <br> * <br>
@@ -44,147 +72,107 @@ public class CommandRegister {
* @see <a href="https://wiki.fabricmc.net/tutorial:commands">Fabric Wiki (Old style,English)</a> * @see <a href="https://wiki.fabricmc.net/tutorial:commands">Fabric Wiki (Old style,English)</a>
*/ */
public static void Register(String Name){ public static void Register(String Name){
// /rtp
CommandRegistrationCallback.EVENT CommandRegistrationCallback.EVENT
.register((dispatcher, registryAccess, environment) ->{ .register((dispatcher, registryAccess, environment) ->{
dispatcher.register(literal(Name) dispatcher.register(literal(Name)
// /rtp
.requires(source -> source.hasPermissionLevel(PermissionLevel)) .requires(source -> source.hasPermissionLevel(PermissionLevel))
.executes(context -> execute_command( .executes(context -> ExecuteCommand(
context.getSource(),null,null, null)));}); context.getSource(),null,null, null))
// /rtp <Radius(半径)>
// /rtp <Radius(半径)> .then(argument("Radius(半径)", IntegerArgumentType.integer(0))
CommandRegistrationCallback.EVENT
.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(literal(Name)
.then(argument("Radius(半径)", IntegerArgumentType.integer())
.requires(source -> source.hasPermissionLevel(PermissionLevel)) .requires(source -> source.hasPermissionLevel(PermissionLevel))
.executes(context -> execute_command( .executes(context -> ExecuteCommand(
context.getSource(), context.getSource(),
IntegerArgumentType.getInteger(context, "Radius(半径)"), IntegerArgumentType.getInteger(context, "Radius(半径)"),
null, null,
null))));}); null)))
// /rtp <被传送玩家名(PlayerID)>
// /rtp <被传送玩家名(PlayerID)>
CommandRegistrationCallback.EVENT
.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(literal(Name)
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity()) .then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
.requires(source -> source.hasPermissionLevel(PermissionLevel)) .requires(source -> source.hasPermissionLevel(PermissionLevel))
.executes(context -> execute_command( .executes(context -> ExecuteCommand(
context.getSource(), context.getSource(),
null, null,
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"), EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
null))));}); null)))
// /rtp <Radius(半径)> <被传送玩家名(PlayerID)>
// /rtp <Radius(半径)> <被传送玩家名(PlayerID)> .then(argument("Radius(半径)", IntegerArgumentType.integer(0))
CommandRegistrationCallback.EVENT
.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(literal(Name)
.then(argument("Radius(半径)", IntegerArgumentType.integer())
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity()) .then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
.requires(source -> source.hasPermissionLevel(PermissionLevel)) .requires(source -> source.hasPermissionLevel(PermissionLevel))
.executes(context -> execute_command( .executes(context -> ExecuteCommand(
context.getSource(), context.getSource(),
IntegerArgumentType.getInteger(context, "Radius(半径)"), IntegerArgumentType.getInteger(context, "Radius(半径)"),
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"), EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
null)))));}); null))))
// /rtp <被传送玩家名(PlayerID)> <Radius(半径)>
// /rtp <被传送玩家名(PlayerID)> <Radius(半径)>
CommandRegistrationCallback.EVENT
.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(literal(Name)
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity()) .then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
.then(argument("Radius(半径)", IntegerArgumentType.integer()) .then(argument("Radius(半径)", IntegerArgumentType.integer(0))
.requires(source -> source.hasPermissionLevel(PermissionLevel)) .requires(source -> source.hasPermissionLevel(PermissionLevel))
.executes(context -> execute_command( .executes(context -> ExecuteCommand(
context.getSource(), context.getSource(),
IntegerArgumentType.getInteger(context, "Radius(半径)"), IntegerArgumentType.getInteger(context, "Radius(半径)"),
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"), EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
null)))));}); null))))
// // /rtp <Radius(半径)> <Origin(随机中心)>
// // /rtp <Radius(半径)> <Origin(随机中心)> // .then(argument("Radius(半径)", LongArgumentType.longArg())
// CommandRegistrationCallback.EVENT // .then(argument("Origin(随机中心)",EntityArgumentType.player())
// .register((dispatcher, registryAccess, environment) -> { // .requires(source -> source.hasPermissionLevel(PermissionLevel))
// dispatcher.register(literal(Name) // .executes(context -> execute_command_origin(
// .then(argument("Radius(半径)", LongArgumentType.longArg()) // context.getSource(),
// .then(argument("Origin(随机中心)",EntityArgumentType.player()) // LongArgumentType.getLong(context, "Radius(半径)"),
// .requires(source -> source.hasPermissionLevel(PermissionLevel)) // null,
// .executes(context -> execute_command_origin( // EntityArgumentType.getEntity(context,"Origin(随机中心)")))))
// context.getSource(), // /rtp <Radius(半径)> <OriginPos(随机中心,坐标)>
// LongArgumentType.getLong(context, "Radius(半径)"), .then(argument("Radius(半径)", IntegerArgumentType.integer(0))
// null,
// EntityArgumentType.getEntity(context,"Origin(随机中心)"))))));});
// /rtp <Radius(半径)> <OriginPos(随机中心,坐标)>
CommandRegistrationCallback.EVENT
.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(literal(Name)
.then(argument("Radius(半径)", IntegerArgumentType.integer())
.then(argument("OriginPos(随机中心,坐标)",Vec2ArgumentType.vec2()) .then(argument("OriginPos(随机中心,坐标)",Vec2ArgumentType.vec2())
.requires(source -> source.hasPermissionLevel(PermissionLevel)) .requires(source -> source.hasPermissionLevel(PermissionLevel))
.executes(context -> execute_command( .executes(context -> ExecuteCommand(
context.getSource(), context.getSource(),
IntegerArgumentType.getInteger(context, "Radius(半径)"), IntegerArgumentType.getInteger(context, "Radius(半径)"),
null, null,
Vec2ArgumentType.getVec2(context,"OriginPos(随机中心,坐标)"))))));}); Vec2ArgumentType.getVec2(context,"OriginPos(随机中心,坐标)")))))
// /rtp <Radius(半径)> <被传送玩家名(PlayerID)> <OriginEntity(随机中心,实体)>
// /rtp <Radius(半径)> <被传送玩家名(PlayerID)> <OriginEntity(随机中心,实体)> .then(argument("Radius(半径)", IntegerArgumentType.integer(0))
CommandRegistrationCallback.EVENT
.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(literal(Name)
.then(argument("Radius(半径)", IntegerArgumentType.integer())
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity()) .then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
.then(argument("OriginEntity(随机中心,实体)",EntityArgumentType.entity()) .then(argument("OriginEntity(随机中心,实体)",EntityArgumentType.entity())
.requires(source -> source.hasPermissionLevel(PermissionLevel)) .requires(source -> source.hasPermissionLevel(PermissionLevel))
.executes(context -> execute_command( .executes(context -> ExecuteCommand(
context.getSource(), context.getSource(),
IntegerArgumentType.getInteger(context, "Radius(半径)"), IntegerArgumentType.getInteger(context, "Radius(半径)"),
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"), EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
new Vec2f( (float) EntityArgumentType.getEntity( context,"OriginEntity(随机中心,实体)").getPos().x, new Vec2f( (float) EntityArgumentType.getEntity( context,"OriginEntity(随机中心,实体)").getEntityPos().x,
(float) EntityArgumentType.getEntity( context,"OriginEntity(随机中心,实体)").getPos().z )))))));}); (float) EntityArgumentType.getEntity( context,"OriginEntity(随机中心,实体)").getEntityPos().z ))))))
// /rtp <Radius(半径)> <被传送玩家名(PlayerID)> <OriginPos(随机中心,坐标)>
// /rtp <Radius(半径)> <被传送玩家名(PlayerID)> <OriginPos(随机中心,坐标)> .then(argument("Radius(半径)", IntegerArgumentType.integer(0))
CommandRegistrationCallback.EVENT .then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
.register((dispatcher, registryAccess, environment) -> { .then(argument("OriginPos(随机中心,坐标)",Vec2ArgumentType.vec2())
dispatcher.register(literal(Name) .requires(source -> source.hasPermissionLevel(PermissionLevel))
.then(argument("Radius(半径)", IntegerArgumentType.integer()) .executes(context -> ExecuteCommand(
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity()) context.getSource(),
.then(argument("OriginPos(随机中心,坐标)",Vec2ArgumentType.vec2()) IntegerArgumentType.getInteger(context, "Radius(半径)"),
.requires(source -> source.hasPermissionLevel(PermissionLevel)) EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
.executes(context -> execute_command( Vec2ArgumentType.getVec2(context,"OriginPos(随机中心,坐标)"))))))
context.getSource(), // /rtp <被传送玩家名(PlayerID)> <Radius(半径)> <OriginEntity(随机中心,实体)>
IntegerArgumentType.getInteger(context, "Radius(半径)"), .then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"), .then(argument("Radius(半径)", IntegerArgumentType.integer(0))
Vec2ArgumentType.getVec2(context,"OriginPos(随机中心,坐标)")))))));}); .then(argument("OriginEntity(随机中心,实体)",EntityArgumentType.entity())
.requires(source -> source.hasPermissionLevel(PermissionLevel))
// /rtp <被传送玩家名(PlayerID)> <Radius(半径)> <OriginEntity(随机中心,实体)> .executes(context -> ExecuteCommand(
CommandRegistrationCallback.EVENT context.getSource(),
.register((dispatcher, registryAccess, environment) -> { IntegerArgumentType.getInteger(context, "Radius(半径)"),
dispatcher.register(literal(Name) EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity()) new Vec2f( (float) EntityArgumentType.getEntity( context,"OriginEntity(随机中心,实体)").getEntityPos().x,
.then(argument("Radius(半径)", IntegerArgumentType.integer()) (float) EntityArgumentType.getEntity( context,"OriginEntity(随机中心,实体)").getEntityPos().z ))))))
.then(argument("OriginEntity(随机中心,实体)",EntityArgumentType.entity()) // /rtp <被传送玩家名(PlayerID)> <Radius(半径)> <OriginPos(随机中心,坐标)>
.requires(source -> source.hasPermissionLevel(PermissionLevel)) .then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
.executes(context -> execute_command( .then(argument("Radius(半径)", IntegerArgumentType.integer(0))
context.getSource(), .then(argument("OriginPos(随机中心,坐标)",Vec2ArgumentType.vec2())
IntegerArgumentType.getInteger(context, "Radius(半径)"), .requires(source -> source.hasPermissionLevel(PermissionLevel))
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"), .executes(context -> ExecuteCommand(
new Vec2f( (float) EntityArgumentType.getEntity( context,"OriginEntity(随机中心,实体)").getPos().x, context.getSource(),
(float) EntityArgumentType.getEntity( context,"OriginEntity(随机中心,实体)").getPos().z )))))));}); IntegerArgumentType.getInteger(context, "Radius(半径)"),
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
// /rtp <被传送玩家名(PlayerID)> <Radius(半径)> <OriginPos(随机中心,坐标)> Vec2ArgumentType.getVec2(context,"OriginPos(随机中心,坐标)")))))) );});}
CommandRegistrationCallback.EVENT
.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(literal(Name)
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
.then(argument("Radius(半径)", IntegerArgumentType.integer())
.then(argument("OriginPos(随机中心,坐标)",Vec2ArgumentType.vec2())
.requires(source -> source.hasPermissionLevel(PermissionLevel))
.executes(context -> execute_command(
context.getSource(),
IntegerArgumentType.getInteger(context, "Radius(半径)"),
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
Vec2ArgumentType.getVec2(context,"OriginPos(随机中心,坐标)")))))));});}
/** /**
* 向游戏内注册命令 * 向游戏内注册命令
@@ -220,15 +208,27 @@ public class CommandRegister {
return -1;} return -1;}
if (Radius == null){Radius = (int) (WorldBorder - 1e4);} if (Radius == null){Radius = (int) (WorldBorder - 1e4);}
// ↑ 远离世界边界 // ↑ 远离世界边界
Radius = Math.abs(Radius); int Coordinate_X = 0;
int Coordinate_X; int Coordinate_Z = 0;
int Coordinate_Z; try {
if (Origin == null){ if (Origin == null){
Coordinate_X = new SplittableRandom().nextInt(-Radius, Radius); Coordinate_X = SR.nextInt(-Radius, Radius + 1);
Coordinate_Z = new SplittableRandom().nextInt(-Radius, Radius);} Coordinate_Z = SR.nextInt(-Radius, Radius + 1); }
else{ else{
Coordinate_X = new SplittableRandom().nextInt((int) Origin.x - Radius, (int) Origin.x + Radius); Coordinate_X = SR.nextInt((int) Origin.x - Radius, (int) Origin.x + Radius + 1);
Coordinate_Z = new SplittableRandom().nextInt((int) Origin.y - Radius, (int) Origin.y + Radius);} Coordinate_Z = SR.nextInt((int) Origin.y - Radius, (int) Origin.y + Radius + 1); } }
catch (IllegalArgumentException e) {
// 半径为零
if (Origin == null) {
Source.sendFeedback(()->{ return Text.translatableWithFallback("warning.radius_equal_zero_no_target", "由于你设置的随机半径为0并且未设置随机中心点坐标因此什么都不会发生"); },true);
return -1;}
else {
Coordinate_X = (int) Origin.x;
Coordinate_Z = (int) Origin.y;
int finalCoordinate_X1 = Coordinate_X;
int finalCoordinate_Z1 = Coordinate_Z;
// ↑ "lambda 表达式中使用的变量应为 final 或有效 final"
Source.sendFeedback(()->{ return Text.translatableWithFallback("warning.radius_equal_zero", "警告由于你设置的随机半径为0因此在选择出合适高度之后将直接把你传送至%d %d", finalCoordinate_X1, finalCoordinate_Z1); },true);}}
int Coordinate_Y = 320; int Coordinate_Y = 320;
for (var CurrentBlock = Source.getWorld().getBlockState(new BlockPos(Coordinate_X, Coordinate_Y, Coordinate_Z)).getBlock(); for (var CurrentBlock = Source.getWorld().getBlockState(new BlockPos(Coordinate_X, Coordinate_Y, Coordinate_Z)).getBlock();
// 从世界顶层往下找,直到遇到一个非空气方块 // 从世界顶层往下找,直到遇到一个非空气方块
@@ -250,13 +250,18 @@ public class CommandRegister {
// 只替换空气、水和岩浆,其余保留 // 只替换空气、水和岩浆,其余保留
Source.getWorld().setBlockState(BlockPos, Blocks.GLASS.getDefaultState());}}} Source.getWorld().setBlockState(BlockPos, Blocks.GLASS.getDefaultState());}}}
// if ( String.valueOf(entity.getWorld().getBiome(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getKey()).equals("minecraft:the_void") ) { // if ( String.valueOf(entity.getWorld().getBiome(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getKey()).equals("minecraft:the_void") ) {
if ( ReplaceToTargetBlock.contains(CurrentBlock) ) {
// 只替换ReplaceToTargetBlock内的方块其余保留
EntityWorld.setBlockState(BlockPos, TargetBlock.getDefaultState());}}}
// Coordinate_Y++;} // Coordinate_Y++;}
Coordinate_Y++; Coordinate_Y++;
// ↑ 高一层,人别站在土里了 // ↑ 高一层,人别站在土里了
entity.teleport(Source.getWorld(),Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5, new HashSet<>(), entity.getYaw(), entity.getPitch(), false); entity.teleport(Source.getWorld(),Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5, new HashSet<>(), entity.getYaw(), entity.getPitch(), false);
int finalCoordinate_X = Coordinate_X;
int finalCoordinate_Y = Coordinate_Y; int finalCoordinate_Y = Coordinate_Y;
int finalCoordinate_Z = Coordinate_Z;
// ↑ "lambda 表达式中使用的变量应为 final 或有效 final" // ↑ "lambda 表达式中使用的变量应为 final 或有效 final"
final var FeedbackFallbackString = String.format("已将玩家%s传送到%d %d %d", entity.getName().getString(), Coordinate_X, finalCoordinate_Y, Coordinate_Z); final var FeedbackFallbackString = String.format("已将玩家%s传送到%d %d %d", TargetEntity.getName().getString(), Coordinate_X, Coordinate_Y, Coordinate_Z);
Source.sendFeedback(()->{ return Text.translatableWithFallback("info.success", FeedbackFallbackString, entity.getName(), Coordinate_X, finalCoordinate_Y, Coordinate_Z); },true); Source.sendFeedback(()->{ return Text.translatableWithFallback("info.success", FeedbackFallbackString, TargetEntity.getName(), finalCoordinate_X, Coordinate_Y, finalCoordinate_Z); },true);
return 16;} return Command.SINGLE_SUCCESS;}
} }

View File

@@ -3,5 +3,7 @@
"modmenu.descriptionTranslation.randomteleporter": "Added two commands for random teleportation", "modmenu.descriptionTranslation.randomteleporter": "Added two commands for random teleportation",
"info.success": "Teleported %s to %d %d %d", "info.success": "Teleported %s to %d %d %d",
"error.no_target": "There is no teleported target, and the teleported player ID is explicitly specified when executed by a non-player object", "error.no_target": "There is no teleported target, and the teleported player ID is explicitly specified when executed by a non-player object",
"warning.radius_equal_zero": "Warning: Since you set a random radius of 0, selecting the right height will teleport you directly to %d %d",
"warning.radius_equal_zero_no_target": "Warning: Since you set a random radius of 0 and you don't set a random center point coordinates, nothing happens",
"bilibili": "Bilibili" "bilibili": "Bilibili"
} }

View File

@@ -3,5 +3,7 @@
"modmenu.descriptionTranslation.randomteleporter": "增加了两个用于随机传送的命令", "modmenu.descriptionTranslation.randomteleporter": "增加了两个用于随机传送的命令",
"info.success": "已将玩家%s传送到%d %d %d", "info.success": "已将玩家%s传送到%d %d %d",
"error.no_target": "不存在被传送目标由非玩家物体执行命令时请显式指定被传送玩家ID", "error.no_target": "不存在被传送目标由非玩家物体执行命令时请显式指定被传送玩家ID",
"warning.radius_equal_zero": "警告由于你设置的随机半径为0因此在选择出合适高度之后将直接把你传送至%d %d",
"warning.radius_equal_zero_no_target": "警告由于你设置的随机半径为0并且未设置随机中心点坐标因此什么都不会发生",
"bilibili": "TheWhiteDog9487的哔哩哔哩主页" "bilibili": "TheWhiteDog9487的哔哩哔哩主页"
} }

View File

@@ -27,10 +27,10 @@
} }
], ],
"depends": { "depends": {
"fabricloader": ">=0.16.10", "fabricloader": ">=0.17.2",
"minecraft": "1.21.5", "minecraft": "1.21.9",
"java": ">=21", "java": ">=21",
"fabric-api": ">=0.119.5" "fabric-api": ">=0.133.14"
}, },
"suggests": { "suggests": {
"another-mod": "*" "another-mod": "*"