Hello,
my idea was to create just a simple teleporter mod that is able to teleport a player to another position in Minecraft 1.15.2. I created the teleporter successfully but it just can't teleport
because when the teleporting code was executed there is a warning in the log that sais: "[minecraft/ServerPlayNetHandler]: Player moved wrongly!" and does'nt teleport. First I used the following code:
entity.setPosition(connectedTeleporterPos.getX(), connectedTeleporterPos.getY(), connectedTeleporterPos.getZ());
where "entity" is the instance of Entity that I'd like to teleport and "connectedTeleporterPos" is the target teleport position.
Because the problem only occures in multiplayer I thought I could fix the issue by using the following code:
((ServerPlayerEntity)entity).connection.setPlayerLocation(connectedTeleporterPos.getX(), connectedTeleporterPos.getY(), connectedTeleporterPos.getZ(), 0, 0);
but it fixed nothing.
Does anybody have an idea how to solve this problem?
Thank you in advance.