mirror of
https://github.com/GTNewHorizons/bdlib.git
synced 2026-11-19 03:49:36 +00:00
EntryNumList can be converted used as color
This commit is contained in:
1 parent
1541b96a5a
commit
938ea4f3d5
1 file changed
+7
@@ -9,6 +9,8 @@
|
||||
|
||||
package net.bdew.lib.recipes.gencfg
|
||||
|
||||
import net.bdew.lib.gui.Color
|
||||
|
||||
abstract class CfgEntry
|
||||
|
||||
case class EntryDouble(v: Double) extends CfgEntry
|
||||
@@ -57,6 +59,11 @@ case class ConfigSection(pfx: String = "") extends CfgEntry with Iterable[(Strin
|
||||
def getFloat(id: String) = getDouble(id).toFloat
|
||||
def getIntList(id: String) = getDoubleList(id).map(_.round.toInt).toList
|
||||
def getFloatList(id: String) = getDoubleList(id).map(_.toFloat).toList
|
||||
|
||||
def getColor(id: String) = getFloatList(id) match {
|
||||
case r :: g :: b :: Nil => Color(r, g, b)
|
||||
case _ => sys.error("Color definition must be 3 numbers")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user