should fix ICraftingStep#onReceiveOutput, #528
This commit is contained in:
@@ -72,8 +72,11 @@ public interface ICraftingStep {
|
|||||||
boolean hasReceivedOutput(ItemStack stack);
|
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
|
* @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);
|
boolean onReceiveOutput(ItemStack stack);
|
||||||
|
|
||||||
|
|||||||
@@ -123,14 +123,18 @@ public abstract class CraftingStep implements ICraftingStep {
|
|||||||
}
|
}
|
||||||
if (API.instance().getComparer().isEqual(stack, output, CraftingTask.DEFAULT_COMPARE | (getPattern().isOredict() ? IComparer.COMPARE_OREDICT : 0))) {
|
if (API.instance().getComparer().isEqual(stack, output, CraftingTask.DEFAULT_COMPARE | (getPattern().isOredict() ? IComparer.COMPARE_OREDICT : 0))) {
|
||||||
if (received < output.stackSize) {
|
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();
|
network.sendCraftingMonitorUpdate();
|
||||||
|
|
||||||
|
if (stack.stackSize == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -553,10 +553,11 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
|
|
||||||
if (!simulate && inserted > 0 && accessType != AccessType.WRITE) {
|
if (!simulate && inserted > 0 && accessType != AccessType.WRITE) {
|
||||||
itemStorage.add(ItemHandlerHelper.copyStackWithSize(stack, inserted), false);
|
itemStorage.add(ItemHandlerHelper.copyStackWithSize(stack, inserted), false);
|
||||||
|
ItemStack checkSteps = ItemHandlerHelper.copyStackWithSize(stack, inserted);
|
||||||
|
|
||||||
for (ICraftingTask task : craftingTasks) {
|
for (ICraftingTask task : craftingTasks) {
|
||||||
for (ICraftingStep processable : task.getSteps()) {
|
for (ICraftingStep processable : task.getSteps()) {
|
||||||
if (processable.onReceiveOutput(stack)) {
|
if (processable.onReceiveOutput(checkSteps)) {
|
||||||
return remainder; // All done
|
return remainder; // All done
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user