Jump to content

Reversing the player's controls


Twingemios

Recommended Posts

I'm working on a mod and I want to reverse the player's controls but what I am doing doesn't seem to be working.

 

public static void movementInputUpdate(MovementInputUpdateEvent event){
        Player player = Minecraft.getInstance().player;
        if(Minecraft.getInstance().player.isAlive()) {
            if(chaosActs.hasAct("reverse_controls")){
                
                boolean up = event.getInput().up;
                boolean down = event.getInput().down;
                boolean left = event.getInput().left;
                boolean right = event.getInput().right;

                event.getInput().up = down;
                event.getInput().down = up;
                event.getInput().left = right;
                event.getInput().right = left;

However previously in this mod I had an effect that forced the player to crouch

event.getInput().shiftKeyDown = true;

And when I even placed it inside of the first chunk of code and it worked fine.

Is there something I am doing wrong? is there a better way to invert the player's controls?

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.

×
×
  • Create New...

Important Information

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