diff --git a/src/main/scala/li/cil/oc/common/tileentity/Router.scala b/src/main/scala/li/cil/oc/common/tileentity/Router.scala index 34925111a7..db8f49bed5 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/Router.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/Router.scala @@ -86,7 +86,7 @@ class Router extends traits.Hub with traits.NotAnalyzable with IPeripheral { val answerPort = checkPort(arguments, 1) val data = Seq(Int.box(answerPort)) ++ arguments.drop(2) val packet = api.Network.newPacket(s"cc${computerId}_$attachmentName", null, sendPort, data.toArray) - result(tryEnqueuePacket(null, packet)) + result(tryEnqueuePacket(ForgeDirection.UNKNOWN, packet)) case "isWireless" => result(this.isInstanceOf[WirelessRouter]) case _ => null } diff --git a/src/main/scala/li/cil/oc/server/network/Network.scala b/src/main/scala/li/cil/oc/server/network/Network.scala index 348d9fdb77..577124f6f6 100644 --- a/src/main/scala/li/cil/oc/server/network/Network.scala +++ b/src/main/scala/li/cil/oc/server/network/Network.scala @@ -1,20 +1,21 @@ package li.cil.oc.server.network import codechicken.lib.vec.Cuboid6 -import codechicken.multipart.{TFacePart, JNormalOcclusion, NormalOcclusionTest, TileMultipart} +import codechicken.multipart.{JNormalOcclusion, NormalOcclusionTest, TFacePart, TileMultipart} import cpw.mods.fml.common.FMLCommonHandler import cpw.mods.fml.relauncher.Side import li.cil.oc.api.network -import li.cil.oc.api.network.{Node => ImmutableNode, WirelessEndpoint, SidedEnvironment, Environment, Visibility} +import li.cil.oc.api.network.{Environment, SidedEnvironment, Visibility, WirelessEndpoint, Node => ImmutableNode} import li.cil.oc.common.block.Cable import li.cil.oc.common.multipart.CablePart import li.cil.oc.common.tileentity import li.cil.oc.server.network.{Node => MutableNode} import li.cil.oc.util.mods.Mods -import li.cil.oc.{Settings, api} +import li.cil.oc.{OpenComputers, Settings, api} import net.minecraft.nbt._ import net.minecraft.tileentity.TileEntity import net.minecraftforge.common.ForgeDirection + import scala.collection.JavaConverters._ import scala.collection.mutable import scala.collection.mutable.ArrayBuffer @@ -478,6 +479,7 @@ object Network extends api.detail.NetworkAPI { if (nbt.hasKey("data" + i)) { nbt.getTag("data" + i) match { case boolean: NBTTagByte => Boolean.box(boolean.data == 1) + case integer: NBTTagInt => Int.box(integer.data) case double: NBTTagDouble => Double.box(double.data) case string: NBTTagString => string.data: AnyRef case array: NBTTagByteArray => array.byteArray @@ -628,9 +630,11 @@ object Network extends api.detail.NetworkAPI { for (i <- 0 until dataArray.length) dataArray(i) match { case null | Unit | None => case value: java.lang.Boolean => nbt.setBoolean("data" + i, value) + case value: java.lang.Integer => nbt.setInteger("data" + i, value) case value: java.lang.Double => nbt.setDouble("data" + i, value) case value: java.lang.String => nbt.setString("data" + i, value) case value: Array[Byte] => nbt.setByteArray("data" + i, value) + case value => OpenComputers.log.warning("Unexpected type while saving network packet: " + value.getClass.getName) } } }