Java Code Examples for net.minecraft.client.resources.I18n#format()

The following examples show how to use net.minecraft.client.resources.I18n#format() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiProgWidgetImportExport.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initGui(){
    super.initGui();

    if(showSides()) {
        for(int i = 0; i < 6; i++) {
            String sideName = PneumaticCraftUtils.getOrientationName(ForgeDirection.getOrientation(i));
            GuiCheckBox checkBox = new GuiCheckBox(i, guiLeft + 4, guiTop + 30 + i * 12, 0xFF000000, sideName);
            checkBox.checked = ((ProgWidgetInventoryBase)widget).getSides()[i];
            addWidget(checkBox);
        }
    }

    useItemCount = new GuiCheckBox(6, guiLeft + 4, guiTop + (showSides() ? 115 : 30), 0xFF000000, I18n.format("gui.progWidget.itemFilter.useItemCount"));
    useItemCount.setTooltip("gui.progWidget.itemFilter.useItemCount.tooltip");
    useItemCount.checked = ((ICountWidget)widget).useCount();
    addWidget(useItemCount);
    textField = new WidgetTextFieldNumber(Minecraft.getMinecraft().fontRenderer, guiLeft + 7, guiTop + (showSides() ? 128 : 43), 50, 11);
    textField.setValue(((ICountWidget)widget).getCount());
    textField.setEnabled(useItemCount.checked);
    addWidget(textField);
}
 
Example 2
Source File: ItemBlockEUStorage.java    From Production-Line with MIT License 6 votes vote down vote up
/**
 * allows items to add custom lines of information to the mouseover description
 */
@SideOnly(Side.CLIENT)
@Override
public void addInformation(@Nonnull ItemStack itemStack, @Nonnull EntityPlayer player, @Nonnull List<String> list, boolean bool) {
    super.addInformation(itemStack, player, list, bool);
    int meta = itemStack.getItemDamage();
    String info = I18n.format("ic2.item.tooltip.Output") + " ";
    switch (meta) {
        case 0:
            info += "8192EU/t";
    }
    info += " " + I18n.format("ic2.item.tooltip.Capacity") + " ";
    switch (meta) {
        case 0:
            info += "100m EU";
    }
    list.add(info);
    NBTTagCompound nbt = StackUtil.getOrCreateNbtData(itemStack);
    String internalEnergy = I18n.format("ic2.item.tooltip.Store") + " " + nbt.getInteger("energy") + " EU";
    list.add(internalEnergy);
}
 
Example 3
Source File: GuiChisel.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void drawGuiContainerForegroundLayer(int j, int i) {
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

	String line = I18n.format(this.container.inventory.getInventoryName() + ".title");
	fontRendererObj.drawSplitString(line, 50 - fontRendererObj.getStringWidth(line) / 2, 60, 40, 0x404040);

	if (showMode()) {
		line = I18n.format(this.container.inventory.getInventoryName() + ".mode");
		fontRendererObj.drawString(line, fontRendererObj.getStringWidth(line) / 2 + 6, 85, 0x404040);
	}
}
 
Example 4
Source File: GuiAdvancedMod.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draw the foreground layer for the GuiContainer (everything in front of the items)
 */
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY){
    String s = inventory.hasCustomInventoryName() ? inventory.getInventoryName() : I18n.format(inventory.getInventoryName());
    fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
    fontRendererObj.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
}
 
Example 5
Source File: StatSwimming.java    From GokiStats with MIT License 5 votes vote down vote up
@Override
public String getLocalizedDescription(EntityPlayer player) {
    if (Reference.isPlayerAPILoaded) {
        return I18n.format(this.key + ".des1");
    }
    return I18n.format(this.key + ".des0",
            this.getDescriptionFormatArguments(player)[0]);
}
 
Example 6
Source File: StatTreasureFinder.java    From GokiStats with MIT License 5 votes vote down vote up
@Override
public String getLocalizedDescription(EntityPlayer player) {
    if (getPlayerStatLevel(player) == 0) {
        return I18n.format(this.key + ".des0");
    }
    return I18n.format(this.key + ".des1");
}
 
Example 7
Source File: BuildersWandRenderer.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private String getBlockTypeName(ItemBuildersWand wand, ItemStack stack, int index, boolean secondary)
{
    if (index >= 0)
    {
        BlockInfo blockInfo = wand.getSelectedFixedBlockType(stack, secondary);

        if (blockInfo != null)
        {
            ItemStack blockStack = new ItemStack(blockInfo.block, 1, blockInfo.itemMeta);

            if (blockStack.isEmpty() == false && blockStack.getItem() != null && blockStack.getItem() != Items.AIR)
            {
                return TextFormatting.GREEN.toString() + blockStack.getDisplayName();
            }
        }

        return TextFormatting.RED.toString() + "N/A";
    }
    else
    {
        if (index == ItemBuildersWand.BLOCK_TYPE_TARGETED)
        {
            return TextFormatting.AQUA.toString() + I18n.format("enderutilities.tooltip.item.blocktype.targeted");
        }
        else
        {
            return TextFormatting.AQUA.toString() + I18n.format("enderutilities.tooltip.item.blocktype.adjacent");
        }
    }
}
 
Example 8
Source File: GuiHyperiumScreenIngameMenu.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void initGui() {
    super.initGui();

    buttonList.clear();
    int i = -16;

    buttonList.add(new GuiButton(1, width / 2 - 100, height / 4 + 120 + i, I18n.format("menu.returnToMenu")));

    /* If Client is on server, add disconnect button */
    if (!mc.isIntegratedServerRunning()) (buttonList.get(0)).displayString = I18n.format("menu.disconnect");

    /* Add initial buttons */
    buttonList.add(new GuiButton(4, width / 2 - 100, height / 4 + 24 + i, I18n.format("menu.returnToGame")));
    buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 96 + i, 98, 20, I18n.format("menu.options")));

    GuiButton guibutton;
    buttonList.add(guibutton = new GuiButton(7, width / 2 + 2, height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan")));
    buttonList.add(new GuiButton(5, width / 2 - 100, height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements")));
    buttonList.add(new GuiButton(6, width / 2 + 2, height / 4 + 48 + i, 98, 20, I18n.format("gui.stats")));

    guibutton.enabled = mc.isSingleplayer() && !mc.getIntegratedServer().getPublic();

    buttonList.add(new GuiButton(9, width / 2 - 100, height / 4 + 56, 98, 20, I18n.format("button.ingame.hyperiumsettings")));
    buttonList.add(new GuiButton(8, width / 2 + 2, height / 4 + 56, 98, 20, I18n.format("button.ingame.hyperiumcredits")));

    WorldClient theWorld = Minecraft.getMinecraft().theWorld;

    // Used to detect if the player is on a singleplayer world or a multiplayer world.
    MinecraftServer integratedServer = Minecraft.getMinecraft().getIntegratedServer();
    if (theWorld != null && (integratedServer == null)) {
        GuiButton oldButton = buttonList.remove(3);
        GuiButton newButton = new GuiButton(10, oldButton.xPosition, oldButton.yPosition, oldButton.getButtonWidth(), 20,
            I18n.format("button.ingame.serverlist"));
        buttonList.add(newButton);
    }

}
 
Example 9
Source File: MultiSmelterInfo.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public String[] getDescription() {
    return new String[]{I18n.format("gregtech.multiblock.multi_smelter.description")};
}
 
Example 10
Source File: PluginGT6VeinStat.java    From GTNEIOrePlugin with MIT License 4 votes vote down vote up
public String getLocalizedVeinName(String unlocalizedName) {
    if (unlocalizedName.startsWith("ore.mix.custom."))
        return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15);
    else
        return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name");
}
 
Example 11
Source File: PluginGT5VeinStat.java    From GTNEIOrePlugin with MIT License 4 votes vote down vote up
public String getLocalizedVeinName(String unlocalizedName) {
    if (unlocalizedName.startsWith("ore.mix.custom."))
        return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15);
    else
        return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name");
}
 
Example 12
Source File: ItemEnderTool.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
public String getDisplayName()
{
    return I18n.format(this.unlocalized);
}
 
Example 13
Source File: StatFeatherFall.java    From GokiStats with MIT License 4 votes vote down vote up
@Override
public String getLocalizedDescription(EntityPlayer player) {
    return I18n.format(this.key + ".des",
            this.getDescriptionFormatArguments(player)[0],
            this.getDescriptionFormatArguments(player)[1]);
}
 
Example 14
Source File: PluginGT5SmallOreStat.java    From GTNEIOrePlugin with MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return I18n.format("gtnop.gui.smallOreStat.name");
}
 
Example 15
Source File: PluginGT6BedrockOreStat.java    From GTNEIOrePlugin with MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return I18n.format("gtnop.gui.bedrockOreStat.name");
}
 
Example 16
Source File: FacadeItem.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public String getItemStackDisplayName(ItemStack itemStack, String unlocalizedName) {
    ItemStack facadeStack = getFacadeStack(itemStack);
    String name = facadeStack.getItem().getItemStackDisplayName(facadeStack);
    return I18n.format(unlocalizedName, name);
}
 
Example 17
Source File: ItemRuler.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void addTooltipLines(ItemStack rulerStack, EntityPlayer player, List<String> list, boolean verbose)
{
    if (rulerStack.getTagCompound() == null)
    {
        list.add(I18n.format("enderutilities.tooltip.item.usetoolworkstation"));
        return;
    }

    String preDGreen = TextFormatting.DARK_GREEN.toString();
    String preGreen = TextFormatting.GREEN.toString();
    String preRed = TextFormatting.RED.toString();
    String preBlue = TextFormatting.BLUE.toString();
    String preWhite = TextFormatting.WHITE.toString();
    String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString();
    String strYes = preGreen + I18n.format("enderutilities.tooltip.item.yes") + rst;
    String strNo = preRed + I18n.format("enderutilities.tooltip.item.no") + rst;

    String str;

    int selected = this.getLocationSelection(rulerStack);
    BlockPosEU posStart = this.getPosition(rulerStack, selected, POS_START);
    BlockPosEU posEnd = this.getPosition(rulerStack, selected, POS_END);

    if (verbose == false)
    {
        if (posStart != null && posEnd != null)
        {
            list.add(String.format("x: %s%d%s y: %s%d%s z: %s%d%s ... x: %s%d%s y: %s%d%s z: %s%d%s",
                    preBlue, posStart.getX(), rst, preBlue, posStart.getY(), rst, preBlue, posStart.getZ(), rst,
                    preBlue, posEnd.getX(), rst, preBlue, posEnd.getY(), rst, preBlue, posEnd.getZ(), rst));
        }

        return;
    }

    if (posStart != null)
    {
        str = I18n.format("enderutilities.tooltip.item.start");
        list.add(str + String.format(": x: %s%d%s, y: %s%d%s, z: %s%d%s", preBlue, posStart.getX(), rst,
                preBlue, posStart.getY(), rst, preBlue, posStart.getZ(), rst));
    }

    if (posEnd != null)
    {
        str = I18n.format("enderutilities.tooltip.item.end");
        list.add(str + String.format(": x: %s%d%s, y: %s%d%s, z: %s%d%s", preBlue, posEnd.getX(), rst,
                preBlue, posEnd.getY(), rst, preBlue, posEnd.getZ(), rst));
    }

    str = I18n.format("enderutilities.tooltip.item.mode") + ": ";

    if (this.getDistanceMode(rulerStack) == DISTANCE_MODE_DIMENSIONS)
    {
        list.add(str + preDGreen + I18n.format("enderutilities.tooltip.item.ruler.dimensions") + rst);
    }
    else
    {
        list.add(str + preDGreen + I18n.format("enderutilities.tooltip.item.ruler.difference") + rst);
    }

    str = I18n.format("enderutilities.tooltip.item.rendercurrentwithall");
    list.add(str + ": " + (this.getAlwaysRenderLocation(rulerStack, selected) ? strYes : strNo));

    str = I18n.format("enderutilities.tooltip.item.renderall");
    list.add(str + ": " + (this.getRenderAllLocations(rulerStack) ? strYes : strNo));

    str = I18n.format("enderutilities.tooltip.item.renderwhenunselected");
    list.add(str + ": " + (this.getRenderWhenUnselected(rulerStack) ? strYes : strNo));

    int count = this.getLocationCount(rulerStack);
    str = I18n.format("enderutilities.tooltip.item.selected") + ": ";
    list.add(str + preBlue + (selected + 1) + rst + " / " + preBlue + count + rst);

    int installed = this.getInstalledModuleCount(rulerStack, ModuleType.TYPE_MEMORY_CARD_MISC);

    if (installed > 0)
    {
        int slotNum = UtilItemModular.getClampedModuleSelection(rulerStack, ModuleType.TYPE_MEMORY_CARD_MISC);
        int max = this.getMaxModules(rulerStack, ModuleType.TYPE_MEMORY_CARD_MISC);
        String preWhiteIta = preWhite + TextFormatting.ITALIC.toString();
        String strShort = I18n.format("enderutilities.tooltip.item.selectedmemorycard.short");

        ItemStack moduleStack = this.getSelectedModuleStack(rulerStack, ModuleType.TYPE_MEMORY_CARD_MISC);

        if (moduleStack.isEmpty() == false && moduleStack.getItem() == EnderUtilitiesItems.ENDER_PART)
        {
            String dName = (moduleStack.hasDisplayName() ? preWhiteIta + moduleStack.getDisplayName() + rst + " " : "");
            list.add(String.format("%s %s(%s%d%s / %s%d%s)", strShort, dName, preBlue, slotNum + 1, rst, preBlue, max, rst));
        }
        else
        {
            String strNot = I18n.format("enderutilities.tooltip.item.selectedmemorycard.notinstalled");
            list.add(String.format("%s %s (%s%d%s / %s%d%s)", strShort, strNot, preBlue, slotNum + 1, rst, preBlue, max, rst));
        }
    }
}
 
Example 18
Source File: ItemHandyBag.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void addTooltipLines(ItemStack containerStack, EntityPlayer player, List<String> list, boolean verbose)
{
    if (containerStack.getTagCompound() == null)
    {
        return;
    }

    String preGreen = TextFormatting.GREEN.toString();
    String preRed = TextFormatting.RED.toString();
    String preWhite = TextFormatting.WHITE.toString();
    String rst = TextFormatting.RESET.toString() + TextFormatting.GRAY.toString();

    String strPickupMode = I18n.format("enderutilities.tooltip.item.pickupmode" + (verbose ? "" : ".short")) + ": ";
    String strRestockMode = I18n.format("enderutilities.tooltip.item.restockmode" + (verbose ? "" : ".short")) + ": ";

    PickupMode pickupMode = PickupMode.fromStack(containerStack);
    if (pickupMode == PickupMode.NONE) strPickupMode += preRed;
    else if (pickupMode == PickupMode.MATCHING) strPickupMode += TextFormatting.YELLOW.toString();
    else if (pickupMode == PickupMode.ALL) strPickupMode += preGreen;
    strPickupMode += pickupMode.getDisplayName() + rst;

    RestockMode restockMode = RestockMode.fromStack(containerStack);
    if (restockMode == RestockMode.DISABLED) strRestockMode += preRed;
    else if (restockMode == RestockMode.ALL) strRestockMode += preGreen;
    else strRestockMode += TextFormatting.YELLOW.toString();

    strRestockMode += restockMode.getDisplayName() + rst;

    if (verbose)
    {
        list.add(strPickupMode);
        list.add(strRestockMode);
    }
    else
    {
        list.add(strPickupMode + " / " + strRestockMode);
    }

    String str;

    if (bagIsOpenable(containerStack))
    {
        str = I18n.format("enderutilities.tooltip.item.enabled") + ": " +
                preGreen + I18n.format("enderutilities.tooltip.item.yes");
    }
    else
    {
        str = I18n.format("enderutilities.tooltip.item.enabled") + ": " +
                preRed + I18n.format("enderutilities.tooltip.item.no");
    }

    list.add(str);

    int installed = this.getInstalledModuleCount(containerStack, ModuleType.TYPE_MEMORY_CARD_ITEMS);

    if (installed > 0)
    {
        int slotNum = UtilItemModular.getStoredModuleSelection(containerStack, ModuleType.TYPE_MEMORY_CARD_ITEMS);
        String preBlue = TextFormatting.BLUE.toString();
        String preWhiteIta = preWhite + TextFormatting.ITALIC.toString();
        String strShort = I18n.format("enderutilities.tooltip.item.selectedmemorycard.short");
        ItemStack moduleStack = this.getSelectedModuleStack(containerStack, ModuleType.TYPE_MEMORY_CARD_ITEMS);
        int max = this.getMaxModules(containerStack, ModuleType.TYPE_MEMORY_CARD_ITEMS);

        if (moduleStack.isEmpty() == false && moduleStack.getItem() == EnderUtilitiesItems.ENDER_PART)
        {
            String dName = (moduleStack.hasDisplayName() ? preWhiteIta + moduleStack.getDisplayName() + rst + " " : "");
            list.add(String.format("%s %s(%s%d%s / %s%d%s)", strShort, dName, preBlue, slotNum + 1, rst, preBlue, max, rst));

            ((ItemEnderPart) moduleStack.getItem()).addTooltipLines(moduleStack, player, list, false);
            return;
        }
        else
        {
            String strNo = I18n.format("enderutilities.tooltip.item.selectedmemorycard.notinstalled");
            list.add(String.format("%s %s (%s%d%s / %s%d%s)", strShort, strNo, preBlue, slotNum + 1, rst, preBlue, max, rst));
        }
    }
    else
    {
        list.add(I18n.format("enderutilities.tooltip.item.nomemorycards"));
    }
}
 
Example 19
Source File: Shocker.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public String getExtraInfo() {
	return I18n.format("tooltip.community_mod.shocker_extra");
}