Posted July 10, 201312 yr I'm able to teleport the player when they collide with a block, but when I use the same method (or similar) with custom commands and/or a tick handler, it doesn't work. and by doesn't work, I mean it does absolutely nothing. any help would be appreciated. here's the relevant code. https://github.com/code-lyoko-modding/CodeLyokoMod/blob/master/matt/lyoko/handlers/ServerTickHandler.java https://github.com/code-lyoko-modding/CodeLyokoMod/blob/master/matt/lyoko/handlers/CommandHandler.java the variables in PlayerInformation are being stored and retrieved correctly btw.
July 11, 201312 yr Here's the code I use with an item, if this helps: public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (par3EntityPlayer instanceof EntityPlayerMP) { WorldServer worldserver = (WorldServer)par2World; EntityPlayerMP var4 = (EntityPlayerMP)par3EntityPlayer; if (par3EntityPlayer.ridingEntity == null && par3EntityPlayer.riddenByEntity == null && par3EntityPlayer instanceof EntityPlayer && var4.dimension != Registration.dimID) { var4.mcServer.getConfigurationManager().transferPlayerToDimension(var4, Registration.dimID, new TutorialTeleporter(worldserver)); } if (par3EntityPlayer.ridingEntity == null && par3EntityPlayer.riddenByEntity == null && par3EntityPlayer instanceof EntityPlayer && var4.dimension == Registration.dimID) { var4.mcServer.getConfigurationManager().transferPlayerToDimension(var4, 0, new TutorialTeleporter(worldserver)); } } return par1ItemStack; }
July 11, 201312 yr Author at the moment, that isn't what I need. I need to be able to send them to any coordinates of any dimension.
July 13, 201312 yr set a breakpoint at the player.dimension = pi.scannerDim; Line and see that it executes correctly, then after the player.setPositionAndRotation() is done, check what cordinates the player really is at, did it the player object's coords change? also I haven't used Player information before, but "pi.getScannerPosX()" is this the X pos you want him to end up at or the location he currently is at? Just wondering since I have no idea what it is If you guys dont get it.. then well ya.. try harder...
July 13, 201312 yr Author set a breakpoint at the player.dimension = pi.scannerDim; Line and see that it executes correctly, then after the player.setPositionAndRotation() is done, check what cordinates the player really is at, did it the player object's coords change? also I haven't used Player information before, but "pi.getScannerPosX()" is this the X pos you want him to end up at or the location he currently is at? Just wondering since I have no idea what it is for the most part this works. all I had to do was send a packet. but my new problem, is that I don't change dimensions when I teleport. I have to log-out and then log back in to be in the correct dimension. and pi.getScannerPosX() gives the target x coordinate. EDIT: I've also tried "player.travelToDimension(pi.ScannerDim);" and it teleports me to the correct dimension, but it then teleports me to the nether. I can't figure out why.
July 14, 201312 yr Author I've figured out a new way to go to the dimensions, but it has one flaw, which is it doesn't update on the client. does anyone know how I can refresh the client? here's the code for the teleportation. https://github.com/code-lyoko-modding/CodeLyokoMod/blob/master/matt/lyoko/lib/DimensionIds.java
July 14, 201312 yr There may be a packet or something and does this mean you mod is one step closer to having Lyoko and sectors? Or call it in both sides. Look into how the nether portal goes to the nether.
July 14, 201312 yr Author yes, this means the mod is one step closer to having dimensions. and I thought it might be a packet thing, but how what kind of packet would I use?
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.