Skip to content

Commit ae72bd5

Browse files
committed
Ported RandomTPAPI and /rtpd to 1.21.4
1 parent e3ff30c commit ae72bd5

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

common/src/main/java/com/gmail/picono435/randomtp/api/RandomTPAPI.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import net.minecraft.world.level.block.Blocks;
2222
import net.minecraft.world.level.block.CactusBlock;
2323
import net.minecraft.world.level.block.LiquidBlock;
24+
import net.minecraft.world.level.portal.TeleportTransition;
25+
import net.minecraft.world.phys.Vec3;
2426

2527
import java.util.*;
2628
import java.util.concurrent.ExecutorService;
@@ -107,7 +109,8 @@ public static Future<Boolean> randomTeleport(ServerPlayer player, ServerLevel wo
107109
}
108110

109111
player.getServer().submit(() -> {
110-
player.teleportTo(world, mutableBlockPos.getX(), mutableBlockPos.getY(), mutableBlockPos.getZ(), player.getXRot(), player.getYRot());
112+
TeleportTransition teleportTransition = new TeleportTransition(world, mutableBlockPos.getCenter(), Vec3.ZERO, player.getYRot(), player.getXRot(), false, false, Set.of(), null);
113+
player.teleport(teleportTransition);
111114
Component successful = Component.literal(Messages.getSuccessful().replaceAll("\\{playerName\\}", player.getName().getString()).replaceAll("\\{blockX\\}", "" + (int)player.position().x).replaceAll("\\{blockY\\}", "" + (int)player.position().y).replaceAll("\\{blockZ\\}", "" + (int)player.position().z).replaceAll("&", "§"));
112115
player.sendSystemMessage(successful, false);
113116
});

common/src/main/java/com/gmail/picono435/randomtp/commands/RTPDCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import net.minecraft.network.chat.Component;
1616
import net.minecraft.server.level.ServerLevel;
1717
import net.minecraft.server.level.ServerPlayer;
18-
import net.minecraft.world.level.portal.DimensionTransition;
18+
import net.minecraft.world.level.portal.TeleportTransition;
1919

2020
public class RTPDCommand {
2121

@@ -59,8 +59,8 @@ private static int runCommand(ServerPlayer p, ServerLevel dim) {
5959
cooldowns.put(p.getName().getString(), System.currentTimeMillis());
6060
return 1;
6161
}
62-
DimensionTransition dimensionTransition = new DimensionTransition(dim, p, DimensionTransition.DO_NOTHING);
63-
p.changeDimension(dimensionTransition);
62+
TeleportTransition teleportTransition = new TeleportTransition(dim, p, TeleportTransition.DO_NOTHING);
63+
p.teleport(teleportTransition);
6464
double cal = p.serverLevel().getWorldBorder().getSize()/2;
6565
BigDecimal num = new BigDecimal(cal);
6666
String maxDistance = num.toPlainString();

0 commit comments

Comments
 (0)