Posted April 17, 20178 yr 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.
April 17, 20178 yr 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
April 18, 20178 yr 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......
April 18, 20178 yr Show your code. Also explain what you tried and how it didn't work. Edited April 18, 20178 yr by Kriptikz
April 24, 20178 yr 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 April 24, 20178 yr by YijunYuan
April 25, 20178 yr 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.