From ff1ccbecbbb9632e90451b2ef78c48e17a769e38 Mon Sep 17 00:00:00 2001 From: 90 Date: Sun, 2 Jun 2024 17:26:05 +0100 Subject: [PATCH] LazyOptional fucking sucks --- .../java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java b/src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java index f2796cb..75cfd9f 100644 --- a/src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java +++ b/src/main/java/gripe/_90/appliede/me/misc/EMCInterfaceLogic.java @@ -56,7 +56,6 @@ public class EMCInterfaceLogic implements IActionHost, IGridTickable, IUpgradeab private final IActionSource source = IActionSource.ofMachine(this); private final LazyOptional storageHolder; - private final LazyOptional localInvHolder; @Nullable private WrappedEMCStorage emcStorage; @@ -85,7 +84,6 @@ public EMCInterfaceLogic(IManagedGridNode node, EMCInterfaceLogicHost host, Item storage.useRegisteredCapacities(); storageHolder = LazyOptional.of(() -> storage).lazyMap(GenericStackItemStorage::new); - localInvHolder = LazyOptional.of(this::getInventory); } public ConfigInventory getConfig() { @@ -298,8 +296,8 @@ private void readConfig() { } private void onConfigRowChanged() { - readConfig(); host.saveChanges(); + readConfig(); } private void onStorageChanged() { @@ -354,7 +352,7 @@ public LazyOptional getCapability(Capability cap) { if (cap == ForgeCapabilities.ITEM_HANDLER) { return storageHolder.cast(); } else if (cap == Capabilities.STORAGE) { - return localInvHolder.cast(); + return LazyOptional.of(this::getInventory).cast(); } else { return LazyOptional.empty(); } @@ -362,7 +360,6 @@ public LazyOptional getCapability(Capability cap) { public void invalidateCaps() { storageHolder.invalidate(); - localInvHolder.invalidate(); } private class WrappedEMCStorage implements MEStorage {