mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 03:36:47 -04:00
Explicit type conversion for hash map (#3080)
This commit is contained in:
parent
7737a64c79
commit
99902fd205
@ -63,11 +63,14 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
|||||||
private def allCraftables: Iterable[IAEItemStack] = allItems.collect{ case aeItem if aeItem.isCraftable => aeCraftItem(aeItem) }
|
private def allCraftables: Iterable[IAEItemStack] = allItems.collect{ case aeItem if aeItem.isCraftable => aeCraftItem(aeItem) }
|
||||||
|
|
||||||
private def convert(aeItem: IAEItemStack): java.util.HashMap[String, AnyRef] = {
|
private def convert(aeItem: IAEItemStack): java.util.HashMap[String, AnyRef] = {
|
||||||
case class StringAnyRefHash (value: java.util.HashMap[String, AnyRef])
|
def hashConvert(value: java.util.HashMap[_, _]) = {
|
||||||
|
val hash = new java.util.HashMap[String, AnyRef]
|
||||||
|
value.collect{ case (k:String, v:AnyRef) => hash += k -> v }
|
||||||
|
hash
|
||||||
|
}
|
||||||
val potentialItem = aePotentialItem(aeItem)
|
val potentialItem = aePotentialItem(aeItem)
|
||||||
val result = Registry
|
val result = Registry.convert(Array[AnyRef](potentialItem.getItemStack))
|
||||||
.convert(Array[AnyRef](potentialItem.getItemStack))
|
.collect { case hash: java.util.HashMap[_,_] => hashConvert(hash) }
|
||||||
.collect { case StringAnyRefHash(hash) => hash }
|
|
||||||
if (result.length > 0) {
|
if (result.length > 0) {
|
||||||
val hash = result(0)
|
val hash = result(0)
|
||||||
// it would have been nice to put these fields in a registry convert
|
// it would have been nice to put these fields in a registry convert
|
||||||
|
Loading…
x
Reference in New Issue
Block a user