Skip to content

Commit fa355ac

Browse files
committed
修复bug
1 parent 0c7a4ad commit fa355ac

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/main/java/com/circulation/random_complement/mixin/ae2/miss_craft/MixinCraftingCPUCluster.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public abstract class MixinCraftingCPUCluster {
2828
@Unique
2929
private IAEItemStack r$waitInput;
3030

31+
@Unique
32+
private boolean r$canIgnoredInput = false;
33+
3134
@Shadow
3235
protected abstract void completeJob();
3336

@@ -36,7 +39,7 @@ public abstract class MixinCraftingCPUCluster {
3639

3740
@WrapOperation(method = "injectItems", at = @At(value = "INVOKE", target = "Ljava/lang/Object;equals(Ljava/lang/Object;)Z"))
3841
public boolean injectItems(Object instance, Object o, Operation<Boolean> original, @Local(name = "type") Actionable type) {
39-
if (r$waitInput != null && r$waitInput.equals(o)) {
42+
if (r$canIgnoredInput && r$waitInput != null && r$waitInput.equals(o)) {
4043
if (type == Actionable.MODULATE) {
4144
var size = ((IAEItemStack) o).getStackSize();
4245
if (r$waitInput.getStackSize() <= size) {
@@ -53,7 +56,7 @@ public boolean injectItems(Object instance, Object o, Operation<Boolean> origina
5356

5457
@Inject(method = "injectItems", at = @At("RETURN"))
5558
public void onStop(IAEItemStack input, Actionable type, IActionSource src, CallbackInfoReturnable<IAEItemStack> cir) {
56-
if (r$waitInput != null && this.finalOutput != null && this.finalOutput.getStackSize() <= 0) {
59+
if (r$canIgnoredInput && r$waitInput != null && this.finalOutput != null && this.finalOutput.getStackSize() <= 0) {
5760
this.completeJob();
5861
this.updateCPU();
5962
}
@@ -62,7 +65,7 @@ public void onStop(IAEItemStack input, Actionable type, IActionSource src, Callb
6265
@Inject(method = "submitJob", at = @At(value = "INVOKE", target = "Lappeng/crafting/CraftingTreeNode;setJob(Lappeng/crafting/MECraftingInventory;Lappeng/me/cluster/implementations/CraftingCPUCluster;Lappeng/api/networking/security/IActionSource;)V"))
6366
public void submitJob(IGrid g, ICraftingJob job, IActionSource src, ICraftingRequester requestingMachine, CallbackInfoReturnable<ICraftingLink> cir) {
6467
var j = (RCCraftingJob) job;
65-
if (!j.canIgnoredInput()) return;
68+
if (!(r$canIgnoredInput = j.canIgnoredInput())) return;
6669
var s = j.getWaitingItem();
6770
if (s != null && s.getStackSize() > 0) {
6871
r$waitInput = s.copy();

src/main/java/com/circulation/random_complement/mixin/ae2/miss_craft/MixinCraftingJob.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ public abstract class MixinCraftingJob implements RCCraftingJob {
5151

5252
@WrapOperation(method = "run", at = @At(value = "INVOKE", target = "Lappeng/crafting/MECraftingInventory;ignore(Lappeng/api/storage/data/IAEItemStack;)V", ordinal = 0))
5353
public void record(MECraftingInventory instance, IAEItemStack what, Operation<Void> original, @Share("rcOutput") LocalLongRef stackLocalRef) {
54-
if (!canIgnoredInput()) return;
55-
var stack = instance.getItemList().findPrecise(what);
56-
if (stack != null) {
57-
var size = stack.getStackSize();
58-
stackLocalRef.set(size);
59-
} else stackLocalRef.set(0);
54+
if (canIgnoredInput()) {
55+
var stack = instance.getItemList().findPrecise(what);
56+
if (stack != null) {
57+
var size = stack.getStackSize();
58+
stackLocalRef.set(size);
59+
} else stackLocalRef.set(0);
60+
}
6061
original.call(instance, what);
6162
}
6263

@@ -67,10 +68,9 @@ public IAEItemStack getWaitingItem() {
6768

6869
@Intrinsic
6970
public boolean canIgnoredInput() {
70-
if (this.actionSrc.player().isPresent()) return true;
7171
if (this.actionSrc.machine().orElse(null) instanceof AEIgnoredInputMachine a)
7272
return a.r$isIgnored();
73-
return false;
73+
else return this.actionSrc.player().isPresent();
7474
}
7575

7676
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lappeng/crafting/CraftingTreeNode;request(Lappeng/crafting/MECraftingInventory;JLappeng/api/networking/security/IActionSource;)Lappeng/api/storage/data/IAEItemStack;", shift = At.Shift.AFTER, ordinal = 0))

0 commit comments

Comments
 (0)