mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
apparently it is not legal to create an EnumSet from an empty collection
also, cherry pick 3868f997987b534ea4269392653582506667cdcb closes #3103
This commit is contained in:
parent
776df12376
commit
486b40c9a1
@ -130,7 +130,16 @@ class AppliedEnergistics2GridBlock(val tileEntity: AppliedEnergistics2) extends
|
|||||||
|
|
||||||
override def setNetworkStatus(p1: IGrid, p2: Int): Unit = {}
|
override def setNetworkStatus(p1: IGrid, p2: Int): Unit = {}
|
||||||
|
|
||||||
override def getConnectableSides: util.EnumSet[EnumFacing] = util.EnumSet.copyOf(JavaConversions.asJavaCollection(EnumFacing.values.filter(tileEntity.canConnectPower)))
|
override def getConnectableSides: util.EnumSet[EnumFacing] = {
|
||||||
|
val connectableSides = JavaConversions.asJavaCollection(EnumFacing.values.filter(tileEntity.canConnectPower))
|
||||||
|
if (connectableSides.isEmpty) {
|
||||||
|
val s = util.EnumSet.copyOf(JavaConversions.asJavaCollection(EnumFacing.values))
|
||||||
|
s.clear()
|
||||||
|
s
|
||||||
|
}
|
||||||
|
else
|
||||||
|
util.EnumSet.copyOf(connectableSides)
|
||||||
|
}
|
||||||
|
|
||||||
override def getMachine: IGridHost = tileEntity.asInstanceOf[IGridHost]
|
override def getMachine: IGridHost = tileEntity.asInstanceOf[IGridHost]
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package li.cil.oc.integration.appeng;
|
package li.cil.oc.integration.appeng;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.implementations.items.IStorageCell;
|
||||||
import appeng.api.storage.ICellInventory;
|
import appeng.api.storage.ICellInventory;
|
||||||
import appeng.api.storage.ICellInventoryHandler;
|
import appeng.api.storage.ICellInventoryHandler;
|
||||||
|
import appeng.api.storage.IMEInventoryHandler;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import li.cil.oc.api.driver.Converter;
|
import li.cil.oc.api.driver.Converter;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -32,6 +35,10 @@ public final class ConverterCellInventory implements Converter {
|
|||||||
output.put("name", cell.getItemStack().getDisplayName());
|
output.put("name", cell.getItemStack().getDisplayName());
|
||||||
} else if (value instanceof ICellInventoryHandler) {
|
} else if (value instanceof ICellInventoryHandler) {
|
||||||
convert(((ICellInventoryHandler) value).getCellInv(), output);
|
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, AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||||
|
if (inventory != null)
|
||||||
|
convert(((ICellInventoryHandler) inventory).getCellInv(), output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user