allow for cleaner override
This commit is contained in:
@@ -134,21 +134,29 @@ public interface ICraftingPatternContainer {
|
||||
* Called when the autocrafting system wants to insert items. Will be called with Action.SIMULATE first and if that
|
||||
* succeeds will be called again with Action.PERFORM
|
||||
*
|
||||
* @param dest The ItemHandler to insert into
|
||||
* @param toInsert A collection of items that should be inserted.
|
||||
* @param action Action to take
|
||||
* @return whether the insertion was successful
|
||||
*/
|
||||
boolean insertIntoInventory(@Nullable IItemHandler dest, Collection<StackListEntry<ItemStack>> toInsert, Action action);
|
||||
boolean insertItemsIntoInventory(Collection<StackListEntry<ItemStack>> toInsert, Action action);
|
||||
|
||||
/**
|
||||
* Called when the autocrafting system wants to insert fluids. Will be called with Action.SIMULATE first and if that
|
||||
* succeeds will be called again with Action.PERFORM
|
||||
*
|
||||
* @param dest The FluidHandler to insert into
|
||||
* @param toInsert A collection of fluids that should be inserted.
|
||||
* @param action Action to take
|
||||
* @return whether the insertion was successful
|
||||
*/
|
||||
boolean insertIntoInventory(IFluidHandler dest, Collection<StackListEntry<FluidStack>> toInsert, Action action);
|
||||
boolean insertFluidsIntoInventory(Collection<StackListEntry<FluidStack>> toInsert, Action action);
|
||||
|
||||
/**
|
||||
* @return whether the container is successfully connected to the inventory it wants to insert to
|
||||
*/
|
||||
boolean hasConnectedInventory();
|
||||
|
||||
/**
|
||||
* @return whether the container is successfully connected to the fluid inventory it wants to insert to
|
||||
*/
|
||||
boolean hasConnectedFluidInventory();
|
||||
}
|
||||
|
@@ -104,8 +104,8 @@ public class ProcessingNode extends Node {
|
||||
allLocked = false;
|
||||
}
|
||||
|
||||
if ((!singleItemSetToRequire.isEmpty() && container.getConnectedInventory() == null) ||
|
||||
(!singleFluidSetToRequire.isEmpty() && container.getConnectedFluidInventory() == null)) {
|
||||
if ((!singleItemSetToRequire.isEmpty() && container.hasConnectedInventory()) ||
|
||||
(!singleFluidSetToRequire.isEmpty() && container.hasConnectedFluidInventory())) {
|
||||
if (allMissingMachine) {
|
||||
this.state = ProcessingState.MACHINE_NONE;
|
||||
}
|
||||
@@ -128,9 +128,9 @@ public class ProcessingNode extends Node {
|
||||
|
||||
boolean canInsertFullAmount = false;
|
||||
if (hasAllRequirements) {
|
||||
canInsertFullAmount = container.insertIntoInventory(container.getConnectedInventory(), extractedItems.getStacks(), Action.SIMULATE);
|
||||
canInsertFullAmount = container.insertItemsIntoInventory(extractedItems.getStacks(), Action.SIMULATE);
|
||||
if (canInsertFullAmount) {
|
||||
canInsertFullAmount = container.insertIntoInventory(container.getConnectedFluidInventory(), extractedFluids.getStacks(), Action.SIMULATE);
|
||||
canInsertFullAmount = container.insertFluidsIntoInventory(extractedFluids.getStacks(), Action.SIMULATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,8 +150,8 @@ public class ProcessingNode extends Node {
|
||||
extractedItems = IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(false), internalStorage, Action.PERFORM);
|
||||
extractedFluids = IoUtil.extractFromInternalFluidStorage(requirements.getSingleFluidRequirementSet(false), internalFluidStorage, Action.PERFORM);
|
||||
|
||||
container.insertIntoInventory(container.getConnectedInventory(), extractedItems.getStacks(), Action.PERFORM);
|
||||
container.insertIntoInventory(container.getConnectedFluidInventory(), extractedFluids.getStacks(), Action.PERFORM);
|
||||
container.insertItemsIntoInventory(extractedItems.getStacks(), Action.PERFORM);
|
||||
container.insertFluidsIntoInventory(extractedFluids.getStacks(), Action.PERFORM);
|
||||
|
||||
next();
|
||||
|
||||
|
@@ -464,7 +464,9 @@ public class CrafterNetworkNode extends NetworkNode implements ICraftingPatternC
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertIntoInventory(@Nullable IItemHandler dest, Collection<StackListEntry<ItemStack>> toInsert, Action action) {
|
||||
public boolean insertItemsIntoInventory(Collection<StackListEntry<ItemStack>> toInsert, Action action) {
|
||||
IItemHandler dest = getConnectedInventory();
|
||||
|
||||
if (dest == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -518,7 +520,13 @@ public class CrafterNetworkNode extends NetworkNode implements ICraftingPatternC
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertIntoInventory(IFluidHandler dest, Collection<StackListEntry<FluidStack>> toInsert, Action action) {
|
||||
public boolean insertFluidsIntoInventory(Collection<StackListEntry<FluidStack>> toInsert, Action action) {
|
||||
IFluidHandler dest = getConnectedFluidInventory();
|
||||
|
||||
if (dest == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (StackListEntry<FluidStack> entry : toInsert) {
|
||||
int filled = dest.fill(entry.getStack(), action == Action.SIMULATE ? IFluidHandler.FluidAction.SIMULATE : IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
@@ -533,4 +541,14 @@ public class CrafterNetworkNode extends NetworkNode implements ICraftingPatternC
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedInventory() {
|
||||
return getConnectedInventory() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedFluidInventory() {
|
||||
return getConnectedFluidInventory() != null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user