So, it was brought to my attention that the way that I am teleporting the player using commands seems to cause some rather bad happenings on the server. When I first tried it, after they found the issue, I tried to teleport from the overworld to the end. When I did it had me suspended in what looked like the end, but nothing was loaded, no blocks could be seen, I couldn't move, nothing. Eventually my client disconnected, and then when I tried to log back in the server crashed saying that the server took a 60 seconds for a single tick.
The way that I am attempting to teleport the player is just like how they do it in minecrafts code
(pulled from the end portal block code)
entityIn.changeDimension(worldIn.dimension.getType() == DimensionType.THE_END ? DimensionType.OVERWORLD : DimensionType.THE_END);
What I am doing is this:
public static void teleport(ServerPlayerEntity player, Location loc) {
PlayerData data = Main.database.get(player.getUniqueID());
data.prevLoc = getPlayerLocation(player);
BlockPos pos = loc.getBlockPos();
if(!player.dimension.equals(loc.getDim())) {
if(Main.isDev()) {
player.changeDimension(loc.getDim());
}else {
TextUtils.err(player.getCommandSource(), "The ability to teleport between dimensions has been disabled until it can be fixed.");
return;
}
}
player.setPositionAndUpdate((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D);
}
I feel like something I am doing must be the issue, it is normally the reason, but I was fairly certain that this would work.