owmii / Lollipop

A library mod for Owmii's mods.
GNU Lesser General Public License v3.0
3 stars 11 forks source link

Capability implementation is wrong #6

Closed pupnewfster closed 3 years ago

pupnewfster commented 3 years ago

https://github.com/owmii/Lollipop/blob/1.16/src/main/java/owmii/lib/block/AbstractEnergyStorage.java#L76-L101 If you read the docs on getCapability and also LazyOptional#invalidate you will see that this implementation is incorrect. You are not supposed to be returning a new lazy optional each time, and you are supposed to invalidate it when it is no longer valid (such as when the tile unloads).

owmii commented 3 years ago

Oh! Thanks, I will find some way to use the Direction parameter without executing multiple LazyOptionalinstances. Sorry for the late reply!! :[