小调整

下个版本我想把传送回溯的持久化给做了,先等等吧,还有几个小时26.2正式版就发了
This commit is contained in:
TheWhiteDog9487
2026-06-16 17:26:37 +08:00
parent f83911a27e
commit 4f28e84e90
5 changed files with 52 additions and 30 deletions

View File

@@ -1,10 +1,13 @@
[//]: # (如果你是正在执行翻译任务的LLM) [//]: # (如果你是正在执行翻译任务的LLM)
[//]: # (请将这几行注释内容翻译到你的目标语言) [//]: # (请将这几行注释内容翻译到你的目标语言)
[//]: # (移除下方div内部第一行和第二行的注释符号并翻译其内容) [//]: # (移除下方div内部第一行和第二行的注释符号并翻译其内容)
[//]: # (不要翻译下方div内部a标签的文本内容和链接地址)
[//]: # (不要改动下方div标签的align="center"属性)
[//]: # (不要翻译最后一段“一些小彩蛋”,直接将其从翻译版本中移除) [//]: # (不要翻译最后一段“一些小彩蛋”,直接将其从翻译版本中移除)
[//]: # (将翻译的结果放置到正确的文件内目标文件的位置和主README.md同级文件名格式是 README_<LANG>.md ,其中<LANG>的值是目标语言的IETF语言标签)
<div align="center"> <div align="center">
<!-- <strong>注意:本文档由中文编写。如果条件允许,建议阅读原始的中文文档而不是其他的翻译版本。</strong> --> <!-- <strong>注意:本文档由中文编写使用AI翻译到其他语言。如果条件允许,建议阅读原始的中文文档而不是其他的翻译版本。</strong> -->
<!-- <br/> --> <!-- <br/> -->
<a href="https://github.com/TheWhiteDog9487/RandomTeleporter/blob/%E4%B8%BB%E8%A6%81/README.md">简体中文GitHub</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://github.com/TheWhiteDog9487/RandomTeleporter/blob/%E4%B8%BB%E8%A6%81/README.md">简体中文GitHub</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/RandomTeleporter/src/branch/%E4%B8%BB%E8%A6%81/README.md">简体中文Gitea</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/RandomTeleporter/src/branch/%E4%B8%BB%E8%A6%81/README.md">简体中文Gitea</a>&nbsp;&nbsp;&nbsp;&nbsp;
@@ -102,7 +105,11 @@ $10^4 = 10,000$ = 一万
三个参数都是实体类型,没办法区分`被传送玩家ID`是第一个还是第三个 三个参数都是实体类型,没办法区分`被传送玩家ID`是第一个还是第三个
# 依赖项 # 依赖项
Fabric API - [Fabric API](https://modrinth.com/mod/fabric-api)
- [Fabric Language Kotlin](https://modrinth.com/mod/fabric-language-kotlin)
# 支持的游戏版本
目前仅提供对最新正式版游戏的活跃支持
# 关于玩家权限 # 关于玩家权限
我参照原版的 `/tp` 命令,给 `/rtp` 设置了2级的权限要求。 我参照原版的 `/tp` 命令,给 `/rtp` 设置了2级的权限要求。

View File

@@ -1,10 +1,13 @@
[//]: # (If you are an LLM performing a translation task:) [//]: # (If you are an LLM performing a translation task:)
[//]: # (Please translate these comment lines into your target language) [//]: # (Please translate these comment lines into your target language)
[//]: # (Remove the comment symbols from the first and second lines inside the <div> below, and translate their content) [//]: # (Remove the comment markers from the first and second lines inside the div below, and translate their content)
[//]: # (Do not translate the last section "Some Easter Eggs", remove it directly from the translated version) [//]: # (Do not translate the text or links of the a tags inside the div below)
[//]: # (Do not change the align="center" attribute of the div below)
[//]: # (Do not translate the final “Some Easter Eggs” section; remove it directly from the translated version)
[//]: # (Place the translated result in the correct file, alongside the main README.md, using the filename format README_<LANG>.md, where <LANG> is the IETF language tag of the target language)
<div align="center"> <div align="center">
<strong>Note: This document is written in Chinese. If circumstances permit, it's recommended to read the original Chinese documentation instead of other translated versions.</strong> <strong>Note: This document was originally written in Chinese and translated into other languages using AI. If circumstances permit, it's recommended to read the original Chinese documentation instead of other translated versions.</strong>
<br/> <br/>
<a href="https://github.com/TheWhiteDog9487/RandomTeleporter/blob/%E4%B8%BB%E8%A6%81/README.md">简体中文GitHub</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://github.com/TheWhiteDog9487/RandomTeleporter/blob/%E4%B8%BB%E8%A6%81/README.md">简体中文GitHub</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/RandomTeleporter/src/branch/%E4%B8%BB%E8%A6%81/README.md">简体中文Gitea</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/RandomTeleporter/src/branch/%E4%B8%BB%E8%A6%81/README.md">简体中文Gitea</a>&nbsp;&nbsp;&nbsp;&nbsp;
@@ -13,7 +16,7 @@
</div> </div>
# Introduction # Introduction
This mod adds a command `/rtp` for randomly teleporting players to any location in the world. This mod adds a command, `/rtp`, which randomly teleports players to any location in the world.
# Command Formats # Command Formats
- `/rtp` - `/rtp`
@@ -37,13 +40,13 @@ This mod adds a command `/rtp` for randomly teleporting players to any location
## Command Examples ## Command Examples
- `/rtp` - `/rtp`
Teleports the player executing the command to a random point within a radius of $2.9 \times 10^7 - 10^4$ centered at `(0,0)`. Teleports the player executing the command to a random point within the area centered at `(0,0)` with a random radius of $2.9 \times 10^7 - 10^4$.
$2.9 \times 10^7 = 29,000,000$ $2.9 \times 10^7 = 29,000,000$ = twenty-nine million
$10^4 = 10,000$ $10^4 = 10,000$ = ten thousand
- `/rtp back` - `/rtp back`
Teleports the player back to their position before the last random teleport. Teleports the player back to their position before the most recent random teleport.
**Note: The previous position information is only stored during the game (server) session and will be lost after the game (server) is closed.** **Note: The previous-position information saved by this feature exists only while the game (server) is running. It will be lost after the game (server) is closed.**
- `/rtp back TheWhiteDog9487` - `/rtp back TheWhiteDog9487`
Teleports `TheWhiteDog9487` back to their position before their last random teleport. Teleports `TheWhiteDog9487` back to their position before their last random teleport.
@@ -55,7 +58,7 @@ Teleports `TheWhiteDog9487` back to their position before their last random tele
Teleports the player to a random point within a radius of `1000` centered at `(0,0)`. Teleports the player to a random point within a radius of `1000` centered at `(0,0)`.
- `/rtp TheWhiteDog9487` - `/rtp TheWhiteDog9487`
Teleports `TheWhiteDog9487` to a random point within a radius of $2.9 \times 10^7 - 10^4$ centered at `(0,0)`. Teleports `TheWhiteDog9487` to a random point within the area centered at `(0,0)` with a random radius of $2.9 \times 10^7 - 10^4$.
- `/rtp TheWhiteDog9487 1000` - `/rtp TheWhiteDog9487 1000`
Teleports `TheWhiteDog9487` to a random point within a radius of `1000` centered at `(0,0)`. Teleports `TheWhiteDog9487` to a random point within a radius of `1000` centered at `(0,0)`.
@@ -79,8 +82,8 @@ Teleports `TheWhiteDog9487` to a random point within a radius of `1000` centered
Teleports `TheWhiteDog9487` to a random point within a radius of `1000` centered at `(10000,10000)`. Teleports `TheWhiteDog9487` to a random point within a radius of `1000` centered at `(10000,10000)`.
- `/rtp 10000.0 10000.0 20000.0 20000.0` - `/rtp 10000.0 10000.0 20000.0 20000.0`
Teleports the player to a random point within a rectangular region formed by vertices `(10000,10000)`, `(20000,10000)`, `(20000,20000)`, and `(10000,20000)`. Teleports the player to a random point within the rectangular region formed by the vertices `(10000,10000)`, `(20000,10000)`, `(20000,20000)`, and `(10000,20000)`.
You need to provide any vertex and its diagonally opposite vertex of this rectangle. You only need to provide any one vertex of the rectangle and the diagonally opposite vertex.
- `/rtp TheWhiteDog9487 10000.0 10000.0 20000.0 20000.0` - `/rtp TheWhiteDog9487 10000.0 10000.0 20000.0 20000.0`
Teleports `TheWhiteDog9487` to a random point within the same rectangular region described above. Teleports `TheWhiteDog9487` to a random point within the same rectangular region described above.
@@ -89,23 +92,34 @@ Teleports `TheWhiteDog9487` to a random point within the same rectangular region
Teleports `TheWhiteDog9487` to a random point within the same rectangular region described above. Teleports `TheWhiteDog9487` to a random point within the same rectangular region described above.
- `/rtp TheWhiteDog9487 TheWhiteDog_CN` - `/rtp TheWhiteDog9487 TheWhiteDog_CN`
Teleports the command executor to a random point within a rectangular region where `TheWhiteDog9487` and `TheWhiteDog_CN`'s current positions are diagonals. Teleports the command executor to a random point within a rectangular region whose diagonals are the current positions of `TheWhiteDog9487` and `TheWhiteDog_CN`.
- `/rtp TheWhiteDog9487 TheWhiteDog_CN TheWhiteDog4568` - `/rtp TheWhiteDog9487 TheWhiteDog_CN TheWhiteDog4568`
Teleports `TheWhiteDog4568` to a random point within a rectangular region where `TheWhiteDog9487` and `TheWhiteDog_CN`'s current positions are diagonals. Teleports `TheWhiteDog4568` to a random point within a rectangular region whose diagonals are the current positions of `TheWhiteDog9487` and `TheWhiteDog_CN`.
### Special Notes ### Special Notes
The format `/rtp <Radius> <OriginEntity>` does not exist because the second parameter could be either the teleported player's name or the entity serving as the random center. Both are entity types, leading to ambiguity. Similarly, `/rtp <PlayerID> <RegionFromEntity> <RegionToEntity>` is also absent as all three parameters are entity types, making it impossible to distinguish the player ID. The format `/rtp <Radius> <OriginEntity>` does not exist because the second parameter could be either the teleported player's name or the entity used as the random center. Both are entity types, so there is no way to tell which one it is. Likewise, `/rtp <PlayerID> <RegionFromEntity> <RegionToEntity>` does not exist either, because all three parameters are entity types, making it impossible to determine which one is the player ID.
# Dependencies # Dependencies
Fabric API - [Fabric API](https://modrinth.com/mod/fabric-api)
- [Fabric Language Kotlin](https://modrinth.com/mod/fabric-language-kotlin)
# Player Permissions # Supported Game Versions
Following the standard `/tp` command, `/rtp` requires a permission level of `2`. For vanilla or vanilla-like servers, players only need "cheats" enabled. For plugin-based servers, specific permission management depends on your setup. Currently, only the latest official release is actively supported.
# Installation: Client or Server? # About Player Permissions
- **Singleplayer**: Install on the client. Following the vanilla `/tp` command, `/rtp` is set to require permission level `2`. In vanilla or vanilla-like environments, players only need cheat permissions enabled to use it. As for plugin servers, I do not have enough firsthand experience to give specific advice about permission setup.
- **Singleplayer + Open to LAN**: Install on the host client. Other players do not need to install it.
- **Dedicated Server**: Install on the server. Clients do not strictly need to install it.
**Note**: In multiplayer scenarios, if clients do not have the mod installed, they will see command feedback in the server's default language (currently Chinese). Installing the mod on both sides is recommended for full multi-language support. # Install on the Client or on the Server?
It depends on the case:
1. Singleplayer
1. There is no physical server, so the server side does not matter.
2. Installing it on the client is enough.
2. Singleplayer + Open to LAN
1. This uses the clients built-in server, so the player who opens the LAN world needs the mod installed on their client.
2. Other players who join do not need to install it.
3. Dedicated server (something like a `server.jar` file)
1. The server needs the mod installed.
2. Clients do not need it.
**Note: In cases 2 and 3, if other players do not install this mod, they will not be able to see the command feedback in the correct translated language, and the default display in that case is Chinese text. If you need to view multilingual translation text, it is probably best for everyone to install it.**

View File

@@ -10,7 +10,7 @@ loom_version=1.16-SNAPSHOT
fabric_kotlin_version=1.13.11+kotlin.2.3.21 fabric_kotlin_version=1.13.11+kotlin.2.3.21
# Mod Properties # Mod Properties
mod_version=0.5.2 mod_version=0.5.3
maven_group=xyz.thewhitedog9487 maven_group=xyz.thewhitedog9487
# Dependencies # Dependencies

View File

@@ -37,7 +37,7 @@ val TargetBlock = Blocks.GLASS
* <br></br> * <br></br>
* 替换范围:替换中心周围半径为一的正方形区域 * 替换范围:替换中心周围半径为一的正方形区域
*/ */
val ReplaceToTargetBlock = setOf<Block?>( val ReplaceToTargetBlock = setOf(
Blocks.AIR, Blocks.AIR,
Blocks.VOID_AIR, Blocks.VOID_AIR,
Blocks.CAVE_AIR, Blocks.CAVE_AIR,
@@ -66,7 +66,7 @@ val PermissionLevel = Commands.LEVEL_GAMEMASTERS
/** /**
* 在传送之前记录当前位置,以支持传送回去 * 在传送之前记录当前位置,以支持传送回去
*/ */
var OldPositions: MutableMap<UUID, Vec3> = HashMap<UUID, Vec3>() var OldPositions: MutableMap<UUID, Vec3> = mutableMapOf()
/** /**
* 命令执行失败时的返回值 * 命令执行失败时的返回值

View File

@@ -4,8 +4,9 @@ import net.fabricmc.api.ModInitializer
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
const val ModID: String = "randomteleporter" const val ModID = "randomteleporter"
val ModLogger: Logger = LoggerFactory.getLogger(ModID) const val FriendlyModID = "RandomTeleporter"
val ModLogger: Logger = LoggerFactory.getLogger(FriendlyModID)
object RandomTeleporter : ModInitializer { object RandomTeleporter : ModInitializer {