Updated the Alchemy Table recipe system so that it can provide better custom recipes
This commit is contained in:
parent
a5dee50984
commit
86efa8b1a3
12 changed files with 212 additions and 218 deletions
|
@ -373,20 +373,8 @@ public class Utils
|
|||
if (tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, dir))
|
||||
{
|
||||
IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, dir);
|
||||
int numberOfSlots = handler.getSlots();
|
||||
|
||||
ItemStack copyStack = stack.copy();
|
||||
|
||||
for (int slot = 0; slot < numberOfSlots; slot++)
|
||||
{
|
||||
copyStack = handler.insertItem(slot, copyStack, false);
|
||||
if (copyStack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return copyStack;
|
||||
return insertStackIntoTile(stack, handler);
|
||||
} else if (tile instanceof IInventory)
|
||||
{
|
||||
return insertStackIntoInventory(stack, (IInventory) tile, dir);
|
||||
|
@ -395,6 +383,24 @@ public class Utils
|
|||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack insertStackIntoTile(ItemStack stack, IItemHandler handler)
|
||||
{
|
||||
int numberOfSlots = handler.getSlots();
|
||||
|
||||
ItemStack copyStack = stack.copy();
|
||||
|
||||
for (int slot = 0; slot < numberOfSlots; slot++)
|
||||
{
|
||||
copyStack = handler.insertItem(slot, copyStack, false);
|
||||
if (copyStack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return copyStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the desired stack into the tile up to a limit for the tile.
|
||||
* Respects capabilities.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue