}
public static ItemStack extract(IInventory inventory, ForgeDirection direction, boolean simulate){
if(inventory instanceof ISidedInventory) {
ISidedInventory isidedinventory = (ISidedInventory)inventory;
int[] accessibleSlotsFromSide = isidedinventory.getAccessibleSlotsFromSide(direction.ordinal());
for(int anAccessibleSlotsFromSide : accessibleSlotsFromSide) {
ItemStack stack = extract(inventory, direction, anAccessibleSlotsFromSide, simulate);
if(stack != null) return stack;
}