mirror of
https://github.com/TheWhiteDog9487/RandomTeleporter.git
synced 2025-09-15 23:36:59 +00:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
3434b66c93 |
@@ -73,10 +73,6 @@
|
|||||||
1. 服务器需要安装
|
1. 服务器需要安装
|
||||||
2. 客户端不需要
|
2. 客户端不需要
|
||||||
|
|
||||||
**注意:情况2和3,虽然其他玩家不需要安装本模组就能使用功能。但是由于命令执行后的反馈结果文字使用了翻译,如果其他玩家没有安装模组会导致显示不正常,玩家会直接看到翻译键而不是对应的文字。
|
|
||||||
因此,虽然可以但不建议其他人不安装。
|
|
||||||
能安装的话还是都装一下吧。**
|
|
||||||
|
|
||||||
# 一些小彩蛋
|
# 一些小彩蛋
|
||||||
你可以使用 /随机传送 来替代 /rtp
|
你可以使用 /随机传送 来替代 /rtp
|
||||||
没错,Minecraft的命令是可以存在非ASCII字符的,所以我就整了一个
|
没错,Minecraft的命令是可以存在非ASCII字符的,所以我就整了一个
|
||||||
|
91
build.gradle
Normal file
91
build.gradle
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
plugins {
|
||||||
|
id 'fabric-loom' version '1.5-SNAPSHOT'
|
||||||
|
id 'maven-publish'
|
||||||
|
}
|
||||||
|
|
||||||
|
version = project.mod_version
|
||||||
|
group = project.maven_group
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = project.archives_base_name
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
// Add repositories to retrieve artifacts from in here.
|
||||||
|
// You should only use this when depending on other mods because
|
||||||
|
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||||
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||||
|
// for more information about repositories.
|
||||||
|
}
|
||||||
|
|
||||||
|
loom {
|
||||||
|
splitEnvironmentSourceSets()
|
||||||
|
|
||||||
|
mods {
|
||||||
|
"randomteleporter" {
|
||||||
|
sourceSet sourceSets.main
|
||||||
|
sourceSet sourceSets.client
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// To change the versions see the gradle.properties file
|
||||||
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
inputs.property "version", project.version
|
||||||
|
|
||||||
|
filesMatching("fabric.mod.json") {
|
||||||
|
expand "version": project.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
it.options.release = 17
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||||
|
// if it is present.
|
||||||
|
// If you remove this line, sources will not be generated.
|
||||||
|
withSourcesJar()
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
from("LICENSE") {
|
||||||
|
rename { "${it}_${project.base.archivesName.get()}"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// configure the maven publication
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||||
|
repositories {
|
||||||
|
// Add repositories to publish to here.
|
||||||
|
// Notice: This block does NOT have the same function as the block in the top level.
|
||||||
|
// The repositories here will be used for publishing your artifact, not for
|
||||||
|
// retrieving dependencies.
|
||||||
|
}
|
||||||
|
}
|
102
build.gradle.kts
102
build.gradle.kts
@@ -1,102 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("fabric-loom") version "1.8-SNAPSHOT"
|
|
||||||
id("maven-publish")
|
|
||||||
}
|
|
||||||
|
|
||||||
version = "${project.extra["mod_version"]}"
|
|
||||||
group = project.extra["maven_group"] as String
|
|
||||||
|
|
||||||
base {
|
|
||||||
archivesName.set(project.extra["archives_base_name"] as String)
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
// Add repositories to retrieve artifacts from in here.
|
|
||||||
// You should only use this when depending on other mods because
|
|
||||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
|
||||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
|
||||||
// for more information about repositories.
|
|
||||||
maven {
|
|
||||||
name = "Terraformers"
|
|
||||||
url = uri("https://maven.terraformersmc.com/") }
|
|
||||||
}
|
|
||||||
|
|
||||||
loom {
|
|
||||||
splitEnvironmentSourceSets()
|
|
||||||
|
|
||||||
mods {
|
|
||||||
create("randomteleporter") {
|
|
||||||
sourceSet(sourceSets["main"])
|
|
||||||
sourceSet(sourceSets["client"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// To change the versions see the gradle.properties file
|
|
||||||
minecraft("com.mojang:minecraft:${project.extra["minecraft_version"]}")
|
|
||||||
mappings("net.fabricmc:yarn:${project.extra["yarn_mappings"]}:v2")
|
|
||||||
modImplementation("net.fabricmc:fabric-loader:${project.extra["loader_version"]}")
|
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
|
||||||
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.extra["fabric_version"]}")
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
// "modImplementation"("net.fabricmc.fabric-api:fabric-api-deprecated:${project.extra["fabric_version"]}")
|
|
||||||
|
|
||||||
// ↓ 开发测试用
|
|
||||||
modRuntimeOnly("com.terraformersmc:modmenu:${project.extra["modmenu_version"]}")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.processResources {
|
|
||||||
inputs.property("version", project.version)
|
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
|
||||||
expand("version" to project.version)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
options.release.set(21)
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
|
||||||
// if it is present.
|
|
||||||
// If you remove this line, sources will not be generated.
|
|
||||||
withSourcesJar()
|
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_21
|
|
||||||
targetCompatibility = JavaVersion.VERSION_21
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.jar {
|
|
||||||
from("LICENSE") {
|
|
||||||
rename { "${it}_${project.base.archivesName.get()}" } }
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.remapJar{
|
|
||||||
// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveFileName
|
|
||||||
// 用这个属性设置jar包的文件名格式
|
|
||||||
// 别用上面那个Jar任务的配置,会被remapJar覆盖掉
|
|
||||||
archiveFileName = "${project.base.archivesName.get()}-${project.version} mc${project.extra["minecraft_version"]}.jar"}
|
|
||||||
tasks.remapSourcesJar{
|
|
||||||
archiveFileName = "${project.base.archivesName.get()}-${project.version} mc${project.extra["minecraft_version"]}-sources.jar"}
|
|
||||||
|
|
||||||
// configure the maven publication
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
create<MavenPublication>("mavenJava") {
|
|
||||||
from(components["java"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
|
||||||
repositories {
|
|
||||||
// Add repositories to publish to here.
|
|
||||||
// Notice: This block does NOT have the same function as the block in the top level.
|
|
||||||
// The repositories here will be used for publishing your artifact, not for
|
|
||||||
// retrieving dependencies.
|
|
||||||
}
|
|
||||||
}
|
|
@@ -4,24 +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.21.2
|
minecraft_version=1.19.1
|
||||||
yarn_mappings=1.21.2+build.1
|
yarn_mappings=1.19.1+build.6
|
||||||
loader_version=0.16.7
|
loader_version=0.15.7
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=0.3.2
|
mod_version=0.2.5
|
||||||
maven_group=xyz.thewhitedog9487
|
maven_group=xyz.thewhitedog9487
|
||||||
archives_base_name=randomteleporter
|
archives_base_name=randomteleporter
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.106.1+1.21.2
|
fabric_version=0.58.5+1.19.1
|
||||||
|
|
||||||
# https://modrinth.com/mod/modmenu/versions
|
loom_libraries_base=https://bmclapi2.bangbang93.com/maven/
|
||||||
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
|
loom_resources_base=https://bmclapi2.bangbang93.com/assets/
|
||||||
modmenu_version=12.0.0-beta.1
|
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_libraries_base=https://bmclapi2.bangbang93.com/maven/
|
loom_fabric_repository=https://repository.hanbings.io/proxy/
|
||||||
# loom_resources_base=https://bmclapi2.bangbang93.com/assets/
|
|
||||||
# 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_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.10-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
11
settings.gradle
Normal file
11
settings.gradle
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'Fabric'
|
||||||
|
url = 'https://maven.aliyun.com/repository/gradle-plugin'
|
||||||
|
url = 'https://maven.fabricmc.net/'
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
@@ -1,9 +0,0 @@
|
|||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = "Fabric"
|
|
||||||
url = uri("https://maven.fabricmc.net/") }
|
|
||||||
mavenCentral()
|
|
||||||
gradlePluginPortal()
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"required": false,
|
"required": false,
|
||||||
"package": "xyz.thewhitedog9487.mixin.client",
|
"package": "xyz.thewhitedog9487.mixin.client",
|
||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"client": [
|
"client": [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@@ -12,14 +12,16 @@ 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;
|
||||||
|
|
||||||
public class CommandRegister {
|
public class CommandRegister {
|
||||||
final static long WorldBorder = (long) 2.9e7;
|
// https://zh.minecraft.wiki/w/%E4%B8%96%E7%95%8C%E7%95%8C%E9%99%90
|
||||||
|
// https://minecraft.wiki/w/World_boundary
|
||||||
|
final static long WorldBoundary = (long) 2.9e7;
|
||||||
|
static byte Retry = 0;
|
||||||
static byte PermissionLevel = 2;
|
static byte PermissionLevel = 2;
|
||||||
public static void Register(String Name){
|
public static void Register(String Name){
|
||||||
// /rtp
|
// /rtp
|
||||||
@@ -113,11 +115,11 @@ public class CommandRegister {
|
|||||||
.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 -> execute_command_origin(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
|
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
|
||||||
EntityArgumentType.getEntity(context,"OriginEntity(随机中心,实体)").getPos()))))));});
|
EntityArgumentType.getEntity(context,"OriginEntity(随机中心,实体)")))))));});
|
||||||
|
|
||||||
// /rtp <Radius(半径)> <被传送玩家名(PlayerID)> <OriginPos(随机中心,坐标)>
|
// /rtp <Radius(半径)> <被传送玩家名(PlayerID)> <OriginPos(随机中心,坐标)>
|
||||||
CommandRegistrationCallback.EVENT
|
CommandRegistrationCallback.EVENT
|
||||||
@@ -141,11 +143,11 @@ public class CommandRegister {
|
|||||||
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
.then(argument("Radius(半径)", LongArgumentType.longArg())
|
||||||
.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 -> execute_command_origin(
|
||||||
context.getSource(),
|
context.getSource(),
|
||||||
LongArgumentType.getLong(context, "Radius(半径)"),
|
LongArgumentType.getLong(context, "Radius(半径)"),
|
||||||
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
|
EntityArgumentType.getEntity(context,"被传送玩家名(PlayerID)"),
|
||||||
EntityArgumentType.getEntity(context,"OriginEntity(随机中心,实体)").getPos()))))));});
|
EntityArgumentType.getEntity(context,"OriginEntity(随机中心,实体)")))))));});
|
||||||
|
|
||||||
// /rtp <被传送玩家名(PlayerID)> <Radius(半径)> <OriginPos(随机中心,坐标)>
|
// /rtp <被传送玩家名(PlayerID)> <Radius(半径)> <OriginPos(随机中心,坐标)>
|
||||||
CommandRegistrationCallback.EVENT
|
CommandRegistrationCallback.EVENT
|
||||||
@@ -166,9 +168,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(()->{ return Text.translatable("error.not_player"); }, true);
|
Source.sendFeedback(Text.translatable("error.twd.rtp.not_player"), true);
|
||||||
return -1;}
|
return -1;}
|
||||||
if (Radius == null){Radius = WorldBorder - (long) 1e4;}
|
if (Radius == null){Radius = WorldBoundary - (long) 1e4;}
|
||||||
Radius = Math.abs(Radius);
|
Radius = Math.abs(Radius);
|
||||||
long Coordinate_X;
|
long Coordinate_X;
|
||||||
long Coordinate_Z;
|
long Coordinate_Z;
|
||||||
@@ -179,30 +181,32 @@ public class CommandRegister {
|
|||||||
Coordinate_X = new SplittableRandom().nextLong(Math.round(Origin.getX() - Radius), Math.round(Origin.getX() + Radius));
|
Coordinate_X = new SplittableRandom().nextLong(Math.round(Origin.getX() - Radius), Math.round(Origin.getX() + Radius));
|
||||||
Coordinate_Z = new SplittableRandom().nextLong(Math.round(Origin.getZ() - Radius), Math.round(Origin.getZ() + Radius));}
|
Coordinate_Z = new SplittableRandom().nextLong(Math.round(Origin.getZ() - Radius), Math.round(Origin.getZ() + Radius));}
|
||||||
int Coordinate_Y = 320;
|
int Coordinate_Y = 320;
|
||||||
for (var CurrentBlock = Source.getWorld().getBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getBlock();
|
for (;
|
||||||
// 从世界顶层往下找,直到遇到一个非空气方块
|
Blocks.AIR == Source.getWorld().getBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getBlock() ||
|
||||||
Blocks.AIR == CurrentBlock ||
|
Blocks.VOID_AIR == Source.getWorld().getBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getBlock() ||
|
||||||
Blocks.VOID_AIR == CurrentBlock ||
|
Blocks.CAVE_AIR == Source.getWorld().getBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getBlock()
|
||||||
Blocks.CAVE_AIR == CurrentBlock
|
;Coordinate_Y--){}
|
||||||
;CurrentBlock = 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() ||
|
||||||
Coordinate_Y--;}
|
Blocks.LAVA == Source.getWorld().getBlockState(new BlockPos(Math.toIntExact(Coordinate_X), Coordinate_Y, Math.toIntExact(Coordinate_Z))).getBlock()){
|
||||||
for (int x = -1; x <= 1; x++) {
|
for (int x = -1; x <= 1; x++) {
|
||||||
for (int z = -1; z <= 1; z++) {
|
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());}}}
|
||||||
var BlockPos = new BlockPos(Math.toIntExact(Coordinate_X - x), Coordinate_Y, Math.toIntExact(Coordinate_Z - z));
|
|
||||||
var CurrentBlock = Source.getWorld().getBlockState(BlockPos).getBlock();
|
|
||||||
if ( CurrentBlock == Blocks.AIR ||
|
|
||||||
CurrentBlock == Blocks.VOID_AIR ||
|
|
||||||
CurrentBlock == Blocks.CAVE_AIR ||
|
|
||||||
CurrentBlock == Blocks.WATER ||
|
|
||||||
CurrentBlock == Blocks.LAVA ){
|
|
||||||
// 只替换空气、水和岩浆,其余保留
|
|
||||||
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") ) {
|
||||||
// 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(), false);
|
if (Radius == WorldBoundary && Retry < 126 && entity.getPos().distanceTo(Coordinate) < 1e5){
|
||||||
Source.sendFeedback(()->{ return Text.translatable("info.success", entity.getName(), Coordinate_Z, Coordinate_Z, Coordinate_Z); },true);
|
Retry++;
|
||||||
|
execute_command(Source, Radius,null, Origin);
|
||||||
return 0;}
|
return 0;}
|
||||||
|
if (Retry >= 126){
|
||||||
|
Source.sendFeedback(Text.translatable("warning.twd.rtp.retry"), true);}
|
||||||
|
entity.teleport(Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5);
|
||||||
|
final long FinalCoordinate_X = Coordinate_X;
|
||||||
|
final int FinalCoordinate_Y = Coordinate_Y;
|
||||||
|
final long FinalCoordinate_Z = Coordinate_Z;
|
||||||
|
Source.sendFeedback(Text.translatable("info.twd.rtp.success", entity.getName(), FinalCoordinate_X, FinalCoordinate_Y, FinalCoordinate_Z),true);
|
||||||
|
return 0;}
|
||||||
|
static int execute_command_origin(ServerCommandSource Source, @Nullable Long Radius, @Nullable Entity Player, Entity Origin){
|
||||||
|
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("RandomTeleporter Loading!");
|
LOGGER.info("Hello Fabric world!");
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -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",
|
||||||
"bilibili": "Bilibili",
|
"twd.bilibili": "Bilibili",
|
||||||
"blog": "Blog"
|
"twd.blog": "Blog"
|
||||||
}
|
}
|
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"modmenu.nameTranslation.randomteleporter": "随机传送",
|
"modmenu.nameTranslation.randomteleporter": "随机传送",
|
||||||
"modmenu.descriptionTranslation.randomteleporter": "增加了两个用于随机传送的命令",
|
"modmenu.descriptionTranslation.randomteleporter": "增加了两个用于随机传送的命令",
|
||||||
"info.success": "已将玩家%s传送到%d %d %d",
|
"info.twd.rtp.success": "已将玩家%s传送到%d %d %d",
|
||||||
"error.not_player": "执行命令的不是玩家",
|
"error.twd.rtp.not_player": "执行命令的不是玩家",
|
||||||
"bilibili": "TheWhiteDog9487的哔哩哔哩主页",
|
"warning.twd.rtp.retry": "重试次数过大,为避免死循环将在本次传送中取消距离保护",
|
||||||
"blog": "TheWhiteDog9487的博客"
|
"twd.bilibili": "哔哩哔哩主页",
|
||||||
|
"twd.blog": "TheWhiteDog9487的博客"
|
||||||
}
|
}
|
@@ -27,9 +27,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.15.11",
|
"fabricloader": ">=0.15.7",
|
||||||
"minecraft": "1.21.2",
|
"minecraft": "~1.19.1",
|
||||||
"java": ">=21",
|
"java": ">=17",
|
||||||
"fabric-api": "*"
|
"fabric-api": "*"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"custom": {
|
"custom": {
|
||||||
"modmenu": {
|
"modmenu": {
|
||||||
"links": {
|
"links": {
|
||||||
"bilibili": "https://space.bilibili.com/401746666",
|
"twd.bilibili": "https://space.bilibili.com/401746666",
|
||||||
"blog": "www.thewhitedog9487.xyz"},
|
"twd.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_21",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user