Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Random832 opened this issue Mar 9, 2021 · 2 comments
Closed

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

Random832 opened this issue Mar 9, 2021 · 2 comments
Assignees

Comments

@Random832
Copy link

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.

@EwyBoy EwyBoy self-assigned this Mar 9, 2021
@EwyBoy EwyBoy closed this as completed in b59965b Mar 10, 2021
@EwyBoy
Copy link
Owner

EwyBoy commented Mar 10, 2021

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

@EwyBoy
Copy link
Owner

EwyBoy commented Mar 10, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants