Exemplo n.º 1
0
  /**
   * Takes a string and turns it into a named variant for this material. E.g. pickaxe -> wooden
   * pickaxe
   */
  public String getLocalizedItemName(String itemName) {
    if (this == UNKNOWN) {
      return itemName;
    }

    if (I18n.canTranslate(String.format(LOC_Prefix, getIdentifier()))) {
      return I18n.translateToLocalFormatted(
          String.format(LOC_Prefix, Util.sanitizeLocalizationString(identifier)), itemName);
    }

    return getLocalizedName() + " " + itemName;
  }
Exemplo n.º 2
0
  public Material(String identifier, int color) {
    this.identifier =
        Util.sanitizeLocalizationString(identifier); // lowercases and removes whitespaces

    // if invisible, make it fully opaque.
    if (((color >> 24) & 0xFF) == 0) {
      color |= 0xFF << 24;
    }

    this.materialTextColor = color;
    if (FMLCommonHandler.instance().getSide().isClient()) {
      setRenderInfo(color);
    }
  }