use of org.spongepowered.api.item.inventory.type.GridInventory in project SpongeCommon by SpongePowered.
the class InventorySetOpsTest method testUnion.
private void testUnion() {
Inventory chest = Inventory.builder().build(this);
Inventory firstSlots = chest.query(QueryOperationTypes.INVENTORY_PROPERTY.of(SlotIndex.of(0)));
Inventory firstRow = chest.query(QueryOperationTypes.INVENTORY_TYPE.of(InventoryRow.class)).first();
GridInventory grid = chest.query(QueryOperationTypes.INVENTORY_TYPE.of(GridInventory.class));
InventoryColumn firstCol = grid.getColumn(0).get();
InventoryColumn secondCol = grid.getColumn(1).get();
Inventory union = firstSlots.union(firstCol).union(firstRow);
Inventory union2 = firstCol.union(firstRow);
Inventory union3 = firstCol.union(secondCol);
Preconditions.checkState(union.capacity() == 11, "This should include all eleven slot of the first row and column!");
Preconditions.checkState(union2.capacity() == 11, "This should include all eleven slot of the first row and column!");
Preconditions.checkState(union3.capacity() == 6, "This should include all six slot of the first 2 columns!");
}
Aggregations