Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.12] Player desynced when teleporting from The End

Featured Replies

Posted

I am having an issue where the player is desynced from the server when I teleport them from The End to a custom dimension.

 

Method I am calling to teleport player:

Spoiler

public static void TeleportEntityToDimension(Entity entityIn, World worldIn, int dimID, float x, float y, float z){
        if (!worldIn.isRemote && worldIn.provider.getDimension() != dimID) {
            WorldTeleporter teleporter = new WorldTeleporter(entityIn.getServer().getWorld(dimID), new BlockPos(x, y, z));
            if (entityIn instanceof EntityPlayerMP) {
                entityIn.setPosition(x, y, z);
                entityIn.getServer().getPlayerList().transferPlayerToDimension((EntityPlayerMP) entityIn, dimID, teleporter);
            } else {
                changeDimension(entityIn, dimID, teleporter);
            }
        }
    }

The changeDimension method I only use for non-player entities and it is based off of the Entity.changeDimension method, modified so that it works without a portal block. It does not work for players.

And here is my teleporter class:

Spoiler

public class WorldTeleporter extends Teleporter {

    BlockPos exit;
    WorldServer world;

 

    public WorldTeleporter(WorldServer worldIn, BlockPos exit) {
        super(worldIn);
        this.exit = exit;
        world = worldIn;
    }

 

    @Override
    public void placeInPortal(Entity entityIn, float rotationYaw) {
        entityIn.setLocationAndAngles(exit.getX(), exit.getY(), exit.getZ(), entityIn.rotationYaw, 0.0F);
        entityIn.motionX = 0.0D;
        entityIn.motionY = 0.0D;
        entityIn.motionZ = 0.0D;
    }
}

When the player is teleported from The End they can move around but cannot throw items, spawn entities. They can place blocks however.

 

The code works fine from the Nether or the Overworld, and I can't find what part of my code would be causing it. Is this a problem with the transferPlayerToDimension method? If so, is there another good way to teleport players between dimensions?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.