mirror of
				https://github.com/TheWhiteDog9487/RandomTeleporter.git
				synced 2025-10-28 19:21:06 +08:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			1.21.5
			...
			d47907cdf4
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d47907cdf4 | |||
| 8c55311f27 | |||
| 35ac4dd842 | |||
| 34ea09dfd9 | |||
| ad014a2b1b | 
| @@ -1,9 +1,9 @@ | ||||
| plugins { | ||||
|     id("fabric-loom") version "1.10-SNAPSHOT" | ||||
|     id("fabric-loom") version "1.11-SNAPSHOT" | ||||
|     id("maven-publish") | ||||
| } | ||||
|  | ||||
| version = "${project.extra["mod_version"]}" | ||||
| version = project.extra["mod_version"] as String | ||||
| group = project.extra["maven_group"] as String | ||||
|  | ||||
| base { | ||||
|   | ||||
| @@ -4,18 +4,18 @@ org.gradle.parallel=true | ||||
|  | ||||
| # Fabric Properties | ||||
| # check these on https://fabricmc.net/develop | ||||
| minecraft_version=1.21.5 | ||||
| yarn_mappings=1.21.5+build.1 | ||||
| loader_version=0.16.10 | ||||
| minecraft_version=1.21.8 | ||||
| yarn_mappings=1.21.8+build.1 | ||||
| loader_version=0.16.14 | ||||
|  | ||||
| # Mod Properties | ||||
| mod_version=0.3.5 | ||||
| mod_version=0.3.6 | ||||
| maven_group=xyz.thewhitedog9487 | ||||
| archives_base_name=RandomTeleporter | ||||
|  | ||||
| # Dependencies | ||||
| fabric_version=0.119.5+1.21.5 | ||||
| fabric_version=0.129.0+1.21.8 | ||||
|  | ||||
| # https://modrinth.com/mod/modmenu/versions | ||||
| # https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu | ||||
| modmenu_version=14.0.0-rc.2 | ||||
| modmenu_version=15.0.0-beta.3 | ||||
							
								
								
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| distributionBase=GRADLE_USER_HOME | ||||
| distributionPath=wrapper/dists | ||||
| distributionUrl=https://services.gradle.org/distributions/gradle-8.13-bin.zip | ||||
| distributionUrl=https://services.gradle.org/distributions/gradle-8.14-bin.zip | ||||
| networkTimeout=10000 | ||||
| validateDistributionUrl=true | ||||
| zipStoreBase=GRADLE_USER_HOME | ||||
|   | ||||
| @@ -221,14 +221,27 @@ public class CommandRegister { | ||||
|         if (Radius == null){Radius = (int) (WorldBorder - 1e4);} | ||||
|         // ↑ 远离世界边界 | ||||
|         Radius = Math.abs(Radius); | ||||
|         int Coordinate_X; | ||||
|         int Coordinate_Z; | ||||
|         if (Origin == null){ | ||||
|             Coordinate_X = new SplittableRandom().nextInt(-Radius, Radius); | ||||
|             Coordinate_Z = new SplittableRandom().nextInt(-Radius, Radius);} | ||||
|         else{ | ||||
|             Coordinate_X = new SplittableRandom().nextInt((int) Origin.x - Radius, (int) Origin.x + Radius); | ||||
|             Coordinate_Z = new SplittableRandom().nextInt((int) Origin.y - Radius, (int) Origin.y + Radius);} | ||||
|         int Coordinate_X = 0; | ||||
|         int Coordinate_Z = 0; | ||||
|         try { | ||||
|             if (Origin == null){ | ||||
|                 Coordinate_X = new SplittableRandom().nextInt(-Radius, Radius); | ||||
|                 Coordinate_Z = new SplittableRandom().nextInt(-Radius, Radius);} | ||||
|             else{ | ||||
|                 Coordinate_X = new SplittableRandom().nextInt((int) Origin.x - Radius, (int) Origin.x + Radius); | ||||
|                 Coordinate_Z = new SplittableRandom().nextInt((int) Origin.y - Radius, (int) Origin.y + Radius);}} | ||||
|         catch (IllegalArgumentException e) { | ||||
|             // 半径为零 | ||||
|             if (Origin == null) { | ||||
|                 Source.sendFeedback(()->{ return Text.translatableWithFallback("warning.radius_equal_zero_no_target", "由于你设置的随机半径为0,并且未设置随机中心点坐标,因此什么都不会发生"); },true); | ||||
|                 return -1;} | ||||
|             else { | ||||
|                 Coordinate_X = (int) Origin.x; | ||||
|                 Coordinate_Z = (int) Origin.y; | ||||
|                 int finalCoordinate_X1 = Coordinate_X; | ||||
|                 int finalCoordinate_Z1 = Coordinate_Z; | ||||
|                 // ↑ "lambda 表达式中使用的变量应为 final 或有效 final" | ||||
|                 Source.sendFeedback(()->{ return Text.translatableWithFallback("warning.radius_equal_zero", "警告:由于你设置的随机半径为0,因此在选择出合适高度之后将直接把你传送至%d %d", finalCoordinate_X1, finalCoordinate_Z1); },true);}} | ||||
|         int Coordinate_Y = 320; | ||||
|         for (var CurrentBlock = Source.getWorld().getBlockState(new BlockPos(Coordinate_X, Coordinate_Y, Coordinate_Z)).getBlock(); | ||||
|              // 从世界顶层往下找,直到遇到一个非空气方块 | ||||
| @@ -254,9 +267,11 @@ public class CommandRegister { | ||||
|         Coordinate_Y++; | ||||
|         // ↑ 高一层,人别站在土里了 | ||||
|         entity.teleport(Source.getWorld(),Coordinate_X + 0.5, Coordinate_Y, Coordinate_Z + 0.5, new HashSet<>(), entity.getYaw(), entity.getPitch(), false); | ||||
|         int finalCoordinate_X = Coordinate_X; | ||||
|         int finalCoordinate_Y = Coordinate_Y; | ||||
|         int finalCoordinate_Z = Coordinate_Z; | ||||
|         // ↑ "lambda 表达式中使用的变量应为 final 或有效 final" | ||||
|         final var FeedbackFallbackString = String.format("已将玩家%s传送到%d %d %d", entity.getName().getString(), Coordinate_X, finalCoordinate_Y, Coordinate_Z); | ||||
|         Source.sendFeedback(()->{ return  Text.translatableWithFallback("info.success", FeedbackFallbackString, entity.getName(), Coordinate_X, finalCoordinate_Y, Coordinate_Z); },true); | ||||
|         Source.sendFeedback(()->{ return  Text.translatableWithFallback("info.success", FeedbackFallbackString, entity.getName(), finalCoordinate_X, finalCoordinate_Y, finalCoordinate_Z); },true); | ||||
|         return 16;} | ||||
| } | ||||
| @@ -3,5 +3,7 @@ | ||||
|   "modmenu.descriptionTranslation.randomteleporter": "Added two commands for random teleportation", | ||||
|   "info.success": "Teleported %s to %d %d %d", | ||||
|   "error.no_target": "There is no teleported target, and the teleported player ID is explicitly specified when executed by a non-player object", | ||||
|   "warning.radius_equal_zero": "Warning: Since you set a random radius of 0, selecting the right height will teleport you directly to %d %d", | ||||
|   "warning.radius_equal_zero_no_target": "Warning: Since you set a random radius of 0 and you don't set a random center point coordinates, nothing happens", | ||||
|   "bilibili": "Bilibili" | ||||
| } | ||||
| @@ -3,5 +3,7 @@ | ||||
|   "modmenu.descriptionTranslation.randomteleporter": "增加了两个用于随机传送的命令", | ||||
|   "info.success": "已将玩家%s传送到%d %d %d", | ||||
|   "error.no_target": "不存在被传送目标,由非玩家物体执行命令时请显式指定被传送玩家ID", | ||||
|   "warning.radius_equal_zero": "警告:由于你设置的随机半径为0,因此在选择出合适高度之后将直接把你传送至%d %d", | ||||
|   "warning.radius_equal_zero_no_target": "警告:由于你设置的随机半径为0,并且未设置随机中心点坐标,因此什么都不会发生", | ||||
|   "bilibili": "TheWhiteDog9487的哔哩哔哩主页" | ||||
| } | ||||
| @@ -27,10 +27,10 @@ | ||||
| 		} | ||||
| 	], | ||||
| 	"depends": { | ||||
| 		"fabricloader": ">=0.16.10", | ||||
| 		"minecraft": "1.21.5", | ||||
| 		"fabricloader": ">=0.16.14", | ||||
| 		"minecraft": "1.21.8", | ||||
| 		"java": ">=21", | ||||
| 		"fabric-api": ">=0.119.5" | ||||
| 		"fabric-api": ">=0.129.0" | ||||
| 	}, | ||||
| 	"suggests": { | ||||
| 		"another-mod": "*" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user