diff --git a/src/main/java/resonantinduction/ResonantInduction.java b/src/main/java/resonantinduction/ResonantInduction.java index 3f129396d..120a590db 100644 --- a/src/main/java/resonantinduction/ResonantInduction.java +++ b/src/main/java/resonantinduction/ResonantInduction.java @@ -226,15 +226,15 @@ public class ResonantInduction public void init(FMLInitializationEvent evt) { LOGGER.fine("Languages Loaded:" + TranslationHelper.loadLanguages(LANGUAGE_DIRECTORY, LANGUAGES)); - + // TODO localize this metadata.modId = ID; metadata.name = NAME; - metadata.description = "Resonant Induction is a Minecraft mod focusing on the manipulation of electricity and wireless technology. Ever wanted blazing electrical shocks flying off your evil lairs? You've came to the right place!"; + metadata.description = TranslationHelper.getLocal("meta.resonantinduction.description"); metadata.url = "http://universalelectricity.com/resonant-induction"; metadata.logoFile = "/ri_logo.png"; metadata.version = VERSION + BUILD_VERSION; metadata.authorList = Arrays.asList(new String[] { "Calclavia", "Aidancbrady" }); - metadata.credits = "Thanks to Archadia for the awesome assets!"; + metadata.credits = TranslationHelper.getLocal("meta.resonantinduction.credits"); metadata.autogenerated = false; MultipartRI.INSTANCE = new MultipartRI(); diff --git a/src/main/java/resonantinduction/battery/ItemBlockBattery.java b/src/main/java/resonantinduction/battery/ItemBlockBattery.java index 1218dc358..08f4ffff7 100644 --- a/src/main/java/resonantinduction/battery/ItemBlockBattery.java +++ b/src/main/java/resonantinduction/battery/ItemBlockBattery.java @@ -2,6 +2,9 @@ package resonantinduction.battery; import java.util.List; +import calclavia.lib.prefab.TranslationHelper; +import calclavia.lib.render.EnumColor; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -46,7 +49,7 @@ public class ItemBlockBattery extends ItemBlock implements IEnergyItem, IVoltage color = "\u00a76"; } - list.add("Energy: " + color + UnitDisplay.getDisplayShort(joules, Unit.JOULES) + "/" + UnitDisplay.getDisplayShort(this.getEnergyCapacity(itemStack), Unit.JOULES)); + list.add(TranslationHelper.getLocal("tooltip.battery.energy").replace("%0", color).replace("%1", EnumColor.GREY.toString()).replace("%v0", UnitDisplay.getDisplayShort(joules, Unit.JOULES)).replace("%v1", UnitDisplay.getDisplayShort(this.getEnergyCapacity(itemStack), Unit.JOULES))); } @Override diff --git a/src/main/java/resonantinduction/gui/GuiMultimeter.java b/src/main/java/resonantinduction/gui/GuiMultimeter.java index bb56e0baf..490d766ae 100644 --- a/src/main/java/resonantinduction/gui/GuiMultimeter.java +++ b/src/main/java/resonantinduction/gui/GuiMultimeter.java @@ -44,7 +44,7 @@ public class GuiMultimeter extends GuiContainerBase public void initGui() { super.initGui(); - this.buttonList.add(new GuiButton(0, this.width / 2 + 20, this.height / 2 - 30, 50, 20, "Toggle")); + this.buttonList.add(new GuiButton(0, this.width / 2 + 20, this.height / 2 - 30, 50, 20, TranslationHelper.getLocal("gui.resonantinduction.multimeter.toggle"))); this.textFieldLimit = new GuiTextField(fontRenderer, 35, 82, 65, 12); this.textFieldLimit.setMaxStringLength(8); this.textFieldLimit.setText("" + this.multimeter.getLimit()); @@ -78,12 +78,12 @@ public class GuiMultimeter extends GuiContainerBase super.drawGuiContainerForegroundLayer(mouseX, mouseY); String s = TranslationHelper.getLocal("tile.resonantinduction:multimeter.name"); this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 15, 4210752); - this.fontRenderer.drawString(EnumColor.DARK_GREEN + "Average Energy:", 35, 15, 4210752); + this.fontRenderer.drawString(EnumColor.DARK_GREEN + TranslationHelper.getLocal("gui.resonantinduction.multimeter.averageEnergy"), 35, 15, 4210752); this.renderUniversalDisplay(35, 25, this.multimeter.getAverageDetectedEnergy(), mouseX, mouseY, Unit.JOULES); - this.fontRenderer.drawString(EnumColor.DARK_GREEN + "Energy:", 35, 35, 4210752); + this.fontRenderer.drawString(EnumColor.DARK_GREEN + TranslationHelper.getLocal("gui.resonantinduction.multimeter.energy"), 35, 35, 4210752); this.renderUniversalDisplay(35, 45, this.multimeter.getDetectedEnergy(), mouseX, mouseY, Unit.JOULES); - this.fontRenderer.drawString(EnumColor.ORANGE + "Output Redstone If... ", 35, 58, 4210752); - this.fontRenderer.drawString(EnumColor.RED + this.multimeter.getMode().display, 35, 68, 4210752); + this.fontRenderer.drawString(EnumColor.ORANGE + TranslationHelper.getLocal("gui.resonantinduction.multimeter.redstone"), 35, 58, 4210752); + this.fontRenderer.drawString(EnumColor.RED + TranslationHelper.getLocal("gui.resonantinduction.multimeter." + this.multimeter.getMode().display), 35, 68, 4210752); this.fontRenderer.drawString(Unit.JOULES.name + "(s)", 35, 100, 4210752); this.textFieldLimit.drawTextBox(); diff --git a/src/main/java/resonantinduction/multimeter/ItemMultimeter.java b/src/main/java/resonantinduction/multimeter/ItemMultimeter.java index 4eafaa444..b97248366 100644 --- a/src/main/java/resonantinduction/multimeter/ItemMultimeter.java +++ b/src/main/java/resonantinduction/multimeter/ItemMultimeter.java @@ -2,6 +2,8 @@ package resonantinduction.multimeter; import java.util.List; +import calclavia.lib.prefab.TranslationHelper; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -46,18 +48,18 @@ public class ItemMultimeter extends ItemMultipartBase @Override public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("Shift-right click to place,"); - par3List.add("Right click to scan data."); + par3List.add(TranslationHelper.getLocal("tooltip.multimeter.line1")); + par3List.add(TranslationHelper.getLocal("tooltip.multimeter.line2")); float detection = this.getDetection(itemStack); if (detection != -1) { - par3List.add("Last Detection: " + detection + " KJ"); + par3List.add(TranslationHelper.getLocal("tooltip.multimeter.lastSave").replace("%v", detection + "")); } else { - par3List.add("No detection saved."); + par3List.add(TranslationHelper.getLocal("tooltip.multimeter.noSave")); } } @@ -68,7 +70,7 @@ public class ItemMultimeter extends ItemMultipartBase { if (!world.isRemote) { - par2EntityPlayer.addChatMessage("Energy: " + PartMultimeter.getDetectedEnergy(ForgeDirection.getOrientation(par7), world.getBlockTileEntity(x, y, z)) + " J"); + par2EntityPlayer.addChatMessage(TranslationHelper.getLocal("message.multimeter.onUse").replace("%v", "" + PartMultimeter.getDetectedEnergy(ForgeDirection.getOrientation(par7), world.getBlockTileEntity(x, y, z)))); } return true; diff --git a/src/main/java/resonantinduction/multimeter/PartMultimeter.java b/src/main/java/resonantinduction/multimeter/PartMultimeter.java index 562341bc6..ea98e7ca7 100644 --- a/src/main/java/resonantinduction/multimeter/PartMultimeter.java +++ b/src/main/java/resonantinduction/multimeter/PartMultimeter.java @@ -60,8 +60,8 @@ public class PartMultimeter extends JCuboidPart implements TFacePart, JNormalOcc public enum DetectMode { - NONE("None"), LESS_THAN("Less Than"), LESS_THAN_EQUAL("Less Than or Equal"), - EQUAL("Equal"), GREATER_THAN("Greater Than or Equal"), GREATER_THAN_EQUAL("Greater Than"); + NONE("none"), LESS_THAN("lessThan"), LESS_THAN_EQUAL("lessThanOrEqual"), + EQUAL("equal"), GREATER_THAN("greaterThanOrEqual"), GREATER_THAN_EQUAL("greaterThan"); public String display; diff --git a/src/main/java/resonantinduction/tesla/BlockTesla.java b/src/main/java/resonantinduction/tesla/BlockTesla.java index 169d33e76..b8d19724f 100644 --- a/src/main/java/resonantinduction/tesla/BlockTesla.java +++ b/src/main/java/resonantinduction/tesla/BlockTesla.java @@ -3,6 +3,7 @@ */ package resonantinduction.tesla; +import calclavia.lib.prefab.TranslationHelper; import calclavia.lib.prefab.item.ItemCoordLink; import net.minecraft.block.ITileEntityProvider; import net.minecraft.entity.player.EntityPlayer; @@ -11,6 +12,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import resonantinduction.ResonantInduction; +import resonantinduction.Utility; import resonantinduction.base.BlockBase; import resonantinduction.render.BlockRenderingHandler; import universalelectricity.api.vector.Vector3; @@ -46,9 +48,12 @@ public class BlockTesla extends BlockBase implements ITileEntityProvider if (entityPlayer.getCurrentEquippedItem() != null) { - if (entityPlayer.getCurrentEquippedItem().itemID == Item.dyePowder.itemID) + int dyeColor = Utility.isDye(entityPlayer.getCurrentEquippedItem()); + + + if (dyeColor != -1) { - tileEntity.setDye(entityPlayer.getCurrentEquippedItem().getItemDamage()); + tileEntity.setDye(dyeColor); if (!entityPlayer.capabilities.isCreativeMode) { @@ -68,7 +73,7 @@ public class BlockTesla extends BlockBase implements ITileEntityProvider if (!world.isRemote) { - entityPlayer.addChatMessage("Toggled entity attack to: " + status); + entityPlayer.addChatMessage(TranslationHelper.getLocal("message.tesla.toggleAttack").replace("%v", status + "")); } return true; @@ -90,7 +95,7 @@ public class BlockTesla extends BlockBase implements ITileEntityProvider { tileEntity.setLink(new Vector3(((TileTesla) linkVec.getTileEntity(otherWorld)).getTopTelsa()), linkVec.world.provider.dimensionId, true); - entityPlayer.addChatMessage("Linked " + this.getLocalizedName() + " with " + " [" + (int) linkVec.x + ", " + (int) linkVec.y + ", " + (int) linkVec.z + "]"); + entityPlayer.addChatMessage(TranslationHelper.getLocal("message.tesla.pair").replace("%v0", this.getLocalizedName()).replace("%v1", linkVec.x + "").replace("%v2", linkVec.y + "").replace("%v3", linkVec.z + "")); link.clearLink(entityPlayer.getCurrentEquippedItem()); world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "ambient.weather.thunder", 5, 1); @@ -119,7 +124,7 @@ public class BlockTesla extends BlockBase implements ITileEntityProvider if (world.isRemote) { - entityPlayer.addChatMessage("Tesla receive mode is now " + receiveMode); + entityPlayer.addChatMessage(TranslationHelper.getLocal("message.tesla.mode").replace("%v", receiveMode + "")); } return true; diff --git a/src/main/java/resonantinduction/wire/ItemWire.java b/src/main/java/resonantinduction/wire/ItemWire.java index 76560325a..f4bcfa7bf 100644 --- a/src/main/java/resonantinduction/wire/ItemWire.java +++ b/src/main/java/resonantinduction/wire/ItemWire.java @@ -7,7 +7,6 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.ForgeDirection; @@ -24,6 +23,7 @@ import resonantinduction.wire.framed.RenderPartWire; import universalelectricity.api.energy.UnitDisplay; import universalelectricity.api.energy.UnitDisplay.Unit; import calclavia.lib.Calclavia; +import calclavia.lib.prefab.TranslationHelper; import calclavia.lib.render.EnumColor; import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.Vector3; @@ -99,14 +99,14 @@ public class ItemWire extends JItemMultiPart { if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - list.add(StatCollector.translateToLocal("tooltip.wire.noShift").replace("%0", EnumColor.AQUA.toString()).replace("%1", EnumColor.GREY.toString())); + list.add(TranslationHelper.getLocal("tooltip.noShift").replace("%0", EnumColor.AQUA.toString()).replace("%1", EnumColor.GREY.toString())); } else { - list.add(EnumColor.AQUA + StatCollector.translateToLocal("tooltip.wire.resistance").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE))); - list.add(EnumColor.AQUA + StatCollector.translateToLocal("tooltip.wire.current").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE))); - list.add(EnumColor.AQUA + StatCollector.translateToLocal("tooltip.wire.damage").replace("%v", "" + EnumColor.ORANGE + EnumWireMaterial.values()[itemstack.getItemDamage()].damage)); - list.addAll(Calclavia.splitStringPerWord(StatCollector.translateToLocal("tooltip.wire.helpText"), 5)); + list.add(EnumColor.AQUA + TranslationHelper.getLocal("tooltip.wire.resistance").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE))); + list.add(EnumColor.AQUA + TranslationHelper.getLocal("tooltip.wire.current").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE))); + list.add(EnumColor.AQUA + TranslationHelper.getLocal("tooltip.wire.damage").replace("%v", "" + EnumColor.ORANGE + EnumWireMaterial.values()[itemstack.getItemDamage()].damage)); + list.addAll(Calclavia.splitStringPerWord(TranslationHelper.getLocal("tooltip.wire.helpText"), 5)); } } diff --git a/src/main/resources/assets/resonantinduction/languages/en_US.properties b/src/main/resources/assets/resonantinduction/languages/en_US.properties index f071bf80d..71c190fe4 100644 --- a/src/main/resources/assets/resonantinduction/languages/en_US.properties +++ b/src/main/resources/assets/resonantinduction/languages/en_US.properties @@ -1,8 +1,11 @@ # English @author Calclavia, Alex_hawks -# If a localization includes %v it is some data that is calculated. Such as attributes on a cable. -# A % folowed by a number is used for colors. The exact usage will be outlined in the comment above the localization. +# If a localization includes %v it is some data that is calculated. Such as attributes on a cable. +# The %v may be followed by a number if there are multiple pieces of calculated data, but it will be explained in a comment. +# A % followed by a number is used for colors. The exact usage will be outlined in the comment above the localization. itemGroup.resonantinduction=Resonant Induction +meta.resonantinduction.description=Resonant Induction is a Minecraft mod focusing on the manipulation of electricity and wireless technology. Ever wanted blazing electrical shocks flying off your evil lairs? You've came to the right place! +meta.resonantinduction.credits=Thanks to Archadia for the awesome assets! ## Blocks tile.resonantinduction\:tesla.name=Tesla Coil @@ -24,6 +27,8 @@ item.resonantinduction\:wire.aluminum.name=Aluminum Wire item.resonantinduction\:wire.silver.name=Silver Wire item.resonantinduction\:wire.superconductor.name=Superconductor Wire + +## Tool-tips tooltip.transformer.stepUp=Step Up tooltip.transformer.stepDown=Step Down tooltip.wire.resistance=Resistance: %v @@ -31,4 +36,31 @@ tooltip.wire.current=Current: %v tooltip.wire.damage=Damage: %v tooltip.wire.helpText=The energy transfer rate can be increased and the energy loss may be reduced by using a higher the voltage. # %0 goes before the localized name of the shift key, %1 goes after -tooltip.wire.noShift=Hold %0shift %1for more information" +tooltip.noShift=Hold %0shift %1for more information" +# %0 is the color for the charge level, %1 is grey to reset it back to normal (optional), %v0 is the current charge, %v1 is the max charge +tooltip.battery.energy=Energy: %0%v0 / %v1 +tooltip.multimeter.line1=Shift-right click to place, +tooltip.multimeter.line2=Right click to scan data. +tooltip.multimeter.noSave=No detection saved. +tooltip.multimeter.lastSave=Last Detection: %v KJ + +## GUI Strings that can't be any other localization +gui.resonantinduction.multimeter.toggle=Toggle +gui.resonantinduction.multimeter.averageEnergy=Average Energy: +gui.resonantinduction.multimeter.energy=Energy: +gui.resonantinduction.multimeter.redstone=Output Redstone If... + +gui.resonantinduction.multimeter.none=None +gui.resonantinduction.multimeter.lessThan=Less Than +gui.resonantinduction.multimeter.lessThanOrEqual=Less Than or Equal +gui.resonantinduction.multimeter.equal=Equal +gui.resonantinduction.multimeter.greaterThanOrEqual=Greater Than or Equal +gui.resonantinduction.multimeter.greaterThan=Greater Than + +## Messages to players +message.multimeter.onUse=Energy: %v J +message.tesla.toggleAttack=Toggled entity attack to: %v +# %v0 is the tile that's linking to the other (usually %v0 is a tesla), the others are coordinates in the standard [x, y, z] +message.tesla.pair=Linked %v0 with [%v1, %v2, %v3] +message.tesla.mode=Tesla receive mode is now %v +