use of buildcraft.lib.tile.item.ItemHandlerSimple in project BuildCraft by BuildCraft.
the class ItemTransactorTester method testLimitedInventory.
@Test
public void testLimitedInventory() {
IItemTransactor limited = new ItemHandlerSimple(2, (i, s) -> true, StackInsertionFunction.getInsertionFunction(4), null);
ItemStack toInsert = new ItemStack(Items.APPLE, 9);
ItemStack toInsertCopy = toInsert.copy();
ItemStack supposedLeftOver = new ItemStack(Items.APPLE);
ItemStack actuallyLeftOver = limited.insert(toInsert, false, false);
Assert.assertTrue(ItemStack.areItemStacksEqual(toInsert, toInsertCopy));
Assert.assertTrue(ItemStack.areItemStacksEqual(supposedLeftOver, actuallyLeftOver));
}
use of buildcraft.lib.tile.item.ItemHandlerSimple in project BuildCraft by BuildCraft.
the class ItemTransactorTester method testSimpleMoving.
@Test
public void testSimpleMoving() {
IItemTransactor trans = new ItemHandlerSimple(2, null);
Assert.assertTrue(trans.extract(null, 1, 1, false).isEmpty());
ItemStack insert = new ItemStack(Items.APPLE);
ItemStack leftOver = trans.insert(insert.copy(), false, false);
Assert.assertTrue(leftOver.isEmpty());
ItemStack extracted = trans.extract(null, 1, 1, false);
Assert.assertTrue(ItemStack.areItemStacksEqual(insert, extracted));
extracted = trans.extract(null, 1, 1, false);
Assert.assertTrue(extracted.isEmpty());
}
Aggregations