Posted June 7, 201312 yr For the mod I'm making, I need to save the players dimension and coordinates when they do a certain thing. I then want to be able to get that data when the player types in a command so that they can teleport to that location. I thing I need to do something with IAdditionalEntityData or something but I'm not sure. please help. Oh! and I also have the command set up already. I just don't know how to make it teleport the player. https://github.com/code-lyoko-modding/CodeLyokoMod/blob/master/matt/lyoko/handlers/CommandHandler.java
June 10, 201312 yr I don't know how to use IAdditionalEntityData... but teleporting a player is player.setLocationAndAngles(x,y,z,yaw,pitch). I use 90 and 0 for the last two arguments; that works well enough. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 10, 201312 yr But I only have access to ICommandSender When exactly is this that you want to teleport the player? BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 10, 201312 yr if(icommandsender instanceof EntityPlayer){ ((EntityPlayer) icommandsender).setLocationAndAngles(x,y,z,yaw,pitch); } BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 10, 201312 yr Author ... why did I not think of that. On to the second problem, how do I save the location of the player at a certain point in time and then retrieve it later on? if needed, I can save it to a file and then read it from there, but I'd prefer to save it to NBT data.
June 10, 201312 yr I don't know how to use IAdditionalEntityData... but teleporting a player is player.setLocationAndAngles(x,y,z,yaw,pitch). I use 90 and 0 for the last two arguments; that works well enough. Instead of just using 90 and 0, you can use the actual yaw and pitch. player.setLocationAndAngles(x, y, z, player.rotationYaw, player.rotationPitch); Read my thoughts on my summer mod work and tell me what you think! http://www.minecraftforge.net/forum/index.php/topic,8396.0.html I absolutely love her when she smiles
June 10, 201312 yr Author I'm aware of how to teleport once in the player class, I've done it before, I just need to get a way to save data to the player.
June 10, 201312 yr I don't know how to use IAdditionalEntityData... but teleporting a player is player.setLocationAndAngles(x,y,z,yaw,pitch). I use 90 and 0 for the last two arguments; that works well enough. Instead of just using 90 and 0, you can use the actual yaw and pitch. player.setLocationAndAngles(x, y, z, player.rotationYaw, player.rotationPitch); Good point, not that I'm sure it matters. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 10, 201312 yr Author You can also do player.setLocationAndUpdate(x, y, z) and it automatically uses the players yaw and pitch.
June 12, 201312 yr Author I still need help saving and recalling the players coordinates and dimension when ever I need to.
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.