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.