Jump to content

[1.8] Player Position


Corbeno

Recommended Posts

Note: I am very new to forge modding.

 

 

public class KeyInputHandler {

 

    @SubscribeEvent

    public void onKeyInput(InputEvent.KeyInputEvent event) {

        EntityPlayer player = Minecraft.getMinecraft().thePlayer;

        if(ExampleMod.keyBindings.isPressed())

            System.out.println("ping");

            System.out.println(player.posX);

    }

}

I have a keyInputHandler, so it fires every time a key is pressed. The problem I'm having is that what It's outputting. With this code, I get the message in my terminal (im using intellij).

 

[12:56:48] [Client thread/INFO]: [com.example.examplemod.KeyInputHandler:onKeyInput:18]: ping

1183.323231183142

1183.323231183142

 

And any other keybind I press (moving around, spacebar, etc, it's spitting out the changing x pos on my player. Any help?

 

(I'm not good at explaining my code haha..)

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.