Jump to content

[1.7.10] Stop player from moving their head/Stop player moving altogether


Roboguy99

Recommended Posts

I want to stop a player from (preferably) moving their head, or completely stop them from moving altogether on key press, and unfreeze them when the key is released. The KeyBinding is already set up.

 

I have tried, among several things which failed entirely, the code below:

minecraft.thePlayer.rotationPitch = 0;
minecraft.thePlayer.rotationYaw = 0;

However this causes a jumping/stuttering effect as the head is teleported back to the same position every frame. It also means the head is kept in the neutral position constantly, whereas I'd like it to be kept in the same position it was when the button was pressed (Although I'm sure I could figure this bit out if I knew how to freeze it properly).

 

Does anybody know how? Help is appreciated.

I have no idea what I'm doing.

Link to comment
Share on other sites

It will require client side.

 

In 1.8 - easily done with events.

 

In 1.7.10 I don't think there is one for that, but you can replace Camera entity on game startup and just do your stuff there.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

It will require client side.

 

In 1.8 - easily done with events.

 

In 1.7.10 I don't think there is one for that, but you can replace Camera entity on game startup and just do your stuff there.

 

This seems to be the case. I tried playing with a few event types, all of which yielded the same result. In which case, I need to either

a) Do as you suggested and replace the camera entity at startup or

b) Stop the mouse from actually trying to change rotation.

 

Which one do you think would be easier, and how would I go about doing either of these?

I have no idea what I'm doing.

Link to comment
Share on other sites

Turns out, you can do it very easily. To stop the mouse input, all you have to do is:

 

Mouse.getDX();
Mouse.getDY();
this.minecraft.mouseHelper.deltaX = this.minecraft.mouseHelper.deltaY = 0;

 

The mouse still interacts with the game, however does not move the player.

 

I put it inside a RenderTick event handler, but I'd imagine it would work in several different places.

I have no idea what I'm doing.

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.