MineColonies

MineColonies

65M Downloads

Warehouse item capability is invalidated every tick leading to compatibility issues

jpenilla opened this issue · 10 comments

commented

Is there an existing issue for this?

  • I have searched the existing issues.

Are you using the latest MineColonies Version?

  • I am running the latest beta/release version of MineColonies for my Minecraft version.
    I am also running the latest versions of other mods that are part of my problem.

Did you check on the Wiki? or ask on Discord?

  • I checked the MineColonies Wiki and made sure my issue is not covered there. Or I was sent from discord to open an issue here.

What were you playing at the time? Were you able to reproduce it in both settings?

  • Single Player
  • Multi Player

Minecraft Version

1.21

MineColonies Version

1.1.875

Structurize Version

1.0.758

Related Mods and their Versions

AE2 latest master and 1.21.1 release

Current Behavior

The item handler capability for the warehouse block is invalidated and recreated every tick, which causes strange compatibility issues with other mods interacting with the inventory.

For example, when connecting a warehouse to an AE2 network using a storage bus, insert and extract operations will sporadically fail or succeed seemingly randomly, with export buses, interfaces, and player interactions behaving differently.

This is because whether the operation succeeds depends on the ordering of the capability invalidation relative to the operation (which is semi-random). I noticed this bug on a server when export buses would not work but inserting and extracting from a terminal would, and then later inserting from the terminal stopped working, and later reproduced it in a singleplayer world with a debugger attached. See the screenshots below for the two calls that happen each tick

Image
Image

Most other mods besides AE2 seem to work fine (i.e. MI pipes), however, depending on where in the tick loop they operate this problem could affect other mods too.

Expected Behavior

Capability is invalidated only when necessary, AE2 storage bus works normally.

Reproduction Steps

Attach an AE2 storage bus to a warehouse block and attempt to insert/extract items with terminals, import buses, export buses, interfaces, etc., and observe inconsistent and broken behavior.

Logs

https://mclo.gs/smM7B6a

Anything else?

No response

Footer


Viewers

  • Add a thumbs-up to the bug report if you are also affected. This helps the bug report become more visible to the team and doesn't clutter the comments.
  • Add a comment if you have any insights or background information that isn't already part of the conversation.
commented

For tom's simple storage hooking a terminal directly to warehouse block works, even with the wireless connection. However if you hook an inventory connector to it you get the flickering.

commented

Honestly, if you want to actually automate the warhouse, do not go via the capability as its wayyyyy too inefficient. We have very useful methods on the warehouse tileentity to check for existance and get the right tileentity sth is contained in

commented

Damm such a bad timing for me to decide to make a minecolony autmation with this exact mechanic...
It export like 3 items and then stop working all together. Ran straight into this issue 😭

Well, for anyone stuck with this issue, make a Refined Storage intermediate network, no disk, just the refined storage controller, and the External Storage attached to the Warehouse.

Unfortunatelly there is no 1 block connection between AE2 and Refined, so have to setup a big line of importer/exporter controlled with redstone, Refined controls the quantity and redstone signal, and import it from AE2 or whatever mod/storage

commented

lol that would be for modders, as a player, one just want to have access to the inventory, what is exactly what warehouse block does. But since its invalidated every frame, we kind of can't. Refined Storage does something right some how, or it actually does what you said, instead of reallying on the inventory. No modder my self, but the idea of something get invalidated every frame does seems weird

commented

Oh, so refined storage doesn't query a new one after the old one is invalidated? They try to maintain the same one even though it's invalid? Not saying our behaviour is perfect here, we should refine this. But other mods should be able to deal with the invalidated item handlers and just query a fresh one.

commented

What's blocking this: #10677

commented

"We actually went about this the wrong way a bit, we should change it to add an invalidatin listener to a rack, which when a rack becomes unavailable triggers the reset/invalidation of the combined inventory capability and that way forces a new one to be created"

commented

We both realized back when we made it, that that solution wasn't feasible, we literally discussed that in DM for him later to add that comment. So I ignored that

commented

Why isn't that feasible? Racks do know the warehouse/building. They can on unload call the building (if loaded), no?

commented

Why isn't that feasible? Racks do know the warehouse/building. They can on unload call the building (if loaded), no?

It's been a while, I'd have to check again what the reason was