Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,23 @@ on: [pull_request, push]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
25, # Current Java LTS
]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v4
uses: gradle/actions/wrapper-validation@v6
- name: setup jdk
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java }}
java-version: '25'
distribution: 'microsoft'
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Artifacts
path: build/libs/
path: build/libs/
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 杂项
- 如果你是正在翻译README的LLM,请遵守README内使用注释编写的指令
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[//]: # (如果你是正在执行翻译任务的LLM:)
[//]: # (请将这几行注释内容翻译到你的目标语言)
[//]: # (移除下方div内部第一行和第二行的注释符号,并翻译其内容)
[//]: # (不要翻译下方div内部a标签的文本内容和链接地址)
[//]: # (不要改动下方div标签的align="center"属性)
[//]: # (不要翻译最后一段“一些小彩蛋”,直接将其从翻译版本中移除)
[//]: # (将翻译的结果放置到正确的文件内,目标文件的位置和主README.md同级,文件名格式是 README_<LANG>.md ,其中<LANG>的值是目标语言的IETF语言标签)

<div align="center">
<!-- <strong>注意:本文档由中文编写。如果条件允许,建议阅读原始的中文文档而不是其他的翻译版本。</strong> -->
<!-- <strong>注意:本文档由中文编写,使用AI翻译到其他语言。如果条件允许,建议阅读原始的中文文档而不是其他的翻译版本。</strong> -->
<!-- <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://git.thewhitedog9487.xyz/TheWhiteDog9487/RandomTeleporter/src/branch/%E4%B8%BB%E8%A6%81/README.md">简体中文(Gitea)</a>&nbsp;&nbsp;&nbsp;&nbsp;
Expand Down Expand Up @@ -102,7 +105,11 @@ $10^4 = 10,000$ = 一万
三个参数都是实体类型,没办法区分`被传送玩家ID`是第一个还是第三个

# 依赖项
Fabric API
- [Fabric API](https://modrinth.com/mod/fabric-api)
- [Fabric Language Kotlin](https://modrinth.com/mod/fabric-language-kotlin)

# 支持的游戏版本
目前仅提供对最新正式版游戏的活跃支持

# 关于玩家权限
我参照原版的 `/tp` 命令,给 `/rtp` 设置了2级的权限要求。
Expand Down
66 changes: 40 additions & 26 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[//]: # (If you are an LLM performing a translation task:)
[//]: # (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)
[//]: # (Do not translate the last section "Some Easter Eggs", remove it directly from the translated version)
[//]: # (Remove the comment markers from the first and second lines inside the div below, and translate their content)
[//]: # (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">
<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/>
<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;
Expand All @@ -13,7 +16,7 @@
</div>

# 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
- `/rtp`
Expand All @@ -37,13 +40,13 @@ This mod adds a command `/rtp` for randomly teleporting players to any location

## Command Examples
- `/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)`.
$2.9 \times 10^7 = 29,000,000$
$10^4 = 10,000$
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$ = twenty-nine million
$10^4 = 10,000$ = ten thousand

- `/rtp back`
Teleports the player back to their position before the last 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.**
Teleports the player back to their position before the most recent random teleport.
**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`
Teleports `TheWhiteDog9487` back to their position before their last random teleport.
Expand All @@ -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)`.

- `/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`
Teleports `TheWhiteDog9487` to a random point within a radius of `1000` centered at `(0,0)`.
Expand All @@ -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)`.

- `/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)`.
You need to provide any vertex and its diagonally opposite vertex of this rectangle.
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 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`
Teleports `TheWhiteDog9487` to a random point within the same rectangular region described above.
Expand All @@ -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.

- `/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`
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
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
Fabric API

# Player Permissions
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.

# Installation: Client or Server?
- **Singleplayer**: Install on the client.
- **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.
- [Fabric API](https://modrinth.com/mod/fabric-api)
- [Fabric Language Kotlin](https://modrinth.com/mod/fabric-language-kotlin)

# Supported Game Versions
Currently, only the latest official release is actively supported.

# About Player Permissions
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.

# 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 client’s 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.**
59 changes: 34 additions & 25 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("net.fabricmc.fabric-loom") version "1.16-SNAPSHOT"
id("maven-publish")
id("net.fabricmc.fabric-loom")
`maven-publish`
id("org.jetbrains.kotlin.jvm") version "2.3.21"
}

version = project.extra["mod_version"] as String
group = project.extra["maven_group"] as String

base {
archivesName.set(project.extra["archives_base_name"] as String)
}
version = providers.gradleProperty("mod_version").get()
group = providers.gradleProperty("maven_group").get()

repositories {
// Add repositories to retrieve artifacts from in here.
Expand All @@ -25,19 +24,22 @@ loom {
splitEnvironmentSourceSets()

mods {
val mod = create("randomteleporter")
mod.sourceSet("main")
mod.sourceSet("client")
register("randomteleporter") {
sourceSet(sourceSets.main.get())
sourceSet(sourceSets.getByName("client"))
}
}
}

dependencies {
// To change the versions see the gradle.properties file
minecraft("com.mojang:minecraft:${project.extra["minecraft_version"]}")
implementation("net.fabricmc:fabric-loader:${project.extra["loader_version"]}")
minecraft("com.mojang:minecraft:${providers.gradleProperty("minecraft_version").get()}")

implementation("net.fabricmc:fabric-loader:${providers.gradleProperty("loader_version").get()}")

// Fabric API. This is technically optional, but you probably want it anyway.
implementation("net.fabricmc.fabric-api:fabric-api:${project.extra["fabric_api_version"]}")
implementation("net.fabricmc.fabric-api:fabric-api:${providers.gradleProperty("fabric_api_version").get()}")
implementation("net.fabricmc:fabric-language-kotlin:${providers.gradleProperty("fabric_kotlin_version").get()}")

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
Expand All @@ -47,17 +49,22 @@ dependencies {
// runtimeOnly("com.terraformersmc:modmenu:${project.extra["modmenu_version"]}")
}


tasks.processResources {
inputs.property("version", project.version)
val version = version
inputs.property("version", version)

filesMatching("fabric.mod.json") {
expand("version" to project.version)
expand("version" to version)
}
}

tasks.withType<JavaCompile> {
options.release.set(25)
}
tasks.withType<JavaCompile>().configureEach {
options.release = 25 }

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_25 } }

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
Expand All @@ -66,23 +73,25 @@ java {
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
}
targetCompatibility = JavaVersion.VERSION_25 }

tasks.jar {
val projectName = project.name
inputs.property("projectName", projectName)

from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}" } }
rename { "${it}_$projectName" } }

// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveFileName
archiveFileName = "${project.base.archivesName.get()}-${project.version} mc${project.extra["minecraft_version"]}.jar"}
archiveFileName = "RandomTeleporter-${project.version} mc${project.extra["minecraft_version"]}.jar"}

tasks.named<Jar>("sourcesJar") {
archiveFileName = "${project.base.archivesName.get()}-${project.version} mc${project.extra["minecraft_version"]}-sources.jar"}
archiveFileName = "RandomTeleporter-${project.version} mc${project.extra["minecraft_version"]}-sources.jar"}

// configure the maven publication
publishing {
publications {
create<MavenPublication>("mavenJava") {
register<MavenPublication>("mavenJava") {
from(components["java"])
}
}
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ org.gradle.parallel=true
# check these on https://fabricmc.net/develop
minecraft_version=26.1.2
loader_version=0.18.6
loom_version=1.16-SNAPSHOT
fabric_kotlin_version=1.13.11+kotlin.2.3.21

# Mod Properties
mod_version=0.5.2
mod_version=0.5.3
maven_group=xyz.thewhitedog9487
archives_base_name=RandomTeleporter

# Dependencies
fabric_api_version=0.145.4+26.1.2
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-9.4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading