Custom Machinery

Custom Machinery

3M Downloads

Machine voids items when ME Interface is broken

andriihorpenko opened this issue · 2 comments

commented

Description

Under specific circumstances, machine voids items into nowhere. Tested with ME Interface as output target, cannot be reproduced with a vanilla chest.

Cause

CustomMachinery caches LazyOptional and expects mods to properly call LazyOptional#invalidate on their side.

neighbour.addListener(cap -> this.neighbourStorages.remove(side));

MinecraftForge officials once told me to never rely on that as modders often ignore that extra step with capabilities.
For instance, Applied Energistics 2, does not properly use capability invalidation and use throwaway instances instead. That way, invalidation hook is never called.

Opinions on relying on LazyOptional caching in MinecraftForge Discord (NeoForge nowadays):
https://discord.com/channels/313125603924639766/540691915373412393/1034222357881036841
https://discord.com/channels/313125603924639766/915304642668290119/1111426146324729937

Suggestion regarding and alternative way of caching:
https://discord.com/channels/313125603924639766/915304642668290119/1111426205552488549

Reproduction steps

  1. Place machine
  2. Place ME Interface on top
  3. Setup output to top side and enable auto-output
  4. Start processing so that items get outputted into ME Interface
  5. Break ME Interface
  6. Observe items being voided into nowhere

Video

custommachinery.mp4
commented

I see, thanks for your investigations, I did not expect a big mod like AE2 to openly break Forge's capabilities.
I get that this LazyOptional system is shitty and I hope NeoForge will come with something better but for now that's the system we got and willingly breaking it is a really bad move from AE2.
So I get it, I will update CM to not rely on caps invalidation, thanks again for reporting that issue.

commented

Should be fixed in latest version