diff --git a/src/main/scala/li/cil/oc/server/component/LinkedCard.scala b/src/main/scala/li/cil/oc/server/component/LinkedCard.scala index 51e0635df..06b72a5c2 100644 --- a/src/main/scala/li/cil/oc/server/component/LinkedCard.scala +++ b/src/main/scala/li/cil/oc/server/component/LinkedCard.scala @@ -1,15 +1,14 @@ package li.cil.oc.server.component import li.cil.oc.Settings -import li.cil.oc.api.Network -import li.cil.oc.api.machine.Arguments -import li.cil.oc.api.machine.Callback -import li.cil.oc.api.machine.Context +import li.cil.oc.api.machine.{Arguments, Callback, Context} import li.cil.oc.api.network._ -import li.cil.oc.api.prefab +import li.cil.oc.api.{Network, prefab} import li.cil.oc.server.network.QuantumNetwork import net.minecraft.nbt.NBTTagCompound +import scala.collection.convert.WrapAsScala._ + class LinkedCard extends prefab.ManagedEnvironment { override val node = Network.newNode(this, Visibility.Network). withComponent("tunnel", Visibility.Neighbors). @@ -23,7 +22,8 @@ class LinkedCard extends prefab.ManagedEnvironment { @Callback(doc = """function(data...) -- Sends the specified data to the card this one is linked to.""") def send(context: Context, args: Arguments): Array[AnyRef] = { val endpoints = QuantumNetwork.getEndpoints(tunnel).filter(_ != this) - val packet = Network.newPacket(node.address, null, 0, args.toArray) + // Cast to iterable to use Scala's toArray instead of the Arguments' one (which converts byte arrays to Strings). + val packet = Network.newPacket(node.address, null, 0, args.asInstanceOf[java.lang.Iterable[AnyRef]].toArray) if (node.tryChangeBuffer(-(packet.size / 32.0 + Settings.get.wirelessCostPerRange * Settings.get.maxWirelessRange * 5))) { for (card <- endpoints) { card.receivePacket(packet)