Java Code Examples for net.minecraft.client.resources.I18n

The following are top voted examples for showing how to use net.minecraft.client.resources.I18n. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: BetterBeginningsReborn   File: GuiDoubleWorkbench.java   Source Code and License 7 votes vote down vote up
private void drawItemTooltip(int x, int y, ItemStack stack, boolean warn)
{
	if (stack == null)
	{
		return;
	}

	List<String> lines = new ArrayList<>();

	boolean adv = Minecraft.getMinecraft().gameSettings.advancedItemTooltips;
	int id = Item.getIdFromItem(stack.getItem());
	lines.addAll(stack.getTooltip(container.getOpeningPlayer(), adv ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL));
	lines.set(0, lines.get(0) + " " + id);

	if (warn)
	{
		lines.add(ChatUtil.RED + I18n.format("container.craftingdouble.warning"));
	}

	drawHoveringText(lines, x, y); //Draw tooltip
}
 
Example 2
Project: DecompiledMinecraft   File: GuiStats.java   Source Code and License 6 votes vote down vote up
protected void func_148213_a(StatCrafting p_148213_1_, int p_148213_2_, int p_148213_3_)
{
    if (p_148213_1_ != null)
    {
        Item item = p_148213_1_.func_150959_a();
        ItemStack itemstack = new ItemStack(item);
        String s = itemstack.getUnlocalizedName();
        String s1 = ("" + I18n.format(s + ".name", new Object[0])).trim();

        if (s1.length() > 0)
        {
            int i = p_148213_2_ + 12;
            int j = p_148213_3_ - 12;
            int k = GuiStats.this.fontRendererObj.getStringWidth(s1);
            GuiStats.this.drawGradientRect(i - 3, j - 3, i + k + 3, j + 8 + 3, -1073741824, -1073741824);
            GuiStats.this.fontRendererObj.drawStringWithShadow(s1, (float)i, (float)j, -1);
        }
    }
}
 
Example 3
Project: DecompiledMinecraft   File: GuiScreenCustomizePresets.java   Source Code and License 6 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.buttonList.clear();
    Keyboard.enableRepeatEvents(true);
    this.field_175315_a = I18n.format("createWorld.customize.custom.presets.title", new Object[0]);
    this.field_175313_s = I18n.format("createWorld.customize.presets.share", new Object[0]);
    this.field_175312_t = I18n.format("createWorld.customize.presets.list", new Object[0]);
    this.field_175317_i = new GuiTextField(2, this.fontRendererObj, 50, 40, this.width - 100, 20);
    this.field_175311_g = new GuiScreenCustomizePresets.ListPreset();
    this.field_175317_i.setMaxStringLength(2000);
    this.field_175317_i.setText(this.field_175314_r.func_175323_a());
    this.buttonList.add(this.field_175316_h = new GuiButton(0, this.width / 2 - 102, this.height - 27, 100, 20, I18n.format("createWorld.customize.presets.select", new Object[0])));
    this.buttonList.add(new GuiButton(1, this.width / 2 + 3, this.height - 27, 100, 20, I18n.format("gui.cancel", new Object[0])));
    this.func_175304_a();
}
 
Example 4
Project: Backmemed   File: GuiOtherSettingsOF.java   Source Code and License 6 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.title = I18n.format("of.options.otherTitle", new Object[0]);
    this.buttonList.clear();

    for (int i = 0; i < enumOptions.length; ++i)
    {
        GameSettings.Options gamesettings$options = enumOptions[i];
        int j = this.width / 2 - 155 + i % 2 * 160;
        int k = this.height / 6 + 21 * (i / 2) - 12;

        if (!gamesettings$options.getEnumFloat())
        {
            this.buttonList.add(new GuiOptionButtonOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options)));
        }
        else
        {
            this.buttonList.add(new GuiOptionSliderOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options));
        }
    }

    this.buttonList.add(new GuiButton(210, this.width / 2 - 100, this.height / 6 + 168 + 11 - 44, I18n.format("of.options.other.reset", new Object[0])));
    this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168 + 11, I18n.format("gui.done", new Object[0])));
}
 
Example 5
Project: BaseClient   File: GuiScreenAddServer.java   Source Code and License 6 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 18, I18n.format("addServer.add", new Object[0])));
    this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 18, I18n.format("gui.cancel", new Object[0])));
    this.buttonList.add(this.serverResourcePacks = new GuiButton(2, this.width / 2 - 100, this.height / 4 + 72, I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText()));
    this.serverNameField = new GuiTextField(0, this.fontRendererObj, this.width / 2 - 100, 66, 200, 20);
    this.serverNameField.setFocused(true);
    this.serverNameField.setText(this.serverData.serverName);
    this.serverIPField = new GuiTextField(1, this.fontRendererObj, this.width / 2 - 100, 106, 200, 20);
    this.serverIPField.setMaxStringLength(128);
    this.serverIPField.setText(this.serverData.serverIP);
    this.serverIPField.func_175205_a(this.field_181032_r);
    ((GuiButton)this.buttonList.get(0)).enabled = this.serverIPField.getText().length() > 0 && this.serverIPField.getText().split(":").length > 0 && this.serverNameField.getText().length() > 0;
}
 
Example 6
Project: Mods   File: TF2EventsClient.java   Source Code and License 6 votes vote down vote up
@SubscribeEvent
public void playerName(PlayerEvent.NameFormat event) {
	if(Minecraft.getMinecraft().player != null && WeaponsCapability.get(event.getEntityPlayer()).isDisguised()) {
		String username=WeaponsCapability.get(event.getEntityPlayer()).getDisguiseType().substring(2);
		
		if(TF2Util.isOnSameTeam(Minecraft.getMinecraft().player, event.getEntityPlayer())) {
			event.setDisplayname(event.getDisplayname()+" ["+username+"]");
		}
		else {
			if(WeaponsCapability.get(event.getEntityPlayer()).getDisguiseType().startsWith("M:")) {
				if(event.getEntityPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).entityDisguise != null){
					event.setDisplayname(TextFormatting.RESET+event.getEntityPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).entityDisguise.getDisplayName().getFormattedText());
				}
				else
					event.setDisplayname(TextFormatting.RESET+I18n.format("entity."+username+".name"));
				
			}
			else
				event.setDisplayname(ScorePlayerTeam.formatPlayerName(Minecraft.getMinecraft().world.getScoreboard().getPlayersTeam(username), username));
		}
	}
}
 
Example 7
Project: BaseClient   File: GuiScreenOptionsSounds.java   Source Code and License 6 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    int i = 0;
    this.field_146507_a = I18n.format("options.sounds.title", new Object[0]);
    this.field_146508_h = I18n.format("options.off", new Object[0]);
    this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.getCategoryId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), SoundCategory.MASTER, true));
    i = i + 2;

    for (SoundCategory soundcategory : SoundCategory.values())
    {
        if (soundcategory != SoundCategory.MASTER)
        {
            this.buttonList.add(new GuiScreenOptionsSounds.Button(soundcategory.getCategoryId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), soundcategory, false));
            ++i;
        }
    }

    this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0])));
}
 
Example 8
Project: pnc-repressurized   File: GuiSecurityStationInventory.java   Source Code and License 6 votes vote down vote up
@Override
public void initGui() {
    super.initGui();

    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;

    statusStat = addAnimatedStat("Security Status", new ItemStack(Blockss.SECURITY_STATION), 0xFFFFAA00, false);
    accessStat = addAnimatedStat("Shared Users", new ItemStack(Items.SKULL, 1, 3), 0xFF005500, false);

    Rectangle accessButtonRectangle = accessStat.getButtonScaledRectangle(145, 10, 20, 20);
    addButton = getButtonFromRectangle(1, accessButtonRectangle, "+");
    rebootButton = new GuiButton(2, xStart + 110, yStart + 20, 60, 20, "Reboot");
    sharedUserTextField = getTextFieldFromRectangle(accessStat.getButtonScaledRectangle(20, 15, 120, 10));
    accessStat.addWidget(sharedUserTextField);
    accessStat.addWidget(addButton);

    buttonList.add(new GuiButton(3, guiLeft + 108, guiTop + 103, 64, 20, I18n.format("gui.securityStation.test")));
    buttonList.add(rebootButton);
    buttonList.add(new GuiButton(-1, guiLeft + 108, guiTop + 125, 64, 20, I18n.format("gui.universalSensor.button.showRange")));

    updateUserRemoveButtons();

    nodeHandler = new NetworkConnectionBackground(this, te, xStart + 25, yStart + 30, 18, 0xFF2222FF);
}
 
Example 9
Project: pnc-repressurized   File: GuiPressureModuleSimple.java   Source Code and License 6 votes vote down vote up
@Override
public void initGui() {
    super.initGui();

    String title = I18n.format("item." + module.getType() + ".name");
    addLabel(title, width / 2 - fontRenderer.getStringWidth(title) / 2, guiTop + 5);

    advancedMode = new GuiCheckBox(0, guiLeft + 6, guiTop + 15, 0xFF404040, "gui.tubeModule.advancedConfig").setTooltip(I18n.format("gui.tubeModule.advancedConfig.tooltip"));
    advancedMode.checked = false;
    addWidget(advancedMode);

    thresholdField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 110, guiTop + 33, 30, fontRenderer.FONT_HEIGHT).setDecimals(1);
    addWidget(thresholdField);

    if (module instanceof TubeModuleRedstoneReceiving) {
        thresholdField.setValue(((TubeModuleRedstoneReceiving) module).getThreshold());
        addLabel(I18n.format("gui.tubeModule.simpleConfig.threshold"), guiLeft + 6, guiTop + 33);
    } else {
        thresholdField.setValue(module.lowerBound);
        addLabel(I18n.format("gui.tubeModule.simpleConfig.turn"), guiLeft + 6, guiTop + 33);
        moreOrLessButton = new GuiButtonSpecial(1, guiLeft + 85, guiTop + 28, 20, 20, module.lowerBound < module.higherBound ? ">" : "<");
        moreOrLessButton.setTooltipText(I18n.format(module.lowerBound < module.higherBound ? "gui.tubeModule.simpleConfig.higherThan" : "gui.tubeModule.simpleConfig.lowerThan"));
        addWidget(moreOrLessButton);
    }
    addLabel(I18n.format("gui.general.bar"), guiLeft + 145, guiTop + 34);
}
 
Example 10
Project: BaseClient   File: GuiSelectWorld.java   Source Code and License 6 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.field_146628_f = I18n.format("selectWorld.title", new Object[0]);

    try
    {
        this.func_146627_h();
    }
    catch (AnvilConverterException anvilconverterexception)
    {
        logger.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception);
        this.mc.displayGuiScreen(new GuiErrorScreen("Unable to load worlds", anvilconverterexception.getMessage()));
        return;
    }

    this.field_146637_u = I18n.format("selectWorld.world", new Object[0]);
    this.field_146636_v = I18n.format("selectWorld.conversion", new Object[0]);
    this.field_146635_w[WorldSettings.GameType.SURVIVAL.getID()] = I18n.format("gameMode.survival", new Object[0]);
    this.field_146635_w[WorldSettings.GameType.CREATIVE.getID()] = I18n.format("gameMode.creative", new Object[0]);
    this.field_146635_w[WorldSettings.GameType.ADVENTURE.getID()] = I18n.format("gameMode.adventure", new Object[0]);
    this.field_146635_w[WorldSettings.GameType.SPECTATOR.getID()] = I18n.format("gameMode.spectator", new Object[0]);
    this.field_146638_t = new GuiSelectWorld.List(this.mc);
    this.field_146638_t.registerScrollButtons(4, 5);
    this.func_146618_g();
}
 
Example 11
Project: CreeperHostGui   File: GuiInvited.java   Source Code and License 6 votes vote down vote up
@Override
public void initGui()
{
    int yBase = this.height / 2 - (106 / 2);
    connectButton = new GuiButton(0, width / 2 - 40, this.height - 30, 80, 20, I18n.format("creeperhost.multiplayer.connect"));
    if (canConnect)
    {
        buttonList.add(connectButton);
    }
    cancelButton = new GuiButton(1, width - 100, this.height - 30, 80, 20, I18n.format("creeperhost.multiplayer.cancel"));
    buttonList.add(cancelButton);
    String checkText = I18n.format("creeperhost.multiplayer.addlist");
    int checkWidth = 11 + 2 + fontRendererObj.getStringWidth(checkText);
    checkBox = new GuiCheckBox(2, (width / 2) - (checkWidth / 2), yBase + 36 + 30 + 30, checkText, addToServerList);
    buttonList.add(checkBox);
}
 
Example 12
Project: CustomWorldGen   File: GuiBeacon.java   Source Code and License 6 votes vote down vote up
/**
 * Draw the foreground layer for the GuiContainer (everything in front of the items)
 */
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
    RenderHelper.disableStandardItemLighting();
    this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.primary", new Object[0]), 62, 10, 14737632);
    this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.secondary", new Object[0]), 169, 10, 14737632);

    for (GuiButton guibutton : this.buttonList)
    {
        if (guibutton.isMouseOver())
        {
            guibutton.drawButtonForegroundLayer(mouseX - this.guiLeft, mouseY - this.guiTop);
            break;
        }
    }

    RenderHelper.enableGUIStandardItemLighting();
}
 
Example 13
Project: Backmemed   File: GuiCommandBlock.java   Source Code and License 6 votes vote down vote up
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    this.drawDefaultBackground();
    this.drawCenteredString(this.fontRendererObj, I18n.format("advMode.setCommand", new Object[0]), this.width / 2, 20, 16777215);
    this.drawString(this.fontRendererObj, I18n.format("advMode.command", new Object[0]), this.width / 2 - 150, 37, 10526880);
    this.commandTextField.drawTextBox();
    int i = 75;
    int j = 0;
    this.drawString(this.fontRendererObj, I18n.format("advMode.nearestPlayer", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);
    this.drawString(this.fontRendererObj, I18n.format("advMode.randomPlayer", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);
    this.drawString(this.fontRendererObj, I18n.format("advMode.allPlayers", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);
    this.drawString(this.fontRendererObj, I18n.format("advMode.allEntities", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);
    this.drawString(this.fontRendererObj, "", this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);

    if (!this.previousOutputTextField.getText().isEmpty())
    {
        i = i + j * this.fontRendererObj.FONT_HEIGHT + 1;
        this.drawString(this.fontRendererObj, I18n.format("advMode.previousOutput", new Object[0]), this.width / 2 - 150, i, 10526880);
        this.previousOutputTextField.drawTextBox();
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
Example 14
Project: Backmemed   File: GuiConnecting.java   Source Code and License 6 votes vote down vote up
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    this.drawDefaultBackground();

    if (this.networkManager == null)
    {
        this.drawCenteredString(this.fontRendererObj, I18n.format("connect.connecting", new Object[0]), this.width / 2, this.height / 2 - 50, 16777215);
    }
    else
    {
        this.drawCenteredString(this.fontRendererObj, I18n.format("connect.authorizing", new Object[0]), this.width / 2, this.height / 2 - 50, 16777215);
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
Example 15
Project: BaseClient   File: GuiCustomizeSkin.java   Source Code and License 6 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    int i = 0;
    this.title = I18n.format("options.skinCustomisation.title", new Object[0]);

    for (EnumPlayerModelParts enumplayermodelparts : EnumPlayerModelParts.values())
    {
        this.buttonList.add(new GuiCustomizeSkin.ButtonPart(enumplayermodelparts.getPartId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20, enumplayermodelparts));
        ++i;
    }

    if (i % 2 == 1)
    {
        ++i;
    }

    this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 24 * (i >> 1), I18n.format("gui.done", new Object[0])));
}
 
Example 16
Project: pnc-repressurized   File: WailaRedstoneControl.java   Source Code and License 6 votes vote down vote up
public static void addTipToMachine(List<String> currenttip, IWailaDataAccessor accessor) {
    NBTTagCompound tag = accessor.getNBTData();
    //This is used so that we can split values later easier and have them all in the same layout.
    Map<String, String> values = new HashMap<>();

    if (tag.hasKey("redstoneMode")) {
        int mode = tag.getInteger("redstoneMode");
        GuiPneumaticContainerBase gui = (GuiPneumaticContainerBase) PneumaticCraftRepressurized.proxy.getClientGuiElement(((BlockPneumaticCraft) accessor.getBlock()).getGuiID().ordinal(),
                accessor.getPlayer(), accessor.getWorld(), accessor.getPosition().getX(), accessor.getPosition().getY(), accessor.getPosition().getZ());
        TileEntity te = accessor.getTileEntity();
        if (te instanceof TileEntityBase) {
            values.put(((TileEntityBase) te).getRedstoneString(), ((TileEntityBase) te).getRedstoneButtonText(mode));
        }
    }

    //Get all the values from the map and put them in the list.
    for (Map.Entry<String, String> entry : values.entrySet()) {
        currenttip.add(TextFormatting.RED + I18n.format(entry.getKey()) + ": " + I18n.format(entry.getValue()));
    }
}
 
Example 17
Project: Mods   File: GuiSentry.java   Source Code and License 6 votes vote down vote up
@Override
public void initGui() {
	this.buttonList.clear();
	this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 + 5, this.height / 2 + 60, 40, 20,
			I18n.format("gui.done", new Object[0])));
	this.buttonList
			.add(this.attackOnHurtBtn = new GuiButton(1, this.width / 2 + 80, this.height / 2 - 60, 25, 20, "no"));
	this.buttonList.add(
			this.attackOtherPlayersBtn = new GuiButton(2, this.width / 2 + 80, this.height / 2 - 35, 25, 20, "no"));
	this.buttonList.add(
			this.attackHostileMobsBtn = new GuiButton(3, this.width / 2 + 80, this.height / 2 - 10, 25, 20, "no"));
	this.buttonList.add(
			this.attackFriendlyMobsBtn = new GuiButton(4, this.width / 2 + 80, this.height / 2 + 15, 25, 20, "no"));
	this.buttonList.add(this.grab = new GuiButton(5, this.width / 2 - 45, this.height / 2 + 60, 40, 20,
			I18n.format("gui.teleporter.drop", new Object[0])));
}
 
Example 18
Project: Mods   File: TF2Attribute.java   Source Code and License 6 votes vote down vote up
public String getTranslatedString(float value, boolean withColor) {
	String valueStr = String.valueOf(value);
	if (this.typeOfValue == Type.PERCENTAGE)
		valueStr = Integer.toString(Math.round((value - 1) * 100)) + "%";
	else if (this.typeOfValue == Type.INVERTED_PERCENTAGE)
		valueStr = Integer.toString(Math.round((1 - value) * 100)) + "%";
	else if (this.typeOfValue == Type.ADDITIVE)
		valueStr = Integer.toString(Math.round(value));

	if (withColor) {
		TextFormatting color = this.state == State.POSITIVE ? TextFormatting.AQUA
				: (this.state == State.NEGATIVE ? TextFormatting.RED : TextFormatting.WHITE);
		return color + I18n.format("weaponAttribute." + this.name, new Object[] { valueStr });
	} else
		return I18n.format("weaponAttribute." + this.name, new Object[] { valueStr });

}
 
Example 19
Project: pnc-repressurized   File: ModuleLogistics.java   Source Code and License 6 votes vote down vote up
@Override
public void addInfo(List<String> curInfo) {
    super.addInfo(curInfo);
    String status;
    if (ticksSinceAction >= 0) {
        status = "waila.logisticsModule.transporting";
    } else if (ticksSinceNotEnoughAir >= 0) {
        status = "waila.logisticsModule.notEnoughAir";
    } else if (hasPower()) {
        status = "waila.logisticsModule.powered";
    } else {
        status = "waila.logisticsModule.noPower";
    }
    curInfo.add(I18n.format("hud.msg.state") + ": " + I18n.format(status));
    curInfo.add(I18n.format("waila.logisticsModule.channel") + " " + TextFormatting.YELLOW + I18n.format("item.fireworksCharge." + ItemDye.DYE_COLORS[colorChannel]));
}
 
Example 20
Project: Adventurers-Toolbox   File: GuiBook.java   Source Code and License 6 votes vote down vote up
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
	if (this.visible) {
		FontRenderer fontrenderer = mc.fontRenderer;
		GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
		this.hovered = mouseX >= this.x && mouseY >= this.y
				&& mouseX < this.x + this.width && mouseY < this.y + this.height;
		int i = this.getHoverState(this.hovered);
		this.mouseDragged(mc, mouseX, mouseY);
		int j = 0;
		String p = "";

		if (!this.enabled) {
			j = 10526880;
		} else if (this.hovered) {
			j = 1450415;
			p += TextFormatting.UNDERLINE;
		}

		fontrenderer.drawString(p + I18n.format(this.displayString), this.x, this.y, j);
	}
}
 
Example 21
Project: pnc-repressurized   File: GuiCheckBox.java   Source Code and License 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick) {
    drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? 0xFFA0A0A0 : 0xFF999999);
    drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? 0xFF202020 : 0xFFAAAAAA);
    if (checked) {
        GlStateManager.disableTexture2D();
        if (enabled) {
            GlStateManager.color(1, 1, 1, 1);
        } else {
            GlStateManager.color(0.8f, 0.8f, 0.8f, 1);
        }
        BufferBuilder wr = Tessellator.getInstance().getBuffer();
        wr.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
        wr.pos(x + 2, y + 5, zLevel).endVertex();
        wr.pos(x + 5, y + 7, zLevel).endVertex();
        wr.pos(x + 8, y + 3, zLevel).endVertex();
        Tessellator.getInstance().draw();
        GlStateManager.enableTexture2D();
        GlStateManager.color(0.25f, 0.25f, 0.25f, 1);
    }
    fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888);
}
 
Example 22
Project: CustomWorldGen   File: GuiGameOver.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.buttonList.clear();
    this.enableButtonsTimer = 0;

    if (this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled())
    {
        this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 72, I18n.format("deathScreen.spectate", new Object[0])));
        this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 96, I18n.format("deathScreen." + (this.mc.isIntegratedServerRunning() ? "deleteWorld" : "leaveServer"), new Object[0])));
    }
    else
    {
        this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 72, I18n.format("deathScreen.respawn", new Object[0])));
        this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 96, I18n.format("deathScreen.titleScreen", new Object[0])));

        if (this.mc.getSession() == null)
        {
            ((GuiButton)this.buttonList.get(1)).enabled = false;
        }
    }

    for (GuiButton guibutton : this.buttonList)
    {
        guibutton.enabled = false;
    }
}
 
Example 23
Project: CreeperHostGui   File: GuiInvited.java   Source Code and License 5 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    drawBackground(0);
    int yBase = this.height / 2 - (106 / 2);

    this.drawCenteredString(this.fontRendererObj, I18n.format("creeperhost.multiplayer.invite"), this.width / 2, 10, -1);

    this.drawCenteredString(this.fontRendererObj, I18n.format("creeperhost.multiplayer.invited", invite.by), this.width / 2, yBase, -1);
    server.drawEntry(0, (this.width / 2) - 125, yBase + 20, 250, 36, Tessellator.instance, Integer.MAX_VALUE, Integer.MAX_VALUE, false);
    this.drawCenteredString(this.fontRendererObj, Util.localize(canConnect ? "multiplayer.join" : "multiplayer.cantjoin", invite.by), this.width / 2, yBase + 36 + 30, -1);

    super.drawScreen(mouseX, mouseY, partialTicks);

}
 
Example 24
Project: CustomWorldGen   File: GuiConfigEntries.java   Source Code and License 5 votes vote down vote up
public CategoryEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement)
{
    super(owningScreen, owningEntryList, configElement);

    this.childScreen = this.buildChildScreen();

    this.btnSelectCategory = new GuiButtonExt(0, 0, 0, 300, 18, I18n.format(name));
    this.tooltipHoverChecker = new HoverChecker(this.btnSelectCategory, 800);

    this.drawLabel = false;
}
 
Example 25
Project: MineCamera   File: BlockPictureFrameMultiple.java   Source Code and License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
	tooltip.add(TextFormatting.BLUE + I18n.format("lore.pictureframe_multiple.info"));
	tooltip.add(TextFormatting.BLUE + I18n.format("lore.pictureframe_multiple.info2"));
	tooltip.add(TextFormatting.BLUE + I18n.format("lore.pictureframe_multiple.info3"));
}
 
Example 26
Project: pnc-repressurized   File: ClientEventHandler.java   Source Code and License 5 votes vote down vote up
private void handleProgrammableTooltip(ItemTooltipEvent event) {
    IProgrammable programmable = (IProgrammable) event.getItemStack().getItem();
    if (programmable.canProgram(event.getItemStack()) && programmable.showProgramTooltip()) {
        boolean hasInvalidPrograms = false;
        List<String> addedEntries = new ArrayList<>();
        List<IProgWidget> widgets = TileEntityProgrammer.getProgWidgets(event.getItemStack());
        Map<String, Integer> widgetMap = getPuzzleSummary(widgets);
        for (Map.Entry<String, Integer> entry : widgetMap.entrySet()) {
            IProgWidget widget = ItemProgrammingPuzzle.getWidgetForName(entry.getKey());
            String prefix = "";
            GuiScreen curScreen = Minecraft.getMinecraft().currentScreen;
            if (curScreen instanceof IGuiDrone) {
                if (!((IGuiDrone) curScreen).getDrone().isProgramApplicable(widget)) {
                    prefix = TextFormatting.RED + "";
                    hasInvalidPrograms = true;
                }
            }
            addedEntries.add(prefix + "- " + entry.getValue() + "x " + I18n.format("programmingPuzzle." + entry.getKey() + ".name"));
        }
        if (hasInvalidPrograms) {
            event.getToolTip().add(TextFormatting.RED + I18n.format("gui.tooltip.programmable.invalidPieces"));
        }
        Collections.sort(addedEntries);
        event.getToolTip().addAll(addedEntries);
        if (PneumaticCraftRepressurized.proxy.isSneakingInGui() && !widgets.isEmpty()) {
            Map<Integer,Integer> widgetColorMap = TileEntityProgrammer.getPuzzleSummary(widgets);
            event.getToolTip().add(TextFormatting.WHITE + I18n.format("gui.tooltip.programmable.requiredPieces"));
            for (int color : widgetColorMap.keySet()) {
                ItemStack stack = ItemProgrammingPuzzle.getStackForColor(color);
                stack.setCount(widgetColorMap.get(color));
                event.getToolTip().add("- " + widgetColorMap.get(color) + " x " + stack.getDisplayName());
            }
        }
    }
}
 
Example 27
Project: BaseClient   File: GuiSnooper.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.field_146610_i = I18n.format("options.snooper.title", new Object[0]);
    String s = I18n.format("options.snooper.desc", new Object[0]);
    java.util.List<String> list = Lists.<String>newArrayList();

    for (Object s1 : this.fontRendererObj.listFormattedStringToWidth(s, this.width - 30))
    {
        list.add((String) s1);
    }

    this.field_146607_r = (String[])list.toArray(new String[list.size()]);
    this.field_146604_g.clear();
    this.field_146609_h.clear();
    this.buttonList.add(this.field_146605_t = new GuiButton(1, this.width / 2 - 152, this.height - 30, 150, 20, this.game_settings_2.getKeyBinding(GameSettings.Options.SNOOPER_ENABLED)));
    this.buttonList.add(new GuiButton(2, this.width / 2 + 2, this.height - 30, 150, 20, I18n.format("gui.done", new Object[0])));
    boolean flag = this.mc.getIntegratedServer() != null && this.mc.getIntegratedServer().getPlayerUsageSnooper() != null;

    for (Entry<String, String> entry : (new TreeMap<String, String>(this.mc.getPlayerUsageSnooper().getCurrentStats())).entrySet())
    {
        this.field_146604_g.add((flag ? "C " : "") + (String)entry.getKey());
        this.field_146609_h.add(this.fontRendererObj.trimStringToWidth((String)entry.getValue(), this.width - 220));
    }

    if (flag)
    {
        for (Entry<String, String> entry1 : (new TreeMap<String, String>(this.mc.getIntegratedServer().getPlayerUsageSnooper().getCurrentStats())).entrySet())
        {
            this.field_146604_g.add("S " + (String)entry1.getKey());
            this.field_146609_h.add(this.fontRendererObj.trimStringToWidth((String)entry1.getValue(), this.width - 220));
        }
    }

    this.field_146606_s = new GuiSnooper.List();
}
 
Example 28
Project: DecompiledMinecraft   File: GuiAchievement.java   Source Code and License 5 votes vote down vote up
public void displayAchievement(Achievement ach)
{
    this.achievementTitle = I18n.format("achievement.get", new Object[0]);
    this.achievementDescription = ach.getStatName().getUnformattedText();
    this.notificationTime = Minecraft.getSystemTime();
    this.theAchievement = ach;
    this.permanentNotification = false;
}
 
Example 29
Project: CustomWorldGen   File: GuiConfirmOpenLink.java   Source Code and License 5 votes vote down vote up
public GuiConfirmOpenLink(GuiYesNoCallback p_i1084_1_, String linkTextIn, int p_i1084_3_, boolean p_i1084_4_)
{
    super(p_i1084_1_, I18n.format(p_i1084_4_ ? "chat.link.confirmTrusted" : "chat.link.confirm", new Object[0]), linkTextIn, p_i1084_3_);
    this.confirmButtonText = I18n.format(p_i1084_4_ ? "chat.link.open" : "gui.yes", new Object[0]);
    this.cancelButtonText = I18n.format(p_i1084_4_ ? "gui.cancel" : "gui.no", new Object[0]);
    this.copyLinkButtonText = I18n.format("chat.copy", new Object[0]);
    this.openLinkWarning = I18n.format("chat.link.warning", new Object[0]);
    this.linkText = linkTextIn;
}
 
Example 30
Project: CustomWorldGen   File: GuiEditCommandBlockMinecart.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.doneButton = this.addButton(new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done", new Object[0])));
    this.cancelButton = this.addButton(new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel", new Object[0])));
    this.outputButton = this.addButton(new GuiButton(4, this.width / 2 + 150 - 20, 150, 20, 20, "O"));
    this.commandField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20);
    this.commandField.setMaxStringLength(32500);
    this.commandField.setFocused(true);
    this.commandField.setText(this.commandBlockLogic.getCommand());
    this.previousEdit = new GuiTextField(3, this.fontRendererObj, this.width / 2 - 150, 150, 276, 20);
    this.previousEdit.setMaxStringLength(32500);
    this.previousEdit.setEnabled(false);
    this.previousEdit.setText("-");
    this.trackOutput = this.commandBlockLogic.shouldTrackOutput();
    this.updateCommandOutput();
    this.doneButton.enabled = !this.commandField.getText().trim().isEmpty();
    this.tabCompleter = new TabCompleter(this.commandField, true)
    {
        @Nullable
        public BlockPos getTargetBlockPos()
        {
            return GuiEditCommandBlockMinecart.this.commandBlockLogic.getPosition();
        }
    };
}
 
Example 31
Project: CustomWorldGen   File: GuiJava8Error.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
@Override
public void initGui()
{
    this.buttonList.clear();
    this.buttonList.add(new GuiButton(1, 50, this.height - 38, this.width/2 -55, 20, I18n.format("fml.button.visitjavadownloads")));
    if (java8VersionException.getMods().isEmpty())
    {
        this.buttonList.add(new GuiButton(3, this.width / 2 + 5, this.height - 38, this.width / 2 - 55, 20, I18n.format("fml.button.continue")));
    }
    else
    {
        this.buttonList.add(new GuiButton(2, this.width / 2 + 5, this.height - 38, this.width / 2 - 55, 20, I18n.format("menu.quit")));
    }
}
 
Example 32
Project: ObsidianSuite   File: GuiAnimationMainMenu.java   Source Code and License 5 votes vote down vote up
/**
 * Adds Singleplayer and Multiplayer buttons on Main Menu for players who have bought the game.
 */
private void addSingleplayerMultiplayerButtons(int y, int spaceY)
{
    this.buttonList.add(new GuiButton(1, this.width / 2 - 100, y, I18n.format("menu.singleplayer", new Object[0])));
    this.buttonList.add(new GuiButton(2, this.width / 2 - 100, y + spaceY * 1, I18n.format("menu.multiplayer", new Object[0])));
    GuiButton realmsButton = new GuiButton(14, this.width / 2 - 100, y + spaceY * 3, I18n.format("menu.online", new Object[0]));
    GuiButton fmlModButton = new GuiButton(6, this.width / 2 - 100, y + spaceY * 3, "Mods");
    fmlModButton.x = this.width / 2 + 2;
    realmsButton.width = 98;
    fmlModButton.width = 98;
    this.buttonList.add(realmsButton);
    this.buttonList.add(fmlModButton);
}
 
Example 33
Project: Backmemed   File: GuiEditCommandBlockMinecart.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.doneButton = this.addButton(new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done", new Object[0])));
    this.cancelButton = this.addButton(new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel", new Object[0])));
    this.outputButton = this.addButton(new GuiButton(4, this.width / 2 + 150 - 20, 150, 20, 20, "O"));
    this.commandField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20);
    this.commandField.setMaxStringLength(32500);
    this.commandField.setFocused(true);
    this.commandField.setText(this.commandBlockLogic.getCommand());
    this.previousEdit = new GuiTextField(3, this.fontRendererObj, this.width / 2 - 150, 150, 276, 20);
    this.previousEdit.setMaxStringLength(32500);
    this.previousEdit.setEnabled(false);
    this.previousEdit.setText("-");
    this.trackOutput = this.commandBlockLogic.shouldTrackOutput();
    this.updateCommandOutput();
    this.doneButton.enabled = !this.commandField.getText().trim().isEmpty();
    this.tabCompleter = new TabCompleter(this.commandField, true)
    {
        @Nullable
        public BlockPos getTargetBlockPos()
        {
            return GuiEditCommandBlockMinecart.this.commandBlockLogic.getPosition();
        }
    };
}
 
Example 34
Project: CustomWorldGen   File: GuiCreateWorld.java   Source Code and License 5 votes vote down vote up
/**
 * Sets displayed GUI elements according to the current settings state
 */
private void updateDisplayState()
{
    this.btnGameMode.displayString = I18n.format("selectWorld.gameMode", new Object[0]) + ": " + I18n.format("selectWorld.gameMode." + this.gameMode, new Object[0]);
    this.gameModeDesc1 = I18n.format("selectWorld.gameMode." + this.gameMode + ".line1", new Object[0]);
    this.gameModeDesc2 = I18n.format("selectWorld.gameMode." + this.gameMode + ".line2", new Object[0]);
    this.btnMapFeatures.displayString = I18n.format("selectWorld.mapFeatures", new Object[0]) + " ";

    if (this.generateStructuresEnabled)
    {
        this.btnMapFeatures.displayString = this.btnMapFeatures.displayString + I18n.format("options.on", new Object[0]);
    }
    else
    {
        this.btnMapFeatures.displayString = this.btnMapFeatures.displayString + I18n.format("options.off", new Object[0]);
    }

    this.btnBonusItems.displayString = I18n.format("selectWorld.bonusItems", new Object[0]) + " ";

    if (this.bonusChestEnabled && !this.hardCoreMode)
    {
        this.btnBonusItems.displayString = this.btnBonusItems.displayString + I18n.format("options.on", new Object[0]);
    }
    else
    {
        this.btnBonusItems.displayString = this.btnBonusItems.displayString + I18n.format("options.off", new Object[0]);
    }

    this.btnMapType.displayString = I18n.format("selectWorld.mapType", new Object[0]) + " " + I18n.format(WorldType.WORLD_TYPES[this.selectedIndex].getTranslateName(), new Object[0]);
    this.btnAllowCommands.displayString = I18n.format("selectWorld.allowCommands", new Object[0]) + " ";

    if (this.allowCheats && !this.hardCoreMode)
    {
        this.btnAllowCommands.displayString = this.btnAllowCommands.displayString + I18n.format("options.on", new Object[0]);
    }
    else
    {
        this.btnAllowCommands.displayString = this.btnAllowCommands.displayString + I18n.format("options.off", new Object[0]);
    }
}
 
Example 35
Project: CustomWorldGen   File: GuiEditStructure.java   Source Code and License 5 votes vote down vote up
private void updateEntitiesButton()
{
    boolean flag = !this.tileStructure.ignoresEntities();

    if (flag)
    {
        this.showEntitiesButton.displayString = I18n.format("options.on", new Object[0]);
    }
    else
    {
        this.showEntitiesButton.displayString = I18n.format("options.off", new Object[0]);
    }
}
 
Example 36
Project: CreeperHostGui   File: GuiMultiplayerPublic.java   Source Code and License 5 votes vote down vote up
@Override
public void drawCenteredString(FontRenderer fontRendererIn, String text, int x, int y, int color)
{
    if (text.equals(I18n.format("multiplayer.title")))
    {
        text = I18n.format("creeperhost.multiplayer.public");
    }
    super.drawCenteredString(fontRendererIn, text, x, y, color);
}
 
Example 37
Project: pnc-repressurized   File: GuiPressureChamber.java   Source Code and License 5 votes vote down vote up
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
    super.drawGuiContainerForegroundLayer(x, y);
    String containerName = I18n.format("gui.pressureChamberTitle", te.multiBlockSize + "x" + te.multiBlockSize + "x" + te.multiBlockSize);
    fontRenderer.drawString(containerName, xSize / 2 - fontRenderer.getStringWidth(containerName) / 2, 6, 4210752);
    fontRenderer.drawString("Upgr.", 53, 19, 4210752);
}
 
Example 38
Project: FoodCraft-Reloaded   File: FCRItemFood.java   Source Code and License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
    FCRItemFood item = (FCRItemFood) stack.getItem();
    tooltip.add(I18n.format("tooltip.fcrfood.heal", item.healAmount));
    tooltip.add(I18n.format("tooltip.fcrfood.duration", (item.itemUseDuration / 20.0)));
}
 
Example 39
Project: DecompiledMinecraft   File: GuiShareToLan.java   Source Code and License 5 votes vote down vote up
private void func_146595_g()
{
    this.field_146597_g.displayString = I18n.format("selectWorld.gameMode", new Object[0]) + " " + I18n.format("selectWorld.gameMode." + this.field_146599_h, new Object[0]);
    this.field_146596_f.displayString = I18n.format("selectWorld.allowCommands", new Object[0]) + " ";

    if (this.field_146600_i)
    {
        this.field_146596_f.displayString = this.field_146596_f.displayString + I18n.format("options.on", new Object[0]);
    }
    else
    {
        this.field_146596_f.displayString = this.field_146596_f.displayString + I18n.format("options.off", new Object[0]);
    }
}
 
Example 40
Project: BaseClient   File: GuiIngestServers.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.field_152310_f = I18n.format("options.stream.ingest.title", new Object[0]);
    this.field_152311_g = new GuiIngestServers.ServerList(this.mc);

    if (!this.mc.getTwitchStream().func_152908_z())
    {
        this.mc.getTwitchStream().func_152909_x();
    }

    this.buttonList.add(new GuiButton(1, this.width / 2 - 155, this.height - 24 - 6, 150, 20, I18n.format("gui.done", new Object[0])));
    this.buttonList.add(new GuiButton(2, this.width / 2 + 5, this.height - 24 - 6, 150, 20, I18n.format("options.stream.ingest.reset", new Object[0])));
}