
Infinite loop by creating a snake eating its own tail
squeek502 opened this issue ยท 9 comments
If you put block 4 block extenders chaining back into itself, like so:
v
^ <
it will create an infinite loop from calling getSizeInventory() on eachother.
My guess is it has to do with connections not necessarily being cleared when the block is rotated/dismantled, but it might be worth looking into the connection logic in general, as it seems like it is checking for connections every tick? If so, should that be changed to only check for connections using similar conditions to when it's checking for redstone signals (on rotate, on neighbor block update)?
I've got a seemingly definitive fix for this, but it's part of quite a few other changes to how connections are handled. I want to make sure I've thought things through and make sure everything still works as intended before I submit a pull request.
If you're interested, you can see what I've done so far here: https://github.com/squeek502/BlockExtenders/tree/loopfix (note that some things are probably temporary, like sending a hasConnection boolean from server to client).
It's still not fixed in all cases, but it's rare.
The changes in my loopfix branch are not ideal and not fully functional. Still need to rethink things a bit and find a better solution.
Is this still needed? I can't remember pulling that branch, so this might not be fixed in all cases.
Fixed with f9d9ab5
Still a problem if you loop into a non-starting block. Fixed by: #8
This can actually still occur, but it's very rare. I've encountered it three times so far: twice while dismantling a block that was part of a loop, and once while rotating a block that was part of a loop. Not sure what could cause it, though. It seems to only happen after the loop has existed for a while or something.