• 0

    posted a message on Cannot find code that links keyboard input to player movement in MCP 9.40

    THE IDEA


    I've already fixed the camera to an isometric perspective but now I want to change how the player moves. Instead of the arrow keys moving relative to where the player model is looking, I want them to move the player relative to the fixed camera perspective.


    THE PROBLEM


    I can't find where the code is that links a keyboard press to an action, I was expecting there to be a controller class that would listen for key presses, check the action that belongs to that key press and set the PlayerEntity to move in the direction that is linked to the pressed key.


    MY OWN EFFORTS


    I've been looking at the code a lot, I've seen the runTickKeyboard() method in net.minecraft.client.Minecraft class that eventually calls the dispatchKeypresses() method but that seems only guiscreen and special keys like F3 related.


    I expected that a controller class would call

    moveEntity(MoverType x, double p_70091_2_, double p_70091_4_, double p_70091_6_)

    or

    addVelocity(double x, double y, double z)

    function from net.minecraft.entity.Entity class but the only interesting class that calls these functions is the net.minecraft.client.network.NetHandlerPlayServer class. But this seems to be going to far and still doesn't contain a simple calculation of what kind of action this keypress should do (for example: left arrow sets player velocity to x = 0.3F y=0.0F, z = 0.0F)


    WHAT I NEED


    Directions to where I can change what the "arrow" binded keys do to the PlayerEntity when pressed.

    Posted in: Modification Development
  • To post a comment, please .