Integrated Dynamics

Integrated Dynamics

63M Downloads

1.16-1.18 LazyOptional.invalidate gets not called on TileEntities when removed

Speiger opened this issue ยท 4 comments

commented

Since 1.14 Capabilities are Cacheable due to forge adding a listener function that allows you get notified when capabilities unload.
If you cache a Capability and do not get notified that the capability got invalidated it just keeps the reference and doesn't see the new capability provider.

We just have a RF Producer that started voiding energy when we broke your battery and replaced it.

Required methods to simplify the fixing:

  • TileEntity.invalidateCaps is called from all the places where it needs to be
  • LazyOptional.invalidate invalidates the caches as needed.

Could you fix this please

commented

Those should be properly called since cap invalidation was added. Where exactly do you think it's not being called?

commented

https://github.com/CyclopsMC/CyclopsCore/blob/release-1.16/src/main/java/org/cyclops/cyclopscore/tileentity/CyclopsTileEntity.java#L259

You may have forgotten to implement that then, as looking through your code clearly shows that.

commented

Hmm, weird that this never popped up before. I'll have to look into that.

commented

Because a lot of mods ported straight from 1.12 and missed that feature.
Or do you cache capabilities of connecting blocks that you need to optimize performance?

(Because if you did you would have found the bug pretty quickly)