small refactor

This commit is contained in:
Ell 2024-11-28 00:05:16 +01:00
parent 2c8ab9ed07
commit 805393ba6e
2 changed files with 13 additions and 13 deletions

View file

@ -328,6 +328,17 @@ public class CraftingModuleItem extends ModuleItem {
return ItemStack.EMPTY;
}
public boolean markCanceledOrResolve(PipeNetwork network) {
if (this.inProgress) {
this.canceled = true;
return false;
} else {
for (var lock : this.ingredientsToRequest)
network.resolveNetworkLock(lock);
return true;
}
}
}
}

View file

@ -216,19 +216,8 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
return;
for (var craftable : network.getAllCraftables(pipe.getBlockPos())) {
var otherPipe = network.getPipe(craftable.getLeft());
if (otherPipe != null) {
otherPipe.activeCrafts.removeIf(c -> {
var data = c.getRight();
if (data.inProgress) {
data.canceled = true;
return false;
} else {
for (var lock : data.ingredientsToRequest)
network.resolveNetworkLock(lock);
return true;
}
});
}
if (otherPipe != null)
otherPipe.activeCrafts.removeIf(c -> c.getRight().markCanceledOrResolve(network));
}
var lookingPlayers = this.getLookingPlayers();
if (lookingPlayers.length > 0)