From 99902fd205d8d77f395f053f9a5540bca5eabd9f Mon Sep 17 00:00:00 2001 From: Vladimir Kalinin Date: Sat, 6 Apr 2019 20:25:42 +0300 Subject: [PATCH] Explicit type conversion for hash map (#3080) --- .../li/cil/oc/integration/appeng/NetworkControl.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/scala/li/cil/oc/integration/appeng/NetworkControl.scala b/src/main/scala/li/cil/oc/integration/appeng/NetworkControl.scala index a808a3cb2..98922e55a 100644 --- a/src/main/scala/li/cil/oc/integration/appeng/NetworkControl.scala +++ b/src/main/scala/li/cil/oc/integration/appeng/NetworkControl.scala @@ -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 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 result = Registry - .convert(Array[AnyRef](potentialItem.getItemStack)) - .collect { case StringAnyRefHash(hash) => hash } + val result = Registry.convert(Array[AnyRef](potentialItem.getItemStack)) + .collect { case hash: java.util.HashMap[_,_] => hashConvert(hash) } if (result.length > 0) { val hash = result(0) // it would have been nice to put these fields in a registry convert