Added missing capability invalidation
@@ -36,12 +36,10 @@ public class FractionalDrawerGroup extends BlockEntityDataShim implements IDrawe
private final FractionalDrawer[] slots;
private final int[] order;
- private final LazyOptional<IItemHandler> itemHandler;
- private final LazyOptional<IItemRepository> itemRepository;
+ private final LazyOptional<IItemHandler> itemHandler = LazyOptional.of(() -> new DrawerItemHandler(this));
+ private final LazyOptional<IItemRepository> itemRepository = LazyOptional.of(() -> new DrawerItemRepository(this));
public FractionalDrawerGroup (int slotCount) {
- itemHandler = LazyOptional.of(() -> new DrawerItemHandler(this));
- itemRepository = LazyOptional.of(() -> new DrawerItemRepository(this));
storage = new FractionalStorage(this, slotCount);
@@ -124,6 +122,13 @@ public class FractionalDrawerGroup extends BlockEntityDataShim implements IDrawe
protected void onAmountChanged () { }
+ @Override
+ public void invalidateCaps() {
+ super.invalidateCaps();
+ itemHandler.invalidate();
+ itemRepository.invalidate();
+ }
+
private static class FractionalStorage implements INBTSerializable<CompoundTag>
{
static Capability<IDrawerAttributes> ATTR_CAPABILITY = CapabilityManager.get(new CapabilityToken<>(){});
