AgriCraft

AgriCraft

30M Downloads

Directional Infinite Water Setup

Vritra22189 opened this issue ยท 8 comments

commented

placing a water tank-channel-another water tank in chain can cause water-generating property.

in the picture, i have a one-high tank flowing to a two-high tank, with around 3 buckets of water in the first, it starts generating water in the second.
and water generation also only appear in west-flowing or north-flowing water

with a channel extracting water from the lower block, it will be an infinite water setup
2016-02-15_11 33 33
2016-02-15_11 33 52

commented

Probably a rounding issue, an issue with any system that involves floats...

commented

Was my first thought too, but will have to do some testing and debugging to be sure.

commented

Sounds like a good plan.
I like how well @Vritra22189 documented the issue.

commented

i have just looked into the source of TileEntityChannel,
and i think it might have found the problem

firstly, the directional issue is probably about the update order (north > south > west > east)

secondly, in the tick function,
the FluidLevel is not updated after each channel-tank transfer
such that each calculation uses the initial FluidLevel of the tick, even after it is emptied into some tank
int V_tot = tank.getFluidLevel() + this.lvl;
then the channel FluidLevel is updated with the LAST calculation only.

thus in every ticks:
-the target tank receive water from the channel
-the channel will regenerate water (update-order and non-updating FluidLevel)
-the source tank will have no loss (because of equilibrium)

here is an excel showing some iteration,
if you reverse the update order (about which intermediate value is used as final)
the water is disappeared instead, probably is also the cause of issue #546
iteration.xlsx

commented

Impressive, nice work.
Indeed good find on https://github.com/InfinityRaider/AgriCraft/blob/1.7.10/src/main/java/com/InfinityRaider/AgriCraft/tileentity/irrigation/TileEntityChannel.java#L214 it should indeed be
int V_tot = tank.getFluidLevel() + updatedLevel;
I'll change that.
But there isn't much I can do about update order though.

commented

I'm glad this got sorted. :) Thanks!

commented

It should be fixed, but I'm leaving this open in case it isn't.

commented

New build is up on CurseForge, feel free to reopen or create a new ticket if this persists.