mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-12-05 00:38:35 +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;
|
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;
|
return;
|
||||||
for (var craftable : network.getAllCraftables(pipe.getBlockPos())) {
|
for (var craftable : network.getAllCraftables(pipe.getBlockPos())) {
|
||||||
var otherPipe = network.getPipe(craftable.getLeft());
|
var otherPipe = network.getPipe(craftable.getLeft());
|
||||||
if (otherPipe != null) {
|
if (otherPipe != null)
|
||||||
otherPipe.activeCrafts.removeIf(c -> {
|
otherPipe.activeCrafts.removeIf(c -> c.getRight().markCanceledOrResolve(network));
|
||||||
var data = c.getRight();
|
|
||||||
if (data.inProgress) {
|
|
||||||
data.canceled = true;
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
for (var lock : data.ingredientsToRequest)
|
|
||||||
network.resolveNetworkLock(lock);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var lookingPlayers = this.getLookingPlayers();
|
var lookingPlayers = this.getLookingPlayers();
|
||||||
if (lookingPlayers.length > 0)
|
if (lookingPlayers.length > 0)
|
||||||
|
|
Loading…
Reference in a new issue