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.

Featured Replies

Posted

When I am teleporting entities to my dimension using "entity.travelToDimension([Dimension ID]);", it always creates a nether portal frame and never teleports to the correct position.

Is there another method I can use to achieve the same affect of moving the entity from one dimension to another without the nether portal that takes XYZ coordinates and the dimension id?

If not, can you point me in the right direction with coding my own method?

 

UPDATE: I now have a custom teleporter class that extends Teleporter and call it when I am teleporting

Please note that Teleporter is completely ignored if you're travelling to the End. So for completely independent algorithm you'll need to copy-paste existing one and modify it. Sad but true.

  • Author

I had already done so.

I have narrowed it down to this line in my travel function which never returns.

If I disconnect from the game then reconnect, I have travelled properly.

                worldserver1.spawnEntityInWorld(newEntity);

(Entire function based on Entity.java's travelToDimension)

public void teleportEntityToDimension(World world, Entity entity, int travelDimension) {
        if (!world.isRemote && !entity.isDead) {
            world.theProfiler.startSection("changeDimension");
            MinecraftServer minecraftserver = MinecraftServer.getServer();
            int dimension = entity.dimension;
            WorldServer worldserver = minecraftserver.worldServerForDimension(dimension);
            WorldServer worldserver1 = minecraftserver.worldServerForDimension(travelDimension);
            entity.dimension = travelDimension;
            
            world.removeEntity(entity);
            entity.isDead = false;
            world.theProfiler.startSection("reposition");
            minecraftserver.getConfigurationManager().transferEntityToWorld(entity, dimension, worldserver, worldserver1, new Teleporter(worldserver));
            world.theProfiler.endStartSection("reloading");

            Entity newEntity = EntityList.createEntityByName(EntityList.getEntityString(entity), worldserver1);
            if (newEntity != null)
            {
                newEntity.copyDataFrom(entity, true);
                worldserver1.spawnEntityInWorld(newEntity);
            }
            entity.isDead = true;
            world.theProfiler.endSection();
            worldserver.resetUpdateEntityTick();
            worldserver1.resetUpdateEntityTick();
            world.theProfiler.endSection();
        }
}

  • Author

If you are transporting a player use

        	if (entity instanceof EntityPlayerMP) {
                   EntityPlayerMP player = (EntityPlayerMP) entity;
                   player.mcServer.getConfigurationManager().transferPlayerToDimension(player, travelDimension, new Teleporter(minecraftServer.worldServerForDimension(player.dimension)));
                   newEntity = player;
        	}

instead of the last code I posted and it works nicely. (Got of wuppy's tutorial for teleporters)

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.