Jump to content

[1.7.10] Does not move the player


EmperorZelos

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.