Create

Create

86M Downloads

Create blocks pathfinding problem (and solution)

desht opened this issue ยท 1 comments

commented

Hi, I'm the author of PneumaticCraft: Repressurized. Just wanted to bring a subtle problem with some of your blocks to your attention...

Non-full-cube blocks (e.g. the Valve Handles) don't override Block#allowsMovement() (isPathfindable() in official mappings). Specifically, this method is intended to determine whether or not an entity can pathfind through the block; the default for land-based and flying entities is to allow pathfinding if the block doesn't have an opaque collision shape. Unfortunately, because the valve handles have a movement-blocking collision box, entities will get stuck (forever) when trying to pathfind through them.

See the screenshot below:

2021-04-10_09 44 39

As you can see, the pig is trying (and failing) to pathfind through the valve handle, when it should be going around the wall to get to me. It is a subtle problem which many (most?) modders miss, and generally isn't very noticeable since vanilla entities aren't often around these blocks. However, PneumaticCraft drones often are, and drones getting stuck is a very common source of issues for me :)

Fortunately, it's very easy to fix: simply override allowsMovement() to return false in those blocks of yours which are not a full cube, but do have a movement-blocking collision shape. You will notice that vanilla does this for many of its blocks.

commented

Thanks for reporting this, desht.
Should be resolved in the recent patch