Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Using mods which change your eye height causes block placement to fail

Happyrobot33 opened this issue ยท 6 comments

commented

When using a player scaling mod, breaking blocks will work completely fine, but trying to have baritone place blocks will end up with it constantly looking at the wrong angles to do so

May possibly be related to this hardcoded function here? I'm new to the codebase so excuse me if it isn't I'm just poking around to see

static double eyeHeight(boolean ifSneaking) {
return ifSneaking ? 1.27 : 1.62;
}

Some information

Operating system: Windows
Java version: Fabric
Minecraft version: 1.20.1
Baritone version: 1.10.1 fabric
Other mods (if used): Pehkui

How to reproduce

Use a mod like Pehkui to change your player height to around a block or less and baritone will consistently fail to aim at the correct location and get stuck trying to place the block

Final checklist

  • I know how to properly use check boxes
  • I have included the version of Minecraft I'm running, baritone's version and forge mods (if used).
  • I have included logs, exceptions and / or steps to reproduce the issue.
  • I have not used any OwO's or UwU's in this issue.
commented

Yes, that method is likely part of the problem. However you should note that the usual player size is used in a lot more places so e.g. pathfinding will always search a path for a roughly one block wide and two blocks high player.

commented

Yes, that method is likely part of the problem. However you should note that the usual player size is used in a lot more places so e.g. pathfinding will always search a path for a roughly one block wide and two blocks high player.

In alot of cases the one block wide two block tall scenario works for characters smaller than default, although i think it would be neat if this could either be configured or calculated at runtime aswell, but thats out of scope for this current issue :). I tried getting a dev environment setup but gradle is complaining about pretty much all of the base API stuff not existing so i cant test a possible fix for this right now

commented

was able to get a really jank build environment going and can confirm that this is the code that needs to be changed. I tried making it dynamic but there's a bit of a static stackup happening and there isn't a reference to the player so I'm not sure how to do that myself, help would be appreciated there

commented

well then, ive half fixed the problem.

by doing this instead, it now correctly figures out what angle to look at when placing blocks its seems. But now I've run into a new issue where when my motion speed is adjusted up to match a regular players speed, it now overshoots the block its running on and falls off, presumably because it is not crouching early enough.

for context, the previous method call to the static function in IPlayerContext has been removed entirely along with the source method itself, as you can just ask for the eye height of a entity in different poses such as crouching.

public static Vec3 inferSneakingEyePosition(Entity entity) {
        return new Vec3(entity.getX(), entity.getY() + (entity.getEyeHeight(Pose.CROUCHING)), entity.getZ());
    } 
commented

This is motion scale at 1, meaning at my current single block size, my motion is also slower at half the normal block speed

motion.scale.1.mp4

This is motion scale at 2, meaning I move twice as fast as I would, but at my half size I move at the speed of a normal sized player

motion.scale.2.mp4

Where is the logic for determining when to start sneaking, because I could maybe start that earlier so you don't fall off the block?

commented

aha! turning off assumeSafeWalk makes it not fall off! So my code modification should be all that's needed to fix this issue I believe