Mekanism Tools

Mekanism Tools

77M Downloads

Mekanism blocks pathfinding issue

desht opened this issue ยท 0 comments

commented

Please use the search functionality before reporting an issue. Also take a look at the closed issues!

Issue description:

Some Mekanism blocks (noticeably cables and pipes, but maybe others) don't properly override Block#allowsMovement(). Specifically, this method is intended to decide whether or not an entity can pathfind through it; the default for land-based and flying entities is to allow pathfinding if the block doesn't have an opaque collision shape. This is the case for all Mekanism pipes and cables. Unfortunately, because these blocks have a collision box, entities will get stuck (forever) when trying to pathfind through them.

Steps to reproduce:

  1. Set up a row of Mek cables like in the screenshot below
  2. Put some cows on the other side of the cables
  3. Hold some wheat
  4. The cows should step over or walk around the end of the cables to get to you, but will instead try (and fail) to walk through the cables.

2021-02-05_17 36 35

The fix is fortunately very easy: just override Block#allowsMovement() to return false for any blocks which are solid but don't have an opaque collision box (i.e. not full cubes). You'll notice vanilla overrides this method in many of its blocks to do this.

Version (make sure you are on the latest version before reporting):

Forge: 36.0.0
Mekanism: 10.0.19
Other relevant version: MC 1.16.5

If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)

[gist / pastebin / etc link here. Please make sure that it isn't set to expire.]