mirror of
https://github.com/TheWhiteDog9487/RandomTeleporter.git
synced 2025-09-16 05:06:59 +00:00
Compare commits
3 Commits
1.19.1
...
3d23f397f7
Author | SHA1 | Date | |
---|---|---|---|
3d23f397f7 | |||
6eb98f1f94 | |||
8186159653 |
13
README.md
13
README.md
@@ -15,14 +15,15 @@
|
|||||||
|
|
||||||
## 命令示例
|
## 命令示例
|
||||||
- /rtp
|
- /rtp
|
||||||
将执行命令的玩家随机传送到以(0,0)为中心点,2.9e7作为随机半径的范围内的随机一点
|
将执行命令的玩家随机传送到以(0,0)为中心点,2.9e7 - 1e4作为随机半径的范围内的随机一点
|
||||||
2.9e+7 = 2.9 x 10^7 = 29000000 = 两千九百万
|
2.9e+7 = 2.9 x 10^7 = 29000000 = 两千九百万
|
||||||
|
1e4 = 10^4 = 10000 = 一万
|
||||||
|
|
||||||
- /rtp 1000
|
- /rtp 1000
|
||||||
将执行命令的玩家随机传送到以(0,0)为中心点,1000作为随机半径的范围内的随机一点
|
将执行命令的玩家随机传送到以(0,0)为中心点,1000作为随机半径的范围内的随机一点
|
||||||
|
|
||||||
- /rtp TheWhiteDog9487
|
- /rtp TheWhiteDog9487
|
||||||
将TheWhiteDog9487随机传送到以(0,0)为中心点,2.9e7作为随机半径的范围内的随机一点
|
将TheWhiteDog9487随机传送到以(0,0)为中心点,2.9e7 - 1e4作为随机半径的范围内的随机一点
|
||||||
|
|
||||||
- /rtp TheWhiteDog9487 1000
|
- /rtp TheWhiteDog9487 1000
|
||||||
将TheWhiteDog9487随机传送到以(0,0)为中心点,1000作为随机半径的范围内的随机一点
|
将TheWhiteDog9487随机传送到以(0,0)为中心点,1000作为随机半径的范围内的随机一点
|
||||||
@@ -56,7 +57,7 @@
|
|||||||
由于我使用了fabric.api.command.v2中的CommandRegistrationCallback.EVENT来向游戏注册命令,所以这个模组需要依赖Fabric API
|
由于我使用了fabric.api.command.v2中的CommandRegistrationCallback.EVENT来向游戏注册命令,所以这个模组需要依赖Fabric API
|
||||||
|
|
||||||
# 关于玩家权限
|
# 关于玩家权限
|
||||||
我参照原版的 /tp 命令,给 /rtp 设置了4级的权限要求。
|
我参照原版的 /tp 命令,给 /rtp 设置了2级的权限要求。
|
||||||
如果是原版或者类原版,你只需要让玩家有作弊的权限就可以用。
|
如果是原版或者类原版,你只需要让玩家有作弊的权限就可以用。
|
||||||
插件服务器方面那些具体的权限分配,因为我自己没玩过所以我也没法给出参考意见。
|
插件服务器方面那些具体的权限分配,因为我自己没玩过所以我也没法给出参考意见。
|
||||||
|
|
||||||
@@ -72,6 +73,10 @@
|
|||||||
1. 服务器需要安装
|
1. 服务器需要安装
|
||||||
2. 客户端不需要
|
2. 客户端不需要
|
||||||
|
|
||||||
|
**注意:情况2和3,虽然其他玩家不需要安装本模组就能使用功能。但是由于命令执行后的反馈结果文字使用了翻译,如果其他玩家没有安装模组会导致显示不正常,玩家会直接看到翻译键而不是对应的文字。
|
||||||
|
因此,虽然可以但不建议其他人不安装。
|
||||||
|
能安装的话还是都装一下吧。**
|
||||||
|
|
||||||
# 一些小彩蛋
|
# 一些小彩蛋
|
||||||
你可以使用 /随机传送 来替代 /rtp
|
你可以使用 /随机传送 来替代 /rtp
|
||||||
没错,Minecraft的命令是可以存在非ASCII字符的,所以我就整了一个
|
没错,Minecraft的命令是可以存在非ASCII字符的,所以我就整了一个
|
||||||
@@ -80,4 +85,4 @@
|
|||||||
- /随机传送 TheWhiteDog9487 1000
|
- /随机传送 TheWhiteDog9487 1000
|
||||||
|
|
||||||
这两个命令的效果没有任何差别
|
这两个命令的效果没有任何差别
|
||||||
玩家权限限制和 /rtp 当然也是一样的,都是4级
|
玩家权限限制和 /rtp 当然也是一样的,都是2级
|
10
build.gradle
10
build.gradle
@@ -1,9 +1,9 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.5-SNAPSHOT'
|
id 'fabric-loom' version '1.7-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = project.mod_version
|
version = project.mod_version + " mc$project.minecraft_version"
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
base {
|
base {
|
||||||
@@ -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 {
|
||||||
|
@@ -4,20 +4,20 @@ 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.9
|
||||||
loader_version=0.15.6
|
loader_version=0.15.11
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=0.2.4
|
mod_version=0.3.1
|
||||||
maven_group=xyz.thewhitedog9487
|
maven_group=xyz.thewhitedog9487
|
||||||
archives_base_name=randomteleporter
|
archives_base_name=randomteleporter
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.95.4+1.20.4
|
fabric_version=0.102.0+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/
|
||||||
loom_version_manifests=https://bmclapi2.bangbang93.com/mc/game/version_manifest.json
|
loom_version_manifests=https://bmclapi2.bangbang93.com/mc/game/version_manifest.json
|
||||||
loom_experimental_versions=https://maven.fabricmc.net/net/minecraft/experimental_versions.json
|
loom_experimental_versions=https://maven.fabricmc.net/net/minecraft/experimental_versions.json
|
||||||
loom_fabric_repository=https://repository.hanbings.io/proxy/
|
# loom_fabric_repository=https://repository.hanbings.io/proxy/
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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.9-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"required": false,
|
"required": false,
|
||||||
"package": "xyz.thewhitedog9487.mixin.client",
|
"package": "xyz.thewhitedog9487.mixin.client",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"client": [
|
"client": [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@@ -12,21 +12,21 @@ 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;
|
||||||
import static net.minecraft.server.command.CommandManager.literal;
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
import static xyz.thewhitedog9487.Toolbox.Distance;
|
|
||||||
|
|
||||||
public class CommandRegister {
|
public class CommandRegister {
|
||||||
final static long WorldBorder = (long) 2.9e7;
|
final static long WorldBorder = (long) 2.9e7;
|
||||||
static byte Retry = 0;
|
static byte PermissionLevel = 2;
|
||||||
public static void Register(String Name){
|
public static void Register(String Name){
|
||||||
// /rtp
|
// /rtp
|
||||||
CommandRegistrationCallback.EVENT
|
CommandRegistrationCallback.EVENT
|
||||||
.register((dispatcher, registryAccess, environment) ->{
|
.register((dispatcher, registryAccess, environment) ->{
|
||||||
dispatcher.register(literal(Name)
|
dispatcher.register(literal(Name)
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command(
|
.executes(context -> execute_command(
|
||||||
context.getSource(),null,null, null)));});
|
context.getSource(),null,null, null)));});
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public class CommandRegister {
|
|||||||
.register((dispatcher, registryAccess, environment) -> {
|
.register((dispatcher, registryAccess, environment) -> {
|
||||||
dispatcher.register(literal(Name)
|
dispatcher.register(literal(Name)
|
||||||
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command(
|
.executes(context -> execute_command(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
@@ -47,7 +47,7 @@ public class CommandRegister {
|
|||||||
.register((dispatcher, registryAccess, environment) -> {
|
.register((dispatcher, registryAccess, environment) -> {
|
||||||
dispatcher.register(literal(Name)
|
dispatcher.register(literal(Name)
|
||||||
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command(
|
.executes(context -> execute_command(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
null,
|
null,
|
||||||
@@ -60,7 +60,7 @@ public class CommandRegister {
|
|||||||
dispatcher.register(literal(Name)
|
dispatcher.register(literal(Name)
|
||||||
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command(
|
.executes(context -> execute_command(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
@@ -73,7 +73,7 @@ public class CommandRegister {
|
|||||||
dispatcher.register(literal(Name)
|
dispatcher.register(literal(Name)
|
||||||
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
||||||
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command(
|
.executes(context -> execute_command(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
@@ -86,7 +86,7 @@ public class CommandRegister {
|
|||||||
// dispatcher.register(literal(Name)
|
// dispatcher.register(literal(Name)
|
||||||
// .then(argument("Radius(半径)", LongArgumentType.longArg())
|
// .then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
// .then(argument("Origin(随机中心)",EntityArgumentType.player())
|
// .then(argument("Origin(随机中心)",EntityArgumentType.player())
|
||||||
// .requires(source -> source.hasPermissionLevel(4))
|
// .requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
// .executes(context -> execute_command_origin(
|
// .executes(context -> execute_command_origin(
|
||||||
// context.getSource(),
|
// context.getSource(),
|
||||||
// LongArgumentType.getLong(context, "Radius(半径)"),
|
// LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
@@ -98,7 +98,7 @@ public class CommandRegister {
|
|||||||
dispatcher.register(literal(Name)
|
dispatcher.register(literal(Name)
|
||||||
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
.then(argument("OriginPos(随机中心,坐标)",Vec3ArgumentType.vec3())
|
.then(argument("OriginPos(随机中心,坐标)",Vec3ArgumentType.vec3())
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command(
|
.executes(context -> execute_command(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
@@ -112,7 +112,7 @@ public class CommandRegister {
|
|||||||
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
||||||
.then(argument("OriginEntity(随机中心,实体)",EntityArgumentType.entity())
|
.then(argument("OriginEntity(随机中心,实体)",EntityArgumentType.entity())
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command_origin(
|
.executes(context -> execute_command_origin(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
@@ -126,7 +126,7 @@ public class CommandRegister {
|
|||||||
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
||||||
.then(argument("OriginPos(随机中心,坐标)",Vec3ArgumentType.vec3())
|
.then(argument("OriginPos(随机中心,坐标)",Vec3ArgumentType.vec3())
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command(
|
.executes(context -> execute_command(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
@@ -140,7 +140,7 @@ public class CommandRegister {
|
|||||||
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
||||||
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
.then(argument("OriginEntity(随机中心,实体)",EntityArgumentType.entity())
|
.then(argument("OriginEntity(随机中心,实体)",EntityArgumentType.entity())
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command_origin(
|
.executes(context -> execute_command_origin(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
@@ -154,7 +154,7 @@ public class CommandRegister {
|
|||||||
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
.then(argument("被传送玩家名(PlayerID)", EntityArgumentType.entity())
|
||||||
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
.then(argument("OriginPos(随机中心,坐标)",Vec3ArgumentType.vec3())
|
.then(argument("OriginPos(随机中心,坐标)",Vec3ArgumentType.vec3())
|
||||||
.requires(source -> source.hasPermissionLevel(4))
|
.requires(source -> source.hasPermissionLevel(PermissionLevel))
|
||||||
.executes(context -> execute_command(
|
.executes(context -> execute_command(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
@@ -166,7 +166,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);
|
||||||
@@ -186,20 +186,17 @@ public class CommandRegister {
|
|||||||
;Coordinate_Y--){}
|
;Coordinate_Y--){}
|
||||||
if (Blocks.WATER == Source.getWorld().getBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getBlock() ||
|
if (Blocks.WATER == Source.getWorld().getBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getBlock() ||
|
||||||
Blocks.LAVA == Source.getWorld().getBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getBlock()){
|
Blocks.LAVA == Source.getWorld().getBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getBlock()){
|
||||||
Source.getWorld().setBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z)), Blocks.STONE.getDefaultState());}
|
for (int x = -1; x <= 1; x++) {
|
||||||
|
for (int z = -1; z <= 1; z++) {
|
||||||
|
Source.getWorld().setBlockState(new BlockPos(Math.toIntExact(Coordinate_X - x), Coordinate_Y, Math.toIntExact(Coordinate_Z - z)), 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") ) {
|
||||||
// Coordinate_Y++;}
|
// Coordinate_Y++;}
|
||||||
Coordinate_Y++;
|
Coordinate_Y++;
|
||||||
Vec3d Coordinate = new Vec3d(Coordinate_X, Coordinate_Y, Coordinate_Z);
|
entity.teleport(Source.getWorld(),Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5, new HashSet<>(), entity.getYaw(), entity.getPitch());
|
||||||
if (Radius == WorldBorder && Retry < 126 && Distance(entity.getPos(), Coordinate) < 1e5){
|
final long FinalCoordinate_X = Coordinate_X;
|
||||||
Retry++;
|
|
||||||
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, Coordinate_Y, Coordinate_Z);
|
|
||||||
final int FinalCoordinate_Y = Coordinate_Y;
|
final int FinalCoordinate_Y = Coordinate_Y;
|
||||||
Source.sendFeedback(()->{ return Text.translatable("info.twd.rtp.success", entity.getName(), Coordinate_X, FinalCoordinate_Y, Coordinate_Z); },true);
|
final long FinalCoordinate_Z = Coordinate_Z;
|
||||||
|
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());}
|
||||||
|
@@ -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!");
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,10 +0,0 @@
|
|||||||
package xyz.thewhitedog9487;
|
|
||||||
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
|
|
||||||
public class Toolbox {
|
|
||||||
static public double Distance(Vec3d A, Vec3d B){
|
|
||||||
return Math.sqrt(
|
|
||||||
Math.pow(A.getX() - B.getX(), 2) +
|
|
||||||
Math.pow(A.getY() - B.getY(), 2));}
|
|
||||||
}
|
|
@@ -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"
|
||||||
}
|
}
|
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"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": "重试次数过大,为避免死循环将在本次传送中取消距离保护",
|
"bilibili": "TheWhiteDog9487的哔哩哔哩主页",
|
||||||
"twd.bilibili": "哔哩哔哩主页",
|
"blog": "TheWhiteDog9487的博客"
|
||||||
"twd.blog": "TheWhiteDog9487的博客"
|
|
||||||
}
|
}
|
@@ -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": {
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"custom": {
|
"custom": {
|
||||||
"modmenu": {
|
"modmenu": {
|
||||||
"links": {
|
"links": {
|
||||||
"twd.bilibili": "https://space.bilibili.com/401746666",
|
"bilibili": "https://space.bilibili.com/401746666",
|
||||||
"twd.blog": "www.thewhitedog9487.xyz"},
|
"blog": "www.thewhitedog9487.xyz"},
|
||||||
"update_checker": true}}
|
"update_checker": true}}
|
||||||
}
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"required": false,
|
"required": false,
|
||||||
"package": "xyz.thewhitedog9487.mixin",
|
"package": "xyz.thewhitedog9487.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user