AE2 Cells don't have extra information they should
This commit is contained in:
Vladimir Kalinin 2019-04-06 20:25:42 +03:00 committed by payonel
parent 2fd3bb4d3a
commit 3868f99798

View File

@ -3,6 +3,10 @@ package li.cil.oc.integration.appeng;
import appeng.api.AEApi;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import net.minecraft.item.ItemStack;
import li.cil.oc.api.driver.Converter;
import java.util.Map;
@ -31,6 +35,11 @@ public final class ConverterCellInventory implements Converter {
output.put("name", cell.getItemStack().getDisplayName());
} else if (value instanceof ICellInventoryHandler) {
convert(((ICellInventoryHandler) value).getCellInv(), output);
} else if ((value instanceof ItemStack) && (((ItemStack)value).getItem() instanceof IStorageCell)) {
IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory((ItemStack) value, null, StorageChannel.ITEMS);
if (inventory instanceof ICellInventoryHandler)
convert(((ICellInventoryHandler) inventory).getCellInv(), output);
}
}
}