Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Getting on a mount while crawling causes extremely strange behavior #44

Open
yezhiyi9670 opened this issue Feb 23, 2020 · 2 comments
Open

Comments

@yezhiyi9670
Copy link

I saw that the issue is similar to #13, but that issue is already closed so I opened another one.

See this image.

image.png

If I right-click the minecart then this will happen

image.png

The problem is that, the player still keeps crawling on (or under in visual) the mount.

This does not damage the player like #13, however, it can sometimes give players ability to see things under the ground.

I think the best way to solve this problem is to prohibit riding a mount while the player is crawling (because right-clicking a mount like a minecart is already prohibited when sneaking).

@yezhiyi9670
Copy link
Author

yezhiyi9670 commented Feb 24, 2020

Performing a fake-sneak while the player is crawling can prohibit right-clicking a mount.

/src/main/java/xyz/kaydax/ido/handler/ClientHandler.java

Before:

    if(player.height == 0.6f && !player.isInWater() && !player.world.getCollisionBoxes(player, crawl).isEmpty() && ConfigHandler.CRAWL_TOGGLE)
    {
      event.getMovementInput().sneak = false;
      if(!ConfigHandler.SNEAK_TOGGLE) //This is to make sure crawling is still slow if sneaking is disabled
      {
        event.getMovementInput().moveStrafe = (float)((double)event.getMovementInput().moveStrafe * 0.3D);
        event.getMovementInput().moveForward = (float)((double)event.getMovementInput().moveForward * 0.3D);
      }
    }

After:

    if(player.height == 0.6f && !player.isInWater() && !player.world.getCollisionBoxes(player, crawl).isEmpty() && ConfigHandler.CRAWL_TOGGLE)
    {
      event.getMovementInput().sneak = true;
      if(!ConfigHandler.SNEAK_TOGGLE) //This is to make sure crawling is still slow if sneaking is disabled
      {
        event.getMovementInput().moveStrafe = (float)((double)event.getMovementInput().moveStrafe * 0.3D);
        event.getMovementInput().moveForward = (float)((double)event.getMovementInput().moveForward * 0.3D);
      }
    }

However this can't prohibit passive riding, and the fix may be imperfect.

EDIT: Doing so will prevent the player from falling out an edge, but it is worth doing so before we find better solutions.

@yezhiyi9670
Copy link
Author

I found that this issue is client-only. The ClientHandler doesn't care about the player's riding status when checking if the player is crawling. Fixing this will do a full fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant