Skip to content

Commit

Permalink
pocket dimension tp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Mar 12, 2024
1 parent 4f03952 commit 3071d15
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ else if (!chunksExist(plot, pocketDim)) {
}

public void teleportOutOfPocketDimension(ServerPlayerEntity player) {
if (!player.getWorld().isClient() && player.getWorld().getRegistryKey() == POCKET_DIM) {
if (player.getWorld().getRegistryKey() == POCKET_DIM) {
Optional<Map.Entry<UUID, Box>> entry = existingPlots.entrySet().stream().filter(entry1 -> entry1.getValue().intersects(player.getBoundingBox())).findFirst();

if (entry.isPresent()) {
Expand All @@ -149,6 +149,17 @@ public void teleportOutOfPocketDimension(ServerPlayerEntity player) {
ArcanusComponents.setPortalCoolDown(player, 200);
QuiltDimensions.teleport(player, targetWorld, new TeleportTarget(targetPos, Vec3d.ZERO, player.getYaw(), player.getPitch()));
}
else {
var spawnPos = player.getSpawnPointPosition();
var angle = player.getSpawnAngle();
var world = player.getServer().getWorld(player.getSpawnPointDimension());
if(!player.isSpawnPointSet() || world == null || spawnPos == null) {
world = player.getServer().getOverworld();
spawnPos = world.getSpawnPos();
angle = player.getYaw();
}
QuiltDimensions.teleport(player, world, new TeleportTarget(Vec3d.ofBottomCenter(spawnPos), Vec3d.ZERO, angle, player.getPitch()));
}
}
}

Expand Down

0 comments on commit 3071d15

Please sign in to comment.