1 Commits
1.19.1 ... 1.20

Author SHA1 Message Date
8186159653 0.2.5
突然发现Ved3d类型的方法里有一个计算两点间距离的,那我就把我自己的工具库撤了。
然后我把命令权限等级从4下降到了2,和原版的/tp同步。
(我记得原版的tp是4级啊?我最早还去源代码里看了一眼,咋回事呢?
传送过去生成的保护平台,现在是3x3的玻璃而不是1x1的石头,而且玩家会站在平台的正中心。
例行更新Fabric API和Fabric Loader
2024-02-18 20:39:47 +08:00
3 changed files with 11 additions and 13 deletions

View File

@@ -4,8 +4,8 @@ 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.19.1 minecraft_version=1.20.4
yarn_mappings=1.19.1+build.6 yarn_mappings=1.20.4+build.3
loader_version=0.15.7 loader_version=0.15.7
# Mod Properties # Mod Properties
@@ -14,7 +14,7 @@ maven_group=xyz.thewhitedog9487
archives_base_name=randomteleporter archives_base_name=randomteleporter
# Dependencies # Dependencies
fabric_version=0.58.5+1.19.1 fabric_version=0.96.1+1.20.4
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

@@ -18,9 +18,7 @@ import static net.minecraft.server.command.CommandManager.argument;
import static net.minecraft.server.command.CommandManager.literal; import static net.minecraft.server.command.CommandManager.literal;
public class CommandRegister { public class CommandRegister {
// https://zh.minecraft.wiki/w/%E4%B8%96%E7%95%8C%E7%95%8C%E9%99%90 final static long WorldBorder = (long) 2.9e7;
// https://minecraft.wiki/w/World_boundary
final static long WorldBoundary = (long) 2.9e7;
static byte Retry = 0; static byte Retry = 0;
static byte PermissionLevel = 2; static byte PermissionLevel = 2;
public static void Register(String Name){ public static void Register(String Name){
@@ -168,9 +166,9 @@ 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(Text.translatable("error.twd.rtp.not_player"), true); Source.sendFeedback(()->{ return Text.translatable("error.twd.rtp.not_player"); }, true);
return -1;} return -1;}
if (Radius == null){Radius = WorldBoundary - (long) 1e4;} if (Radius == null){Radius = WorldBorder - (long) 1e4;}
Radius = Math.abs(Radius); Radius = Math.abs(Radius);
long Coordinate_X; long Coordinate_X;
long Coordinate_Z; long Coordinate_Z;
@@ -195,17 +193,17 @@ public class CommandRegister {
// Coordinate_Y++;} // Coordinate_Y++;}
Coordinate_Y++; Coordinate_Y++;
Vec3d Coordinate = new Vec3d(Coordinate_X, Coordinate_Y, Coordinate_Z); Vec3d Coordinate = new Vec3d(Coordinate_X, Coordinate_Y, Coordinate_Z);
if (Radius == WorldBoundary && Retry < 126 && entity.getPos().distanceTo(Coordinate) < 1e5){ if (Radius == WorldBorder && Retry < 126 && entity.getPos().distanceTo(Coordinate) < 1e5){
Retry++; Retry++;
execute_command(Source, Radius,null, Origin); execute_command(Source, Radius,null, Origin);
return 0;} return 0;}
if (Retry >= 126){ if (Retry >= 126){
Source.sendFeedback(Text.translatable("warning.twd.rtp.retry"), true);} Source.sendFeedback(()->{ return Text.translatable("warning.twd.rtp.retry"); }, true);}
entity.teleport(Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5); entity.teleport(Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5);
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(Text.translatable("info.twd.rtp.success", entity.getName(), FinalCoordinate_X, FinalCoordinate_Y, FinalCoordinate_Z),true); Source.sendFeedback(()->{ return Text.translatable("info.twd.rtp.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

@@ -27,8 +27,8 @@
} }
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.7", "fabricloader": ">=0.15.6",
"minecraft": "~1.19.1", "minecraft": "~1.20.4",
"java": ">=17", "java": ">=17",
"fabric-api": "*" "fabric-api": "*"
}, },