diff --git a/src/main/scala/li/cil/oc/common/Proxy.scala b/src/main/scala/li/cil/oc/common/Proxy.scala index 2ff689ecd..e816d5db4 100644 --- a/src/main/scala/li/cil/oc/common/Proxy.scala +++ b/src/main/scala/li/cil/oc/common/Proxy.scala @@ -40,7 +40,6 @@ class Proxy { def call = FileSystem.fromClass(OpenComputers.getClass, Settings.resourceDomain, "lua/rom") }, Settings.resourceDomain + "/lua/rom") - } def init(e: FMLInitializationEvent) { diff --git a/src/main/scala/li/cil/oc/common/tileentity/Hologram.scala b/src/main/scala/li/cil/oc/common/tileentity/Hologram.scala index 18a52e45d..05f2ce5b6 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/Hologram.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/Hologram.scala @@ -82,14 +82,18 @@ class Hologram extends Environment with SidedEnvironment with Analyzable { @Callback(direct = true, doc = """function(x:number, z:number):number -- Returns the bit mask representing the specified column.""") def get(computer: Context, args: Arguments): Array[AnyRef] = this.synchronized { val x = args.checkInteger(0) - 1 + if (x < 0 || x >= width) throw new ArrayIndexOutOfBoundsException() val z = args.checkInteger(1) - 1 + if (z < 0 || z >= width) throw new ArrayIndexOutOfBoundsException() result(volume(x + z * width)) } @Callback(direct = true, limit = 256, doc = """function(x:number, z:number, value:number) -- Set the bit mask for the specified column.""") def set(computer: Context, args: Arguments): Array[AnyRef] = this.synchronized { val x = args.checkInteger(0) - 1 + if (x < 0 || x >= width) throw new ArrayIndexOutOfBoundsException() val z = args.checkInteger(1) - 1 + if (z < 0 || z >= width) throw new ArrayIndexOutOfBoundsException() val value = args.checkInteger(2) volume(x + z * width) = value setDirty(x, z) @@ -99,7 +103,9 @@ class Hologram extends Environment with SidedEnvironment with Analyzable { @Callback(direct = true, limit = 128, doc = """function(x:number, z:number, height:number) -- Fills a column to the specified height.""") def fill(computer: Context, args: Arguments): Array[AnyRef] = this.synchronized { val x = args.checkInteger(0) - 1 + if (x < 0 || x >= width) throw new ArrayIndexOutOfBoundsException() val z = args.checkInteger(1) - 1 + if (z < 0 || z >= width) throw new ArrayIndexOutOfBoundsException() val height = math.min(32, math.max(0, args.checkInteger(2))) // Bit shifts in the JVM only use the lowest five bits... so we have to // manually check the height, to avoid the shift being a no-op. 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 577c6e10e..7bc42220d 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/Router.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/Router.scala @@ -53,7 +53,10 @@ class Router extends Hub with IPeripheral { case "transmit" => val sendPort = checkPort(arguments, 0) val answerPort = checkPort(arguments, 1) - plugs.foreach(_.node.sendToReachable("network.message", Seq(Int.box(sendPort), Int.box(answerPort)) ++ arguments.drop(2): _*)) + val data = Seq(Int.box(answerPort)) ++ arguments.drop(2) + plugs.foreach(plug => { + plug.node.sendToReachable("network.message", new Packet(plug.node.address, None, sendPort, data)) + }) null case "isWireless" => Array(java.lang.Boolean.FALSE) case _ => null