mirror of
https://github.com/GTNewHorizons/bdlib.git
synced 2026-11-12 08:17:37 +00:00
Force US locale on all upper/lower case conversions + normalized icon registration across all mods.
This commit is contained in:
1 parent
014c1c5e6e
commit
6c59b25e2c
9 files changed
+28
-8
No files matched your search
@@ -10,6 +10,7 @@
|
||||
package net.bdew.lib
|
||||
|
||||
import java.util
|
||||
import java.util.Locale
|
||||
|
||||
import cpw.mods.fml.common.{ICrashCallable, ModAPIManager, ModContainer}
|
||||
|
||||
@@ -20,7 +21,7 @@ object ApiReporter extends ICrashCallable {
|
||||
val mods = new util.ArrayList[ModContainer]
|
||||
val nameLookup = new util.HashMap[String, ModContainer]
|
||||
ModAPIManager.INSTANCE.injectAPIModContainers(mods, nameLookup)
|
||||
(for (mod <- mods.sortBy(_.getModId.toLowerCase)) yield
|
||||
(for (mod <- mods.sortBy(_.getModId.toLowerCase(Locale.US))) yield
|
||||
"\t\t* %s (%s) from %s".format(mod.getModId, mod.getVersion,
|
||||
if (mod.getSource.isDirectory)
|
||||
mod.getSource
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
package net.bdew.lib
|
||||
|
||||
import java.util
|
||||
import java.util.Locale
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry
|
||||
import cpw.mods.fml.common.versioning.VersionParser
|
||||
@@ -164,5 +165,11 @@ object Misc {
|
||||
res
|
||||
}
|
||||
|
||||
def iconName(domain: String, name: String, path: String*) =
|
||||
if (path.isEmpty)
|
||||
"%s:%s".format(domain, name).toLowerCase(Locale.US)
|
||||
else
|
||||
"%s:%s/%s".format(domain, name, path.mkString("/")).toLowerCase(Locale.US)
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import net.minecraft.block.Block
|
||||
import net.minecraft.block.material.Material
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
|
||||
import scala.language.implicitConversions
|
||||
|
||||
trait NamedBlock extends Block {
|
||||
def name: String
|
||||
}
|
||||
@@ -25,6 +27,6 @@ class SimpleBlock(val name: String, material: Material) extends Block(material)
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerBlockIcons(reg: IIconRegister) {
|
||||
blockIcon = reg.registerIcon(modId + ":" + name.toLowerCase)
|
||||
blockIcon = reg.registerIcon(Misc.iconName(modId, name))
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
package net.bdew.lib.covers
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
import net.bdew.lib.Misc
|
||||
import net.bdew.lib.data.DataSlotItemStack
|
||||
import net.bdew.lib.data.base.{TileDataSlots, UpdateKind}
|
||||
@@ -17,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
trait TileCoverable extends TileDataSlots {
|
||||
val covers = (ForgeDirection.VALID_DIRECTIONS map { x =>
|
||||
x -> DataSlotItemStack("cover_" + x.toString.toLowerCase, this).setUpdate(UpdateKind.SAVE, UpdateKind.WORLD, UpdateKind.RENDER)
|
||||
x -> DataSlotItemStack("cover_" + x.toString.toLowerCase(Locale.US), this).setUpdate(UpdateKind.SAVE, UpdateKind.WORLD, UpdateKind.RENDER)
|
||||
}).toMap
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,6 @@ class SimpleItem(val name: String) extends Item with NamedItem {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(reg: IIconRegister) {
|
||||
itemIcon = reg.registerIcon(modId + ":" + name.toLowerCase)
|
||||
itemIcon = reg.registerIcon(Misc.iconName(modId, name))
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
package net.bdew.lib.multiblock.gui
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
import net.bdew.lib.Misc
|
||||
import net.bdew.lib.gui.widgets.Widget
|
||||
import net.bdew.lib.gui.{Point, Rect, Texture}
|
||||
@@ -43,7 +45,7 @@ class WidgetOutputIcon(p: Point, te: CIOutputFaces, output: Int) extends Widget
|
||||
val bf = faces(output)
|
||||
bf.origin.block(te.getWorldObj) map { block =>
|
||||
tip += block.getLocalizedName
|
||||
tip += "%d, %d, %d - %s".format(bf.x, bf.y, bf.z, Misc.toLocal("bdlib.multiblock.face." + bf.face.toString.toLowerCase))
|
||||
tip += "%d, %d, %d - %s".format(bf.x, bf.y, bf.z, Misc.toLocal("bdlib.multiblock.face." + bf.face.toString.toLowerCase(Locale.US)))
|
||||
}
|
||||
} else {
|
||||
tip += Misc.toLocal("bdlib.multiblock.disabled")
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
package net.bdew.lib.multiblock.gui
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
import net.bdew.lib.Misc
|
||||
import net.bdew.lib.gui.widgets.{WidgetButtonIcon, WidgetSubContainer}
|
||||
import net.bdew.lib.gui.{Point, Rect}
|
||||
@@ -37,7 +39,7 @@ class WidgetRSConfig(te: CIOutputFaces, output: Int, p: Point) extends WidgetSub
|
||||
|
||||
override def draw(mouse: Point) {
|
||||
bt.icon = icons(cfg.rsMode)
|
||||
bt.hover = Misc.toLocal("bdlib.rsmode." + cfg.rsMode.toString.toLowerCase)
|
||||
bt.hover = Misc.toLocal("bdlib.rsmode." + cfg.rsMode.toString.toLowerCase(Locale.US))
|
||||
super.draw(mouse)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
package net.bdew.lib.recipes.gencfg
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
import net.bdew.lib.gui.Color
|
||||
|
||||
abstract class ConfigEntry
|
||||
@@ -43,7 +45,7 @@ case class ConfigSection(pfx: String = "") extends ConfigEntry with Iterable[(St
|
||||
def getSection(id: String) = getRaw(id, classOf[ConfigSection])
|
||||
|
||||
final val trueVals = Set("y", "true", "yes", "on")
|
||||
def getBoolean(id: String) = trueVals.contains(getString(id).toLowerCase)
|
||||
def getBoolean(id: String) = trueVals.contains(getString(id).toLowerCase(Locale.US))
|
||||
|
||||
def hasValue(id: String) = raw.isDefinedAt(id)
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
package net.bdew.lib.sensors.multiblock
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import net.bdew.lib.Misc
|
||||
import net.bdew.lib.gui._
|
||||
@@ -102,7 +104,7 @@ trait SensorOutput extends GenericSensorType[TileEntity, Boolean] {
|
||||
val bf = faces(output)
|
||||
bf.origin.block(te.getWorldObj) foreach { block =>
|
||||
list :+= block.getLocalizedName
|
||||
list :+= "%d, %d, %d - %s".format(bf.x, bf.y, bf.z, Misc.toLocal("bdlib.multiblock.face." + bf.face.toString.toLowerCase))
|
||||
list :+= "%d, %d, %d - %s".format(bf.x, bf.y, bf.z, Misc.toLocal("bdlib.multiblock.face." + bf.face.toString.toLowerCase(Locale.US)))
|
||||
}
|
||||
}
|
||||
list
|
||||
|
||||
Reference in new issue
Block a user