mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-25 14:05:39 -04:00
Merge branch 'master' of github.com:MightyPirates/OpenComputers into MC1.7
This commit is contained in:
commit
508dc64553
@ -205,24 +205,29 @@ class Hologram(var tier: Int) extends traits.Environment with SidedEnvironment w
|
||||
null
|
||||
}
|
||||
|
||||
@Callback(direct = true, doc = """function():number -- The color depth supported by the hologram.""")
|
||||
def maxDepth(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
result(tier + 1)
|
||||
}
|
||||
|
||||
@Callback(doc = """function(index:number):number -- Get the color defined for the specified value.""")
|
||||
def getPaletteColor(computer: Context, args: Arguments): Array[AnyRef] = {
|
||||
val index = args.checkInteger(0)
|
||||
if (index < 0 || index >= colors.length) throw new ArrayIndexOutOfBoundsException()
|
||||
if (index < 1 || index > colors.length) throw new ArrayIndexOutOfBoundsException()
|
||||
// Colors are stored as 0xAABBGGRR for rendering convenience, so convert them.
|
||||
result(convertColor(colors(index)))
|
||||
result(convertColor(colors(index - 1)))
|
||||
}
|
||||
|
||||
@Callback(doc = """function(index:number, value:number):number -- Set the color defined for the specified value.""")
|
||||
def setPaletteColor(computer: Context, args: Arguments): Array[AnyRef] = {
|
||||
val index = args.checkInteger(0)
|
||||
if (index < 0 || index >= colors.length) throw new ArrayIndexOutOfBoundsException()
|
||||
if (index < 1 || index > colors.length) throw new ArrayIndexOutOfBoundsException()
|
||||
val value = args.checkInteger(1)
|
||||
val oldValue = colors(index)
|
||||
val oldValue = colors(index - 1)
|
||||
// Change byte order here to allow passing stored color to OpenGL "as-is"
|
||||
// (as whole Int, i.e. 0xAABBGGRR, alpha is unused but present for alignment)
|
||||
colors(index) = convertColor(value)
|
||||
ServerPacketSender.sendHologramColor(this, index, value)
|
||||
colors(index - 1) = convertColor(value)
|
||||
ServerPacketSender.sendHologramColor(this, index - 1, value)
|
||||
result(oldValue)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user