虚拟合成卡改为任务完成,而非直接取消任务
This commit is contained in:
parent
28cf03bbf4
commit
dc0d8d457a
|
|
@ -4,10 +4,14 @@ import appeng.crafting.execution.CraftingCpuLogic;
|
|||
import appeng.crafting.execution.ExecutingCraftingJob;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(value = CraftingCpuLogic.class, remap = false)
|
||||
public interface CraftingCpuLogicAccessor {
|
||||
|
||||
@Accessor("job")
|
||||
ExecutingCraftingJob extendedae_plus$getJob();
|
||||
|
||||
@Invoker("finishJob")
|
||||
void extendedae_plus$invokeFinishJob(boolean success);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.extendedae_plus.mixin.ae2.accessor;
|
||||
|
||||
import appeng.api.crafting.IPatternDetails;
|
||||
import appeng.api.stacks.GenericStack;
|
||||
import appeng.crafting.CraftingLink;
|
||||
import appeng.crafting.execution.ExecutingCraftingJob;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
|
@ -12,4 +14,16 @@ public interface ExecutingCraftingJobAccessor {
|
|||
|
||||
@Accessor("tasks")
|
||||
Map<IPatternDetails, ExecutingCraftingJobTaskProgressAccessor> extendedae_plus$getTasks();
|
||||
|
||||
@Accessor("playerId")
|
||||
Integer extendedae_plus$getPlayerId();
|
||||
|
||||
@Accessor("finalOutput")
|
||||
GenericStack extendedae_plus$getFinalOutput();
|
||||
|
||||
@Accessor("remainingAmount")
|
||||
long extendedae_plus$getRemainingAmount();
|
||||
|
||||
@Accessor("link")
|
||||
CraftingLink extendedae_plus$getLink();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,11 @@ public abstract class PatternProviderLogicCompatMixin implements IUpgradeableObj
|
|||
return;
|
||||
}
|
||||
|
||||
var be = this.host.getBlockEntity();
|
||||
if (be == null || be.getLevel() == null || be.getLevel().isClientSide) {
|
||||
return;
|
||||
}
|
||||
|
||||
var grid = getGrid();
|
||||
if (grid == null) {
|
||||
return;
|
||||
|
|
@ -140,7 +145,12 @@ public abstract class PatternProviderLogicCompatMixin implements IUpgradeableObj
|
|||
var tasks = accessor.extendedae_plus$getTasks();
|
||||
var progress = tasks.get(patternDetails);
|
||||
if (progress != null && progress.extendedae_plus$getValue() <= 1) {
|
||||
cluster.cancelJob();
|
||||
cluster.updateOutput(null);
|
||||
try {
|
||||
logicAccessor.extendedae_plus$invokeFinishJob(true);
|
||||
} catch (Throwable ignored) {
|
||||
cluster.cancelJob();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user