EmperorZelos Posted September 1, 2014 Share Posted September 1, 2014 I am trying to create a thing that verticly moves a player up to another platform that's above it, I have managed to get it to detect if there is a platform and get there and everything public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ if (!world.isRemote){ if (player.getHeldItem() != null){ if (player.getHeldItem().getItem() == AeroSteam.toolWrench){ int meta = world.getBlockMetadata(x, y, z); if (meta > 4){ int height = findHeight(world, x, y, z); if (isValid(world,x,y,z,meta,height)){ System.out.println("is valid with height "+ height + " by " + player.getCommandSenderName()); player.setPosition(x, height+20, z); player.setLocationAndAngles(x+0.5F, y+20, z+0.5F, player.rotationYaw, player.rotationPitch); player.setPositionAndRotation2(x, height+20, z, player.rotationYaw, player.rotationPitch, 1); } } System.out.println("Meta is " + meta); } } } return true; } The issue is that it won't move the player, I have tried all 3 methods of moving a player and player.setLocationAndAngles(x+0.5F, y+20, z+0.5F, player.rotationYaw, player.rotationPitch); have I tried on an item with success of movign the player, but here for some reason it does not move the player, me, when I activate it, i get all the messages from within the inner most if clause but no player moving. That is I do get the ""is valid with height "+ height + " by " + player.getCommandSenderName()" message popping up which is what confuse me as it reaches where I want it to but no movement Quote Link to comment Share on other sites More sharing options...
TheDav1311 Posted September 1, 2014 Share Posted September 1, 2014 Try this one: player.setPositionAndUpdate(x, y, z); Quote Link to comment Share on other sites More sharing options...
knokko Posted September 1, 2014 Share Posted September 1, 2014 You are using an !world.Isremote check, this makes it only works on server. But I think moving the player is client, so remove that first and test it again. And try player.motionY = 1; Quote Link to comment Share on other sites More sharing options...
TheDav1311 Posted September 1, 2014 Share Posted September 1, 2014 You are using an !world.Isremote check, this makes it only works on server. But I think moving the player is client, so remove that first and test it again. That's wrong. It only mean the server side. If you play in singleplayer, you have too a server and a client. Quote Link to comment Share on other sites More sharing options...
EmperorZelos Posted September 1, 2014 Author Share Posted September 1, 2014 THANK! YOU! that solved it....why did the others fail? Quote Link to comment Share on other sites More sharing options...
knokko Posted September 1, 2014 Share Posted September 1, 2014 What solved your problem? motionY ? Quote Link to comment Share on other sites More sharing options...
EmperorZelos Posted September 1, 2014 Author Share Posted September 1, 2014 What solved your problem? motionY ? player.setPositionAndUpdate(x, y, z); Quote Link to comment Share on other sites More sharing options...
TheDav1311 Posted September 1, 2014 Share Posted September 1, 2014 I don't know why only this works. I tried just all and this was the only one which works. Quote Link to comment Share on other sites More sharing options...
knokko Posted September 1, 2014 Share Posted September 1, 2014 Maybe control + click on methods will help you solving this. public void setPositionAndUpdate(double p_70634_1_, double p_70634_3_, double p_70634_5_) { this.setLocationAndAngles(p_70634_1_, p_70634_3_, p_70634_5_, this.rotationYaw, this.rotationPitch); } This is really strange if you ask me. And I can always use player.motionY I think this has something to do with your check. This is something that prevented my flywand from working. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.