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

I'm developing a mod to provide bukkit-plugin-like /home, /sethome, /back command for vanilla server with forge installed. Everything goes fine, except for teleporting player from The End.

 

When player is in the world except for The End, I can use the following code to teleport the player to the dimension and the position I need:


if (entityPlayerMP.dimension != homeposition.getHomeDimensionId()) {
	entityPlayerMP.changeDimension(homeposition.getHomeDimensionId());
}

entityPlayerMP.setPositionAndUpdate( homeposition.getHomeCoordinates().xCoord,
                    		homeposition.getHomeCoordinates().yCoord,
                    		homeposition.getHomeCoordinates().zCoord);

 

However when entityPlayerMP is in The End, i.e. entityPlayerMP.dimension equals 1, this code will lead to an error, that is when the player travels from The End to Overworld, the entity in the Overworld will froze and if the dragon is not beated, it's hit point will appear in the Overworld.

The reason of this is the particularity of The End, and teleporting from it will make the player in the process of the End Poem, which is broken by the setPositionAndUpdate (it's hard to explain it in a few words but if you look into the implementation of changeDimension(), you will know clearly what I'm saying). That is to say, if I want the /back and /home command works for the player in The End, I need a user defined method of change dimension, which is beyond my ability.

  • Author
11 hours ago, Kriptikz said:

Here is what mcjty does in rftools, although you will probably have to go through his code a couple times as a couple of his own methods in different files.

https://github.com/McJty/RFTools/blob/b738a7e6b830c7f4ceb763914200fc98e1ed5a83/src/main/java/mcjty/rftools/blocks/teleporter/TeleportationTools.java#L354-L369

Well... I've tried his/her method without success......

Show your code. Also explain what you tried and how it didn't work.

Edited by Kriptikz

  • Author
On 2017/4/19 at 2:20 AM, Kriptikz said:

Show your code. Also explain what you tried and how it didn't work.

                entityPlayerMP.sendMessage(new TextComponentString(TextFormatting.RED + "" + TextFormatting.ITALIC + " TESTING!"));
                WorldServer worldServer = entityPlayerMP.getEntityWorld().getMinecraftServer().worldServerForDimension(home_dim);
                entityPlayerMP.getServer().getPlayerList().transferPlayerToDimension(entityPlayerMP, home_dim, new YJTeleporter(worldServer));
                entityPlayerMP.setPositionAndUpdate(home_x, home_y, home_z);
                entityPlayerMP.setPositionAndUpdate(home_x, home_y, home_z);
                worldServer.spawnEntity(entityPlayerMP);
                worldServer.updateEntityWithOptionalForce(entityPlayerMP, false);

The bossInfo bar of Dragon is still in the screen when I transport the player from The End to The Overworld when the Dragon is not beated. (The frozen entity problem has solved.)

 

I'm finding a way to make the bossInfo invisible in the Overworld.

Basicly, reconnecting to the server can solve it, but it's obviously not a perfect way.

Edited by YijunYuan

15 hours ago, YijunYuan said:

The bossInfo bar of Dragon is still in the screen when I transport the player from The End to The Overworld when the Dragon is not beated. (The frozen entity problem has solved.)

 

I'm finding a way to make the bossInfo invisible in the Overworld.

Basicly, reconnecting to the server can solve it, but it's obviously not a perfect way.

Yea that's a common problem with most teleportation mods, I am planning on looking into it though as I also have a method of teleportation in a mod i'm working on. I know vanilla does a check when the player logs in to see if the dragon is there because it tries to render the boss bar or something like that. Atm I don't yet know of a way to remove the bar from in game properly.

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.