Example #1
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    this.drawDefaultBackground();
    StringTranslate stringtranslate = StringTranslate.getInstance();

    if (this.clientHandler == null) {
      this.drawCenteredString(
          this.fontRenderer,
          stringtranslate.translateKey("connect.connecting"),
          this.width / 2,
          this.height / 2 - 50,
          16777215);
      this.drawCenteredString(
          this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215);
    } else {
      this.drawCenteredString(
          this.fontRenderer,
          stringtranslate.translateKey("connect.authorizing"),
          this.width / 2,
          this.height / 2 - 50,
          16777215);
      this.drawCenteredString(
          this.fontRenderer,
          this.clientHandler.field_72560_a,
          this.width / 2,
          this.height / 2 - 10,
          16777215);
    }

    super.drawScreen(par1, par2, par3);
  }
Example #2
0
 /** Adds the buttons (and other controls) to the screen in question. */
 public void initGui() {
   StringTranslate stringtranslate = StringTranslate.getInstance();
   this.buttonList.clear();
   this.buttonList.add(
       new GuiButton(
           0,
           this.width / 2 - 100,
           this.height / 4 + 120 + 12,
           stringtranslate.translateKey("gui.cancel")));
 }
  private void init() throws Exception {
    for (Object language : StringTranslate.getInstance().getLanguageList().keySet()) {
      CoreLoadingPlugin.log.fine(
          "[LanguageEngine] Loading language array for " + (String) language);
      lang.put((String) language, new HashMap<String, String>());
    }

    CoreLoadingPlugin.log.info("[LanguageEngine] Scanning for and loading language XML files...");

    for (Object file : lang.keySet()) {
      String fle1 = LANG_RESOURCE_LOCATION + (String) file + ".xml";
      fle1 = fle1.trim();
      CoreLoadingPlugin.log.fine("[LanguageEngine] Loading xml: " + fle1);
      Properties langPack = new Properties();
      URL urlResource = this.getClass().getResource(fle1);
      try {
        InputStream langStream = urlResource.openStream();
        langPack.loadFromXML(langStream);
        for (Object key : langPack.keySet()) {
          CoreLoadingPlugin.log.fine(
              "[LanguageEngine] Placing " + key + " in lang map as " + langPack.get(key));
          lang.get(file).put((String) key, (String) langPack.get(key));
        }
      } catch (Exception e) {
        CoreLoadingPlugin.log.warning(
            "[LanguageEngine] File " + fle1 + " does not exist or is causing an error!");
      }
    }
  }
 public String getString(String key) {
   String language = StringTranslate.getInstance().currentLanguage;
   if (lang.get(language).containsKey(key)) {
     return lang.get(language).get(key);
   } else {
     if (!lang.get(language).isEmpty())
       CoreLoadingPlugin.log.warning(
           String.format("[LanguageEngine] Failed to get string for key %s", key));
     return key;
   }
 }
 @SideOnly(Side.CLIENT)
 @Override
 public void addInformation(
     ItemStack itemStack, EntityPlayer player, List list, boolean something) {
   list.add(
       String.valueOf(getNumPhotos(itemStack))
           + " / "
           + String.valueOf(getCapacity())
           + " "
           + StringTranslate.getInstance().translateKey("item.photostorage.count"));
 }
 public String[] getArray(String key) {
   String language = StringTranslate.getInstance().currentLanguage;
   if (lang.get(language).containsKey(key)) {
     if (lang.get(language).get(key).contains(",")) {
       return lang.get(language).get(key).split(", ");
     }
   }
   if (!lang.get(language).isEmpty())
     CoreLoadingPlugin.log.warning(
         String.format("[LanguageEngine] Failed to return array for key %s", key));
   String[] def = new String[100];
   Arrays.fill(def, key);
   return def;
 }
Example #7
0
 private void func_74088_g() {
   StringTranslate var1 = StringTranslate.func_74808_a();
   this.field_74091_c.field_73744_e =
       var1.func_74805_b("selectWorld.gameMode")
           + " "
           + var1.func_74805_b("selectWorld.gameMode." + this.field_74089_d);
   this.field_74090_b.field_73744_e = var1.func_74805_b("selectWorld.allowCommands") + " ";
   if (this.field_74093_m) {
     this.field_74090_b.field_73744_e =
         this.field_74090_b.field_73744_e + var1.func_74805_b("options.on");
   } else {
     this.field_74090_b.field_73744_e =
         this.field_74090_b.field_73744_e + var1.func_74805_b("options.off");
   }
 }
Example #8
0
  @SideOnly(Side.CLIENT)

  /** allows items to add custom lines of information to the mouseover description */
  public void addInformation(
      ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
    if (LuxLevels.instance.getItemStack(par1ItemStack.getItemDamage()) == null) return;
    int id = LuxLevels.instance.getItemStack(par1ItemStack.getItemDamage()).itemID;
    int damage = LuxLevels.instance.getItemStack(par1ItemStack.getItemDamage()).getItemDamage();

    if (id < 0) return;

    Item temp = Item.itemsList[id];

    if (temp != null) {
      String name1 = StatCollector.translateToLocal(temp.getItemName());

      if (temp.getHasSubtypes()) {
        name1 = StatCollector.translateToLocal(temp.getItemNameIS(new ItemStack(temp, 1, damage)));
      }

      if (name1 == null) name1 = "";

      String name = ("" + StringTranslate.getInstance().translateNamedKey(name1)).trim();

      par3List.set(0, name + " " + (String) par3List.get(0));

      LuxPacket tempPacket = LuxLevels.instance.GetLuxPacket(id, damage);

      if (tempPacket != null) {
        for (byte c = 0; c < 7; c++)
          if (tempPacket.luxLevel[c] > 0)
            par3List.add(
                LuxHelper.color_str[c]
                    + LuxHelper.color_abb[c]
                    + " "
                    + LuxHelper.display(tempPacket.luxLevel[c]));
      }
    }
  }
  public void func_74143_g() {
    StringTranslate var1 = StringTranslate.func_74808_a();
    this.field_73887_h.add(
        new GuiButton(
            0,
            this.field_73880_f / 2 + 4,
            this.field_73881_g - 28,
            150,
            20,
            var1.func_74805_b("gui.done")));
    this.field_73887_h.add(
        new GuiButton(
            1,
            this.field_73880_f / 2 - 154,
            this.field_73881_g - 52,
            100,
            20,
            var1.func_74805_b("stat.generalButton")));
    GuiButton var2;
    this.field_73887_h.add(
        var2 =
            new GuiButton(
                2,
                this.field_73880_f / 2 - 46,
                this.field_73881_g - 52,
                100,
                20,
                var1.func_74805_b("stat.blocksButton")));
    GuiButton var3;
    this.field_73887_h.add(
        var3 =
            new GuiButton(
                3,
                this.field_73880_f / 2 + 62,
                this.field_73881_g - 52,
                100,
                20,
                var1.func_74805_b("stat.itemsButton")));
    if (this.field_74155_n.func_77217_a() == 0) {
      var2.field_73742_g = false;
    }

    if (this.field_74157_m.func_77217_a() == 0) {
      var3.field_73742_g = false;
    }
  }
Example #10
0
 private String translate_do(String var1) {
   String var2 = StringTranslate.getInstance().getCurrentLanguage();
   return var1;
 }
Example #11
0
 /** Translates and formats the given string key with the given arguments. */
 public String translateString(String par1Str, Object... par2ArrayOfObj) {
   return StringTranslate.getInstance().translateKeyFormat(par1Str, par2ArrayOfObj);
 }