Modular Routers

Modular Routers

33M Downloads

Sender Mk 2 and Distributor remember inventories that were broken/removed

dashkal16 opened this issue ยท 8 comments

commented

Minecraft Version

1.16.5

Forge Version

forge-1.16.5-36.2.8

Mod Version

modular-routers-1.16.5-7.5.1-69

Describe your problem, including steps to reproduce it

When changing out the target of a Sender Mk 2 or Distributor (breaking the target block and replacing it), sometimes the router "remembers" the old one and continues to send it items.

This manifests as either lost items, or in one interesting case, sending to what the Occultism Wormhole that was there targeted.

Observed with Productive Bees Advanced Beehives and Occultism Wormholes.

Any other comments?

Suspect that the mods owning the blocks fail to invalidate the inventory capability.

commented

It looks like it probably is other mods failing to invalidate their caps, since I do add a listener to clear any cached caps here: https://github.com/desht/ModularRouters/blob/MC1.16.4-master/src/main/java/me/desht/modularrouters/logic/ModuleTarget.java#L101

When I get a chance, I'll take a look at the two mods you mentioned and see if that's indeed the case.

commented

This does seem very likely, yes. I fear, however, that this will be a very common error on the part of other mods. Might be worth some mitigation somehow.

commented

The problem with any mitigation strategies is that they tend to defeat the point of caching capabilities in the first place, which is performance...

I haven't had a chance yet to look at this in detail, but I do plan to take a closer look and see what can be done.

commented

I have observed the same behavior with Sender Mk 2 modules and Chests from the Iron Chests mod and Sophisticated Backpacks in 1.18.1.
So after seeing there already was an issue open, I decided to do some tests.
All three Sender Mk levels remember their target inventory and just continue to send items, even if the inventory is removed. And this also applies to your own routers.
I set up a chain of routers. One with an Sender Mk1, one with Mk2 and one with Mk3.
Then I put a piece of rotten flesh in to circle around.
I can remove any of the routers from the circle and the item gets sent into nowhere and just voids from existence.
When I put one of the removed routers back which was a target of an Mk2 or 3 module, and put a new item in the chain, it still gets voided instead of looping again.
I have to reset the targets for the Mk2 and Mk3 to not send items into the void.

Since I am on your discord anyway, you can ask me for details there, if you need any.

commented

OK, thanks for the update. Forgotten about this one a little, but I will revisit it. Clearly I'm missing some invalidation somewhere...

commented

So, yeah, I wasn't properly invalidating router caps when the router was broken. That's pretty embarrassing :( But I'll have a fix out for that in the next day or two.

However: regarding other mods, it is very much on them to invalidate their capabilities when they should no longer be used (i.e. when the block is broken). I'm not going to work around their broken behaviour in Modular Routers, because that's simply not the right place to fix it. Forge provides the API for capability caching and invalidation for a reason, and mods need to use it.

commented

(I should also mention that I won't be providing any fixes for 1.18.1 - only 1.16.5 and 1.18.2 get any attention these days. Mods need to be getting off 1.18.1)

commented

Alas. While fair enough that it's not on you, I can't make all other inventories behave either.
As this bug appears to be tracking the associated invalidation of the Router's inventory now, I won't close it.
But since the original issue is WONTFIX, I'll unsubscribe from this issue now.