Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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;

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.

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.