Skip to content

Commit

Permalink
Implement cancelCraftingTasks for the ME Bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
SirEndii committed Apr 26, 2024
1 parent ab0d58a commit b735bde
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ttoolkit_version=0.1.3
cc_version=1.101.3
curios_version=1.19.2-5.1.4.1
minecolonies_version=1.19.2-1.1.473-BETA
appliedenergistics_version=12.9.8
appliedenergistics_version=12.9.9
patchouli_version=1.19.2-77
refinedstorage_version=1.11.7
botania_version=1.19.2-440-FORGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import appeng.api.stacks.AEFluidKey;
import appeng.api.stacks.AEItemKey;
import appeng.api.storage.MEStorage;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import dan200.computercraft.api.lua.IArguments;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.lua.LuaFunction;
Expand Down Expand Up @@ -598,6 +599,7 @@ public final MethodResult craftFluid(IComputerAccess computer, IArguments argume
}

@Override
@LuaFunction(mainThread = true)
public MethodResult getCraftingTasks() {
if (!isAvailable())
return notConnected();
Expand All @@ -614,7 +616,8 @@ public MethodResult getCraftingTasks() {
}

@Override
public MethodResult cancelCraftingTasks(IArguments arguments) throws LuaException {
@LuaFunction(mainThread = true)
public MethodResult cancelCraftingTasks(IArguments arguments) {
if (!isAvailable())
return notConnected();

Expand All @@ -634,14 +637,16 @@ public MethodResult cancelCraftingTasks(IArguments arguments) throws LuaExceptio
if (filter.getRight() != null)
return MethodResult.of(null, filter.getRight());

//TODO: See https://github.com/AppliedEnergistics/Applied-Energistics-2/issues/7560
/*
int jobsCanceled = 0;
for (ICraftingCPU cpu : craftingGrid.getCpus()) {
if (cpu.getJobStatus() != null) {
if (cpu.getJobStatus() != null && filter.getLeft().test(cpu.getJobStatus().crafting())) {
if (cpu instanceof CraftingCPUCluster cpuCluster) {
cpuCluster.cancel();
jobsCanceled++;
}
}
}
*/
return null;
return MethodResult.of(jobsCanceled, "SUCCESSFUL");
}

@Override
Expand Down

0 comments on commit b735bde

Please sign in to comment.