mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-12-22 23:39:22 +01:00
parent
4a04535050
commit
1e027ff825
1 changed files with 8 additions and 3 deletions
|
@ -175,6 +175,7 @@ public class CraftingModuleItem extends ModuleItem {
|
||||||
@Override
|
@Override
|
||||||
public int getCraftableAmount(ItemStack module, PipeBlockEntity tile, Consumer<ItemStack> unavailableConsumer, ItemStack stack, Stack<ItemStack> dependencyChain) {
|
public int getCraftableAmount(ItemStack module, PipeBlockEntity tile, Consumer<ItemStack> unavailableConsumer, ItemStack stack, Stack<ItemStack> dependencyChain) {
|
||||||
var network = PipeNetwork.get(tile.getLevel());
|
var network = PipeNetwork.get(tile.getLevel());
|
||||||
|
network.startProfile("get_craftable_amount");
|
||||||
var items = network.getOrderedNetworkItems(tile.getBlockPos());
|
var items = network.getOrderedNetworkItems(tile.getBlockPos());
|
||||||
var equalityTypes = ItemFilter.getEqualityTypes(tile);
|
var equalityTypes = ItemFilter.getEqualityTypes(tile);
|
||||||
var content = module.get(Contents.TYPE);
|
var content = module.get(Contents.TYPE);
|
||||||
|
@ -189,6 +190,7 @@ public class CraftingModuleItem extends ModuleItem {
|
||||||
craftable += out.getCount() * availableCrafts;
|
craftable += out.getCount() * availableCrafts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
network.endProfile();
|
||||||
return craftable;
|
return craftable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,11 +200,13 @@ public class CraftingModuleItem extends ModuleItem {
|
||||||
var craftableAmount = this.getCraftableAmount(module, tile, unavailableConsumer, stack, dependencyChain);
|
var craftableAmount = this.getCraftableAmount(module, tile, unavailableConsumer, stack, dependencyChain);
|
||||||
if (craftableAmount <= 0)
|
if (craftableAmount <= 0)
|
||||||
return Pair.of(stack, List.of());
|
return Pair.of(stack, List.of());
|
||||||
var slot = tile.getModuleSlot(module);
|
|
||||||
var contents = module.get(Contents.TYPE);
|
|
||||||
|
|
||||||
var network = PipeNetwork.get(tile.getLevel());
|
var network = PipeNetwork.get(tile.getLevel());
|
||||||
|
network.startProfile("craft");
|
||||||
|
|
||||||
var items = network.getOrderedNetworkItems(tile.getBlockPos());
|
var items = network.getOrderedNetworkItems(tile.getBlockPos());
|
||||||
|
var slot = tile.getModuleSlot(module);
|
||||||
|
var contents = module.get(Contents.TYPE);
|
||||||
|
|
||||||
var equalityTypes = ItemFilter.getEqualityTypes(tile);
|
var equalityTypes = ItemFilter.getEqualityTypes(tile);
|
||||||
var resultAmount = this.getResultAmountPerCraft(module, stack, equalityTypes);
|
var resultAmount = this.getResultAmountPerCraft(module, stack, equalityTypes);
|
||||||
|
@ -246,6 +250,7 @@ public class CraftingModuleItem extends ModuleItem {
|
||||||
allCrafts.add(activeCraft);
|
allCrafts.add(activeCraft);
|
||||||
leftOfRequest -= crafted;
|
leftOfRequest -= crafted;
|
||||||
}
|
}
|
||||||
|
network.endProfile();
|
||||||
|
|
||||||
var remain = stack.copy();
|
var remain = stack.copy();
|
||||||
remain.shrink(resultAmount * toCraft);
|
remain.shrink(resultAmount * toCraft);
|
||||||
|
|
Loading…
Reference in a new issue