mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-12-04 16:28:34 +01:00
small refactor
This commit is contained in:
parent
2c8ab9ed07
commit
805393ba6e
2 changed files with 13 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue