mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Merge branch 'master' of github.com:MightyPirates/OpenComputers into master-MC1.7.10
This commit is contained in:
commit
b46d13b1c1
@ -19,7 +19,11 @@ import scala.collection.mutable
|
|||||||
object PetRenderer {
|
object PetRenderer {
|
||||||
val hidden = mutable.Set.empty[String]
|
val hidden = mutable.Set.empty[String]
|
||||||
|
|
||||||
private val entitledPlayers = Map("Kethtar" ->(0.3, 0.9, 0.6))
|
private val entitledPlayers = Map(
|
||||||
|
"Kethtar" -> (0.3, 0.9, 0.6),
|
||||||
|
"Jodarion" -> (1.0, 0.0, 0.0),
|
||||||
|
"DaKaTotal" -> (0.5, 0.7, 1.0)
|
||||||
|
)
|
||||||
|
|
||||||
private val petLocations = com.google.common.cache.CacheBuilder.newBuilder().
|
private val petLocations = com.google.common.cache.CacheBuilder.newBuilder().
|
||||||
expireAfterAccess(5, TimeUnit.SECONDS).
|
expireAfterAccess(5, TimeUnit.SECONDS).
|
||||||
|
@ -189,6 +189,9 @@ class Robot extends traits.Computer with traits.PowerInformation with api.machin
|
|||||||
}
|
}
|
||||||
assert(!isInvalid)
|
assert(!isInvalid)
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
world.setBlockToAir(nx, ny, nz)
|
||||||
|
}
|
||||||
created
|
created
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
@ -53,7 +53,7 @@ private[oc] object Registry extends api.detail.DriverAPI {
|
|||||||
|
|
||||||
def driverFor(world: World, x: Int, y: Int, z: Int) =
|
def driverFor(world: World, x: Int, y: Int, z: Int) =
|
||||||
blocks.filter(_.worksWith(world, x, y, z)) match {
|
blocks.filter(_.worksWith(world, x, y, z)) match {
|
||||||
case drivers if !drivers.isEmpty => new CompoundBlockDriver(drivers: _*)
|
case drivers if drivers.nonEmpty => new CompoundBlockDriver(drivers: _*)
|
||||||
case _ => null
|
case _ => null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,11 @@ class ArgumentsImpl(val args: Seq[AnyRef]) extends network.Arguments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def optAny(index: Int, default: AnyRef) = {
|
||||||
|
if (!isDefined(index)) default
|
||||||
|
else checkAny(index)
|
||||||
|
}
|
||||||
|
|
||||||
def checkBoolean(index: Int) = {
|
def checkBoolean(index: Int) = {
|
||||||
checkIndex(index, "boolean")
|
checkIndex(index, "boolean")
|
||||||
args(index) match {
|
args(index) match {
|
||||||
@ -26,6 +31,11 @@ class ArgumentsImpl(val args: Seq[AnyRef]) extends network.Arguments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def optBoolean(index: Int, default: Boolean) = {
|
||||||
|
if (!isDefined(index)) default
|
||||||
|
else checkBoolean(index)
|
||||||
|
}
|
||||||
|
|
||||||
def checkDouble(index: Int) = {
|
def checkDouble(index: Int) = {
|
||||||
checkIndex(index, "number")
|
checkIndex(index, "number")
|
||||||
args(index) match {
|
args(index) match {
|
||||||
@ -34,6 +44,11 @@ class ArgumentsImpl(val args: Seq[AnyRef]) extends network.Arguments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def optDouble(index: Int, default: Double) = {
|
||||||
|
if (!isDefined(index)) default
|
||||||
|
else checkDouble(index)
|
||||||
|
}
|
||||||
|
|
||||||
def checkInteger(index: Int) = {
|
def checkInteger(index: Int) = {
|
||||||
checkIndex(index, "number")
|
checkIndex(index, "number")
|
||||||
args(index) match {
|
args(index) match {
|
||||||
@ -42,6 +57,11 @@ class ArgumentsImpl(val args: Seq[AnyRef]) extends network.Arguments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def optInteger(index: Int, default: Int) = {
|
||||||
|
if (!isDefined(index)) default
|
||||||
|
else checkInteger(index)
|
||||||
|
}
|
||||||
|
|
||||||
def checkString(index: Int) = {
|
def checkString(index: Int) = {
|
||||||
checkIndex(index, "string")
|
checkIndex(index, "string")
|
||||||
args(index) match {
|
args(index) match {
|
||||||
@ -51,6 +71,11 @@ class ArgumentsImpl(val args: Seq[AnyRef]) extends network.Arguments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def optString(index: Int, default: String) = {
|
||||||
|
if (!isDefined(index)) default
|
||||||
|
else checkString(index)
|
||||||
|
}
|
||||||
|
|
||||||
def checkByteArray(index: Int) = {
|
def checkByteArray(index: Int) = {
|
||||||
checkIndex(index, "string")
|
checkIndex(index, "string")
|
||||||
args(index) match {
|
args(index) match {
|
||||||
@ -60,6 +85,11 @@ class ArgumentsImpl(val args: Seq[AnyRef]) extends network.Arguments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def optByteArray(index: Int, default: Array[Byte]) = {
|
||||||
|
if (!isDefined(index)) default
|
||||||
|
else checkByteArray(index)
|
||||||
|
}
|
||||||
|
|
||||||
def checkTable(index: Int) = {
|
def checkTable(index: Int) = {
|
||||||
checkIndex(index, "table")
|
checkIndex(index, "table")
|
||||||
args(index) match {
|
args(index) match {
|
||||||
@ -70,6 +100,11 @@ class ArgumentsImpl(val args: Seq[AnyRef]) extends network.Arguments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def optTable(index: Int, default: Map[_, _]) = {
|
||||||
|
if (!isDefined(index)) default
|
||||||
|
else checkTable(index)
|
||||||
|
}
|
||||||
|
|
||||||
def isBoolean(index: Int) =
|
def isBoolean(index: Int) =
|
||||||
index >= 0 && index < count && (args(index) match {
|
index >= 0 && index < count && (args(index) match {
|
||||||
case value: java.lang.Boolean => true
|
case value: java.lang.Boolean => true
|
||||||
@ -111,6 +146,8 @@ class ArgumentsImpl(val args: Seq[AnyRef]) extends network.Arguments {
|
|||||||
case _ => false
|
case _ => false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
private def isDefined(index: Int) = index >= 0 && index < args.length
|
||||||
|
|
||||||
private def checkIndex(index: Int, name: String) =
|
private def checkIndex(index: Int, name: String) =
|
||||||
if (index < 0) throw new IndexOutOfBoundsException()
|
if (index < 0) throw new IndexOutOfBoundsException()
|
||||||
else if (args.length <= index) throw new IllegalArgumentException(
|
else if (args.length <= index) throw new IllegalArgumentException(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user