ITank

ITank

581k Downloads

Tank assumes adjacent tile entity is a tank, crashes if not

Random832 opened this issue ยท 2 comments

commented

Describe the bug
The code for moving fluids into the bottom tank breaks if any other tile entity is present below a tank

To Reproduce
Steps to reproduce the behavior:

  1. Place a tank on top of any other tile entity [another mod's tank, pipes, a furnace or chest, etc]
  2. Put a fluid in the tank
  3. Server immediately crashes with a Ticking block entity error.

Expected behavior
Nothing [or possibly auto output into adjacent non-ITank fluid handler]

Additional context
https://github.com/EwyBoy/ITank/blob/1.16/src/main/java/com/ewyboy/itank/common/content/tank/TankTile.java#L69

This can easily be fixed by changing this code to do an instanceof check. Also, particularly if auto output to other fluid handlers is not desired, there are ways to implement this behavior without requiring ticking at all [pushing or pulling fluids only after the fluid content is changed], or only requiring the bottom tank to tick, but that would be a much more involved change.

The push down behavior could also be made block state dependent [i.e. simply exit the tick method for BOT and ONE tank blocks], though this approach may be vulnerable to problems caused by cross-mod interactions resulting in the block states being arranged incorrectly.

commented

Temp fixed by instance check. Will work out a better solution for the fluid as you suggested.
Thanks for the detailed report, new build can be found here: https://www.curseforge.com/minecraft/mc-mods/itank/files/3234360

commented

Added your suggestion @Random832 as a enchantment once I have time.
#18