Posted July 5, 201411 yr I made an item that is supposed to teleport me to my bed location using getBedLocation() but instead it keeps teleporting me to my original spawn point. Anyone know how to fix this? Here's the complete class file package achilleus.sao.food; import achilleus.sao.MainClass; import net.minecraft.entity.player.EntityPlayer; import achilleus.sao.Item.GateSetClass; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; public class TeleportCrystalClass extends Item { public TeleportCrystalClass() { setTextureName(MainClass.MODID + ":TeleportCrystal"); } public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { ChunkCoordinates spawn = par3EntityPlayer.getBedLocation(); par3EntityPlayer.setPosition(spawn.posX, spawn.posY, spawn.posZ); return par1ItemStack; } }
July 5, 201411 yr Try: ChunkCoordinates spawn = par3EntityPlayer.getBedLocation(player.dimension); spawn = EntityPlayer.verifyRespawnCoordinates(par2World, spawn, true); par3EntityPlayer.setPosition(spawn.posX, spawn.posY, spawn.posZ); Although it doesn't seem to check whether the bed is still there.
July 5, 201411 yr Author That didn't work, but it completely obliterated the area around my original spawn
July 5, 201411 yr Author This fixed it ChunkCoordinates bed = par3EntityPlayer.getBedLocation(par3EntityPlayer.dimension); par3EntityPlayer.setPositionAndUpdate(bed.posX, bed.posY, bed.posZ); return par1ItemStack;
July 5, 201411 yr That didn't work, but it completely obliterated the area around my original spawn ...obliterate? It shouldn't change anything about the world. I guess it's not very important though.
July 5, 201411 yr None of those method calls should change anything around spawn, and they definitely shouldn't obliterate it. I am interested: How did it obliterate the area? What was the effect? Can you reproduce this effect?
July 5, 201411 yr I want the same action but obviously I can't do that in [X]. How should I go about it in this case ? @SubscribeEvent public void checkDimension(PlayerEvent.PlayerChangedDimensionEvent event) { int dimension = event.player.dimension; System.out.println("player dimension is: " + event.player.dimension); if (dimension == -1){[X]} }
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.