Posted December 7, 20159 yr 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.
December 8, 20159 yr 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.
December 8, 20159 yr Author 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.
December 9, 20159 yr Author 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.
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.