mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-22 19:58:35 +01:00
fixed non-stackable items not playing nice with the crafting terminal
This commit is contained in:
parent
ae5b81e933
commit
64e2b9c4fe
1 changed files with 6 additions and 2 deletions
|
@ -166,7 +166,10 @@ public class CraftingTerminalTileEntity extends ItemTerminalTileEntity {
|
||||||
for (int i = 0; i < tile.craftItems.getSlots(); i++) {
|
for (int i = 0; i < tile.craftItems.getSlots(); i++) {
|
||||||
ItemStack stack = tile.getRequestedCraftItem(i);
|
ItemStack stack = tile.getRequestedCraftItem(i);
|
||||||
int count = tile.isGhostItem(i) ? 0 : stack.getCount();
|
int count = tile.isGhostItem(i) ? 0 : stack.getCount();
|
||||||
if (!ItemHandlerHelper.canItemStacksStackRelaxed(stack, remain))
|
if (!ItemHandlerHelper.canItemStacksStack(stack, remain))
|
||||||
|
continue;
|
||||||
|
// ensure that a single non-stackable item can still enter a ghost slot
|
||||||
|
if (!stack.isStackable() && count >= 1)
|
||||||
continue;
|
continue;
|
||||||
if (lowestSlot < 0 || !tile.isGhostItem(lowestSlot) && count < tile.getRequestedCraftItem(lowestSlot).getCount())
|
if (lowestSlot < 0 || !tile.isGhostItem(lowestSlot) && count < tile.getRequestedCraftItem(lowestSlot).getCount())
|
||||||
lowestSlot = i;
|
lowestSlot = i;
|
||||||
|
@ -197,7 +200,8 @@ public class CraftingTerminalTileEntity extends ItemTerminalTileEntity {
|
||||||
continue;
|
continue;
|
||||||
MutableInt amount = requiredItems.computeIfAbsent(new EquatableItemStack(requested), s -> new MutableInt());
|
MutableInt amount = requiredItems.computeIfAbsent(new EquatableItemStack(requested), s -> new MutableInt());
|
||||||
amount.add(requested.getCount());
|
amount.add(requested.getCount());
|
||||||
int fit = requested.getMaxStackSize() - (isGhost.test(i) ? 0 : requested.getCount());
|
// if no items fit into the crafting input, we still want to pretend they do for requesting
|
||||||
|
int fit = Math.max(requested.getMaxStackSize() - (isGhost.test(i) ? 0 : requested.getCount()), 1);
|
||||||
if (lowestAvailable > fit)
|
if (lowestAvailable > fit)
|
||||||
lowestAvailable = fit;
|
lowestAvailable = fit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue