mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-22 19:58:35 +01:00
made the crafting terminal ghost transfer also consider craftables
Closes #50
This commit is contained in:
parent
a5b7bd1e82
commit
bb62acf45f
1 changed files with 14 additions and 7 deletions
|
@ -75,13 +75,20 @@ public class CraftingTerminalTileEntity extends ItemTerminalTileEntity {
|
||||||
if (items.size() > 1) {
|
if (items.size() > 1) {
|
||||||
int highestAmount = 0;
|
int highestAmount = 0;
|
||||||
for (ItemStack stack : items) {
|
for (ItemStack stack : items) {
|
||||||
EquatableItemStack equatable = new EquatableItemStack(stack);
|
int amount = 0;
|
||||||
NetworkItem network = this.networkItems.get(equatable);
|
// check existing items
|
||||||
if (network == null)
|
NetworkItem network = this.networkItems.get(new EquatableItemStack(stack));
|
||||||
continue;
|
if (network != null) {
|
||||||
int amount = network.getLocations().stream()
|
amount = network.getLocations().stream()
|
||||||
.mapToInt(l -> l.getItemAmount(this.world, stack, ItemEqualityType.NBT))
|
.mapToInt(l -> l.getItemAmount(this.world, stack, ItemEqualityType.NBT))
|
||||||
.sum();
|
.sum();
|
||||||
|
}
|
||||||
|
// check craftables
|
||||||
|
if (amount <= 0 && highestAmount <= 0) {
|
||||||
|
PipeTileEntity pipe = this.getConnectedPipe();
|
||||||
|
if (pipe != null)
|
||||||
|
amount = PipeNetwork.get(this.world).getCraftableAmount(pipe.getPos(), null, stack, ItemEqualityType.NBT);
|
||||||
|
}
|
||||||
if (amount > highestAmount) {
|
if (amount > highestAmount) {
|
||||||
highestAmount = amount;
|
highestAmount = amount;
|
||||||
toSet = stack;
|
toSet = stack;
|
||||||
|
|
Loading…
Reference in a new issue