Hytale Modding
Server Plugins

Teleporting the player

Learn how to teleport the player.

To teleport players in Hytale, you will need to get a World object so we can safely run the teleport on the world thread. The world thread manages all entity updates, so modifying entities off-thread can crash the server or cause inconsistent state. Next, we get the entity store and make a Teleport object. We add a Teleport component to the player’s entity reference in the entity store. This triggers the teleportation logic for that player.

public static void teleportPlayer(Player player, int x, int y, int z) {
        World world = player.getWorld();
        if (world == null) return;
        world.execute(() -> {
            if (player.getReference() == null) return;
            Store<EntityStore> store = player.getReference().getStore();
            Teleport teleport = new Teleport(new Transform(x ,y, z));

            store.addComponent(player.getReference(), Teleport.getComponentType(), teleport);
        });

}