should fix ICraftingStep#onReceiveOutput, #528
This commit is contained in:
@@ -72,8 +72,11 @@ public interface ICraftingStep {
|
||||
boolean hasReceivedOutput(ItemStack stack);
|
||||
|
||||
/**
|
||||
* The {@link ItemStack} given to it will be changed and contain the remainder
|
||||
* The return value will only be true if the stack size is zero
|
||||
*
|
||||
* @param stack the stack that was inserted in the storage system
|
||||
* @return true if this item belonged to the processable item, false otherwise
|
||||
* @return true if this item belonged to the processable item and was fully used, false otherwise
|
||||
*/
|
||||
boolean onReceiveOutput(ItemStack stack);
|
||||
|
||||
|
||||
@@ -123,11 +123,15 @@ public abstract class CraftingStep implements ICraftingStep {
|
||||
}
|
||||
if (API.instance().getComparer().isEqual(stack, output, CraftingTask.DEFAULT_COMPARE | (getPattern().isOredict() ? IComparer.COMPARE_OREDICT : 0))) {
|
||||
if (received < output.stackSize) {
|
||||
satisfied.put(hashcode, received + stack.stackSize);
|
||||
int toReceive = Math.min(output.stackSize - received, stack.stackSize);
|
||||
satisfied.put(hashcode, received + toReceive);
|
||||
stack.stackSize -= toReceive;
|
||||
|
||||
network.sendCraftingMonitorUpdate();
|
||||
|
||||
return true;
|
||||
if (stack.stackSize == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,10 +553,11 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
if (!simulate && inserted > 0 && accessType != AccessType.WRITE) {
|
||||
itemStorage.add(ItemHandlerHelper.copyStackWithSize(stack, inserted), false);
|
||||
ItemStack checkSteps = ItemHandlerHelper.copyStackWithSize(stack, inserted);
|
||||
|
||||
for (ICraftingTask task : craftingTasks) {
|
||||
for (ICraftingStep processable : task.getSteps()) {
|
||||
if (processable.onReceiveOutput(stack)) {
|
||||
if (processable.onReceiveOutput(checkSteps)) {
|
||||
return remainder; // All done
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user