@@ -60,6 +60,8 @@ public abstract class MixinNetworkInventoryHandler<T extends IAEStack<T>> implem
6060 @ Shadow
6161 protected abstract Deque <?> getDepth (Actionable type );
6262
63+ @ Shadow @ Final private SecurityCache security ;
64+
6365 @ Inject (method = "<init>" , at = @ At ("TAIL" ))
6466 public void onInit (final IStorageChannel <?> chan , final SecurityCache security , final CallbackInfo ci ) {
6567 monitor = security .getGrid ().<IStorageGrid >getCache (IStorageGrid .class ).getInventory (Util .getItemChannel ());
@@ -68,14 +70,23 @@ public void onInit(final IStorageChannel<?> chan, final SecurityCache security,
6870 @ Inject (method = "injectItems" , at = @ At (value = "INVOKE" , target = "Ljava/util/NavigableMap;values()Ljava/util/Collection;" , ordinal = 1 ), cancellable = true )
6971 private void notItemInject (final T input , final Actionable mode , final IActionSource src , final CallbackInfoReturnable <T > cir ) {
7072 if (input == null || input instanceof IAEItemStack ) return ;
71- if (src instanceof FakeMonitor .FakeMonitorSource || mode == Actionable .SIMULATE ) return ;
73+ if (mode == Actionable .SIMULATE ) return ;
74+ if (src instanceof FakeMonitor .FakeMonitorSource m ) {
75+ var o = m .machine ();
76+ if (o .isPresent ()) {
77+ var machine = o .get ();
78+ if (machine .getActionableNode ().getGrid () == this .security .getGrid ()) {
79+ return ;
80+ }
81+ }
82+ }
7283 final var drop = Util .packAEStackToDrop (input );
7384 if (drop != null ) {
74- if (!this .getDepth (mode ).isEmpty ()) this .surface (( NetworkInventoryHandler < T >) ( Object ) this , mode );
85+ if (!this .getDepth (mode ).isEmpty ()) this .surface (null , mode );
7586 cir .setReturnValue (FakeItemRegister .getAEStack (monitor .injectItems (drop , mode , src )));
7687 this .diveList ((NetworkInventoryHandler <T >) (Object ) this , mode );
7788 } else return ;
78- this .surface (( NetworkInventoryHandler < T >) ( Object ) this , mode );
89+ this .surface (null , mode );
7990 }
8091
8192 @ Inject (method = "injectItems" , at = @ At (value = "FIELD" , target = "Lappeng/me/storage/NetworkInventoryHandler;priorityInventory:Ljava/util/NavigableMap;" , opcode = Opcodes .GETFIELD ), cancellable = true )
@@ -94,7 +105,7 @@ private void injectItemsN(final T input, final Actionable mode, final IActionSou
94105 fakeInput .set (true );
95106 return ;
96107 }
97- this .surface (( NetworkInventoryHandler < T >) ( Object ) this , mode );
108+ this .surface (null , mode );
98109 }
99110
100111 @ Inject (method = "injectItems" , at = @ At (value = "INVOKE" , target = "Ljava/util/List;iterator()Ljava/util/Iterator;" , ordinal = 2 ), cancellable = true )
@@ -113,32 +124,28 @@ private void injectItems(final T input, final Actionable mode, final IActionSour
113124 fakeInput .set (true );
114125 return ;
115126 }
116- this .surface (( NetworkInventoryHandler < T >) ( Object ) this , mode );
127+ this .surface (null , mode );
117128 }
118129
119130 @ Inject (method = "extractItems" , at = @ At (value = "FIELD" , target = "Lappeng/me/storage/NetworkInventoryHandler;priorityInventory:Ljava/util/NavigableMap;" , opcode = Opcodes .GETFIELD ), cancellable = true )
120131 public void extractItems (final T request , final Actionable mode , final IActionSource src , final CallbackInfoReturnable <T > cir ) {
121132 if (request == null ) return ;
122- boolean work = false ;
123133 if (request instanceof final IAEItemStack i ) {
124134 if (i .getItem () == FCItems .FLUID_DROP ) {
125135 cir .setReturnValue ((T ) fluidMonitor .extractItems (i , mode , src ));
126- work = true ;
127136 } else if (ModAndClassUtil .GAS && i .getItem () == FCGasItems .GAS_DROP ) {
128137 cir .setReturnValue ((T ) gasMonitor .extractItems (i , mode , src ));
129- work = true ;
130- }
138+ } else return ;
131139 } else {
132140 if (src instanceof FakeMonitor .FakeMonitorSource || mode == Actionable .SIMULATE ) return ;
133141 final var drop = Util .packAEStackToDrop (request );
134142 if (drop != null ) {
135- this .surface (( NetworkInventoryHandler < T >) ( Object ) this , mode );
143+ this .surface (null , mode );
136144 cir .setReturnValue (FakeItemRegister .getAEStack (monitor .extractItems (drop , mode , src )));
137145 this .diveList ((NetworkInventoryHandler <T >) (Object ) this , mode );
138- work = true ;
139- }
146+ } else return ;
140147 }
141- if ( work ) this .surface (( NetworkInventoryHandler < T >) ( Object ) this , mode );
148+ this .surface (null , mode );
142149 }
143150
144151 @ Override
0 commit comments