Skip to content

Commit 5760afc

Browse files
committed
fix #9
1 parent ec4ee58 commit 5760afc

3 files changed

Lines changed: 21 additions & 49 deletions

File tree

build.gradle

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -276,41 +276,6 @@ jar {
276276
from(provider{ configurations.embed.collect {it.isDirectory() ? it : zipTree(it)} })
277277
}
278278

279-
idea {
280-
module {
281-
inheritOutputDirs = true
282-
}
283-
project {
284-
settings {
285-
runConfigurations {
286-
"1. Run Client"(Gradle) {
287-
taskNames = ["runClient"]
288-
}
289-
"2. Run Server"(Gradle) {
290-
taskNames = ["runServer"]
291-
}
292-
"3. Run Obfuscated Client"(Gradle) {
293-
taskNames = ["runObfClient"]
294-
}
295-
"4. Run Obfuscated Server"(Gradle) {
296-
taskNames = ["runObfServer"]
297-
}
298-
'5. Build Jars'(Gradle) {
299-
taskNames = ['build']
300-
}
301-
}
302-
compiler.javac {
303-
afterEvaluate {
304-
javacAdditionalOptions = "-encoding utf8"
305-
moduleJavacAdditionalOptions = [
306-
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
307-
]
308-
}
309-
}
310-
}
311-
}
312-
}
313-
314279
compileTestJava {
315280
sourceCompatibility = targetCompatibility = 8
316281
}

gradle/scripts/dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ dependencies {
4646
compileOnly(rfg.deobf("curse.maven:thaumic-energistics-extended-life-849094:6321322"))
4747
implementation(rfg.deobf("curse.maven:mekanism-ce-399904:4804509")) //mek-ce
4848
implementation(rfg.deobf("curse.maven:mekanism-energistics-1027681:5389347")) //mekeng
49+
implementation(rfg.deobf("curse.maven:ae2-crafting-tree-legacy-1121489:5814089"))
4950
compileOnly(rfg.deobf('curse.maven:opencomputers-223008:4630537')) //oc
5051
compileOnly(rfg.deobf("curse.maven:p455w0rdslib-255232:2830265"))
5152
compileOnly(rfg.deobf("curse.maven:ae2wtlib-304024:2830114"))
5253
compileOnly(rfg.deobf("curse.maven:wireless-crafting-terminal-244559:2830252"))//wct
53-
implementation(rfg.deobf("curse.maven:ae2-crafting-tree-legacy-1121489:5814089"))
5454
}

src/main/java/com/glodblock/github/coremod/mixin/ae2/MixinNetworkInventoryHandler.java

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)