mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-12-22 15:39:22 +01:00
only resolve network locks if the items actually changed
This commit is contained in:
parent
04baa9577e
commit
82a885353e
1 changed files with 4 additions and 6 deletions
|
@ -90,15 +90,13 @@ public class CraftingModuleItem extends ModuleItem {
|
||||||
// if we're ensuring the correct item order and the item is already on the way, don't do anything yet
|
// if we're ensuring the correct item order and the item is already on the way, don't do anything yet
|
||||||
if (module.get(Contents.TYPE).insertionType != InsertionType.PER_ITEM || craft.travelingIngredients.isEmpty()) {
|
if (module.get(Contents.TYPE).insertionType != InsertionType.PER_ITEM || craft.travelingIngredients.isEmpty()) {
|
||||||
var equalityTypes = ItemFilter.getEqualityTypes(tile);
|
var equalityTypes = ItemFilter.getEqualityTypes(tile);
|
||||||
var remain = ingredient.map(l -> {
|
var remain = ingredient.map(
|
||||||
var ret = network.requestExistingItem(l.location, tile.getBlockPos(), dest.getLeft(), l, dest.getRight(), equalityTypes);
|
l -> network.requestExistingItem(l.location, tile.getBlockPos(), dest.getLeft(), l, dest.getRight(), equalityTypes),
|
||||||
if (ret.getCount() != l.stack.getCount())
|
s -> network.requestExistingItem(tile.getBlockPos(), dest.getLeft(), null, dest.getRight(), equalityTypes)).copy();
|
||||||
network.resolveNetworkLock(l);
|
|
||||||
return ret;
|
|
||||||
}, s -> network.requestExistingItem(tile.getBlockPos(), dest.getLeft(), null, dest.getRight(), equalityTypes));
|
|
||||||
// dest may be able to accept less than toRequest, so the amount that remains there also needs to be taken into account
|
// dest may be able to accept less than toRequest, so the amount that remains there also needs to be taken into account
|
||||||
remain.grow(toRequest.getCount() - dest.getRight().getCount());
|
remain.grow(toRequest.getCount() - dest.getRight().getCount());
|
||||||
if (remain.getCount() != dest.getRight().getCount()) {
|
if (remain.getCount() != dest.getRight().getCount()) {
|
||||||
|
ingredient.ifLeft(network::resolveNetworkLock);
|
||||||
if (!remain.isEmpty())
|
if (!remain.isEmpty())
|
||||||
craft.ingredientsToRequest.add(craft.ingredientsToRequest.indexOf(ingredient), Either.right(remain));
|
craft.ingredientsToRequest.add(craft.ingredientsToRequest.indexOf(ingredient), Either.right(remain));
|
||||||
craft.ingredientsToRequest.remove(ingredient);
|
craft.ingredientsToRequest.remove(ingredient);
|
||||||
|
|
Loading…
Reference in a new issue