mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 03:36:47 -04:00
Merge branch 'master' of github.com:MightyPirates/OpenComputers into master-MC1.7.10
Conflicts: src/main/scala/li/cil/oc/server/component/DebugCard.scala
This commit is contained in:
commit
c02cbdea8e
@ -123,18 +123,23 @@ class Hologram(var tier: Int) extends traits.Environment with SidedEnvironment w
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true, limit = 128, doc = """function(x:number, z:number, height:number, value:number or boolean) -- Fills a column to the specified height.""")
|
@Callback(direct = true, limit = 128, doc = """function(x:number, z:number[, minY:number], maxY:number, value:number or boolean) -- Fills an interval of a column with the specified value.""")
|
||||||
def fill(computer: Context, args: Arguments): Array[AnyRef] = this.synchronized {
|
def fill(computer: Context, args: Arguments): Array[AnyRef] = this.synchronized {
|
||||||
val (x, _, z) = checkCoordinates(args, 0, -1, 1)
|
val (x, _, z) = checkCoordinates(args, 0, -1, 1)
|
||||||
val height = math.min(32, math.max(0, args.checkInteger(2)))
|
val (minY, maxY, value) =
|
||||||
val value = checkColor(args, 3)
|
if (args.count > 4)
|
||||||
|
(math.min(32, math.max(1, args.checkInteger(2))), math.min(32, math.max(1, args.checkInteger(3))), checkColor(args, 4))
|
||||||
|
else
|
||||||
|
(1, math.min(32, math.max(1, args.checkInteger(2))), checkColor(args, 3))
|
||||||
|
if (minY > maxY) throw new IllegalArgumentException("interval is empty")
|
||||||
|
|
||||||
|
val mask = (0xFFFFFFFF >>> (31 - (maxY - minY))) << (minY - 1)
|
||||||
val lbit = value & 1
|
val lbit = value & 1
|
||||||
val hbit = (value >>> 1) & 1
|
val hbit = (value >>> 1) & 1
|
||||||
if (lbit == 0 || height == 0) volume(x + z * width) = 0
|
if (lbit == 0 || height == 0) volume(x + z * width) &= ~mask
|
||||||
else volume(x + z * width) = 0xFFFFFFFF >>> (32 - height)
|
else volume(x + z * width) |= mask
|
||||||
if (hbit == 0 || height == 0) volume(x + z * width + width * width) = 0
|
if (hbit == 0 || height == 0) volume(x + z * width + width * width) &= ~mask
|
||||||
else volume(x + z * width + width * width) = 0xFFFFFFFF >>> (32 - height)
|
else volume(x + z * width + width * width) |= mask
|
||||||
|
|
||||||
setDirty(x, z)
|
setDirty(x, z)
|
||||||
null
|
null
|
||||||
|
@ -43,53 +43,53 @@ object DebugCard {
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function():number -- Gets the numeric id of the current dimension.""")
|
||||||
def getDimensionId(context: Context, args: Arguments): Array[AnyRef] =
|
def getDimensionId(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.provider.dimensionId)
|
result(world.provider.dimensionId)
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function():string -- Gets the name of the current dimension.""")
|
||||||
def getDimensionName(context: Context, args: Arguments): Array[AnyRef] =
|
def getDimensionName(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.provider.getDimensionName)
|
result(world.provider.getDimensionName)
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function():number -- Gets the seed of the world.""")
|
||||||
def getSeed(context: Context, args: Arguments): Array[AnyRef] =
|
def getSeed(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.getSeed)
|
result(world.getSeed)
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function():boolean -- Returns whether it is currently raining.""")
|
||||||
def isRaining(context: Context, args: Arguments): Array[AnyRef] =
|
def isRaining(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.isRaining)
|
result(world.isRaining)
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(value:boolean) -- Sets whether it is currently raining.""")
|
||||||
def setRaining(context: Context, args: Arguments): Array[AnyRef] = {
|
def setRaining(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
world.getWorldInfo.setRaining(args.checkBoolean(0))
|
world.getWorldInfo.setRaining(args.checkBoolean(0))
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function():boolean -- Returns whether it is currently thundering.""")
|
||||||
def isThundering(context: Context, args: Arguments): Array[AnyRef] =
|
def isThundering(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.isThundering)
|
result(world.isThundering)
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(value:boolean) -- Sets whether it is currently thundering.""")
|
||||||
def setThundering(context: Context, args: Arguments): Array[AnyRef] = {
|
def setThundering(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
world.getWorldInfo.setThundering(args.checkBoolean(0))
|
world.getWorldInfo.setThundering(args.checkBoolean(0))
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function():number -- Get the current world time.""")
|
||||||
def getTime(context: Context, args: Arguments): Array[AnyRef] =
|
def getTime(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.getWorldTime)
|
result(world.getWorldTime)
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(value:number) -- Set the current world time.""")
|
||||||
def setTime(context: Context, args: Arguments): Array[AnyRef] = {
|
def setTime(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
world.setWorldTime(args.checkDouble(0).toLong)
|
world.setWorldTime(args.checkDouble(0).toLong)
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function():number, number, number -- Get the current spawn point coordinates.""")
|
||||||
def getSpawnPoint(context: Context, args: Arguments): Array[AnyRef] =
|
def getSpawnPoint(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.getWorldInfo.getSpawnX, world.getWorldInfo.getSpawnY, world.getWorldInfo.getSpawnZ)
|
result(world.getWorldInfo.getSpawnX, world.getWorldInfo.getSpawnY, world.getWorldInfo.getSpawnZ)
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(x:number, y:number, z:number) -- Set the spawn point coordinates.""")
|
||||||
def setSpawnPoint(context: Context, args: Arguments): Array[AnyRef] = {
|
def setSpawnPoint(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
world.getWorldInfo.setSpawnPosition(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))
|
world.getWorldInfo.setSpawnPosition(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))
|
||||||
null
|
null
|
||||||
@ -97,41 +97,56 @@ object DebugCard {
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(x:number, y:number, z:number):number -- Get the ID of the block at the specified coordinates.""")
|
||||||
def getBlockId(context: Context, args: Arguments): Array[AnyRef] =
|
def getBlockId(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(Block.getIdFromBlock(world.getBlock(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))))
|
result(Block.getIdFromBlock(world.getBlock(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))))
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(x:number, y:number, z:number):number -- Get the metadata of the block at the specified coordinates.""")
|
||||||
def getMetadata(context: Context, args: Arguments): Array[AnyRef] =
|
def getMetadata(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.getBlockMetadata(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
result(world.getBlockMetadata(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(x:number, y:number, z:number):number -- Check whether the block at the specified coordinates is loaded.""")
|
||||||
def isLoaded(context: Context, args: Arguments): Array[AnyRef] =
|
def isLoaded(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.blockExists(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
result(world.blockExists(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(x:number, y:number, z:number):number -- Check whether the block at the specified coordinates has a tile entity.""")
|
||||||
def hasTileEntity(context: Context, args: Arguments): Array[AnyRef] = {
|
def hasTileEntity(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
val (x, y, z) = (args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))
|
val (x, y, z) = (args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))
|
||||||
val block = world.getBlock(x, y, z)
|
val block = world.getBlock(x, y, z)
|
||||||
result(block != null && block.hasTileEntity(world.getBlockMetadata(x, y, z)))
|
result(block != null && block.hasTileEntity(world.getBlockMetadata(x, y, z)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(x:number, y:number, z:number):number -- Get the light opacity of the block at the specified coordinates.""")
|
||||||
def getLightOpacity(context: Context, args: Arguments): Array[AnyRef] =
|
def getLightOpacity(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.getBlockLightOpacity(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
result(world.getBlockLightOpacity(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(x:number, y:number, z:number):number -- Get the light value (emission) of the block at the specified coordinates.""")
|
||||||
def getLightValue(context: Context, args: Arguments): Array[AnyRef] =
|
def getLightValue(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.getBlockLightValue(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
result(world.getBlockLightValue(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(x:number, y:number, z:number):number -- Get whether the block at the specified coordinates is directly under the sky.""")
|
||||||
def canSeeSky(context: Context, args: Arguments): Array[AnyRef] =
|
def canSeeSky(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.canBlockSeeTheSky(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
result(world.canBlockSeeTheSky(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
||||||
|
|
||||||
@Callback
|
@Callback(doc = """function(x:number, y:number, z:number, id:number, meta:number):number -- Set the block at the specified coordinates.""")
|
||||||
def setBlock(context: Context, args: Arguments): Array[AnyRef] =
|
def setBlock(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(world.setBlock(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2), Block.getBlockById(args.checkInteger(3)), args.checkInteger(4), 3))
|
result(world.setBlock(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2), Block.getBlockById(args.checkInteger(3)), args.checkInteger(4), 3))
|
||||||
|
|
||||||
|
@Callback(doc = """function(x1:number, y1:number, z1:number, x2:number, y2:number, z2:number, id:number, meta:number):number -- Set all blocks in the area defined by the two corner points (x1, y1, z1) and (x2, y2, z2).""")
|
||||||
|
def setBlocks(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
|
val (xMin, yMin, zMin) = (args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))
|
||||||
|
val (xMax, yMax, zMax) = (args.checkInteger(3), args.checkInteger(4), args.checkInteger(5))
|
||||||
|
val (block, metadata) = (Block.getBlockById(args.checkInteger(6)), args.checkInteger(7))
|
||||||
|
for (x <- math.min(xMin, xMax) to math.max(xMin, xMax)) {
|
||||||
|
for (y <- math.min(yMin, yMax) to math.max(yMin, yMax)) {
|
||||||
|
for (z <- math.min(zMin, zMax) to math.max(zMin, zMax)) {
|
||||||
|
world.setBlock(x, y, z, block, metadata, 3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
|
|
||||||
override def load(nbt: NBTTagCompound) {
|
override def load(nbt: NBTTagCompound) {
|
||||||
@ -154,4 +169,5 @@ object DebugCard {
|
|||||||
Array(args map unwrap: _*)
|
Array(args map unwrap: _*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user