TerraFirmaCraft

TerraFirmaCraft

2M Downloads

`Helpers.slowEntityInBlock` is flawed and needs rework.

alcatrazEscapee opened this issue ยท 1 comments

commented

The problem is slowEntityInBlock is called from many different locations in Block#entityInside, which is called for every block the entity is currently inside. This means we have inconsistent behavior where interacting with multiple blocks at once results in a additive factor than interacting with single blocks, even though the total area may be the same. Example: walk through leaves at the border between two blocks, vs. walking through leaves at the center of a block. The effect is subtle but is there.

Note, that our implementation of slowEntityInBlock does a number of things that can't be handled by moving to slowFactor - for example, not slowing y as much as x/z, slowing downward movement rather than upward. This is to prevent behavior such as being unable to jump in leaves, which is undesirable.

The solution is to somehow, make slowEntityInBlock properly re-entrant, so only a single "worst" slowing effect will apply to a given entity in a single tick.

There may also be something independently wrong with horses related to this.

commented