net.minecraft.client.resources.I18n Java Examples

The following examples show how to use net.minecraft.client.resources.I18n. 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: GuiContainerBase.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawScreen(int x, int y, float partialTick){
    if(!hasInit) return;
    super.drawScreen(x, y, partialTick);

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

    GL11.glColor4d(1, 1, 1, 1);
    GL11.glDisable(GL11.GL_LIGHTING);
    for(IGuiWidget widget : widgets) {
        if(widget.getBounds().contains(x, y)) widget.addTooltip(x, y, tooltip, Signals.proxy.isSneakingInGui());
    }

    if(!tooltip.isEmpty()) {
        List<String> localizedTooltip = new ArrayList<>();
        for(String line : tooltip) {
            String localizedLine = I18n.format(line);
            String[] lines = WordUtils.wrap(localizedLine, 50).split(System.getProperty("line.separator"));
            for(String locLine : lines) {
                localizedTooltip.add(locLine);
            }
        }
        drawHoveringText(localizedTooltip, x, y, fontRenderer);
    }
}
 
Example #2
Source File: GuiServices.java    From MediaMod with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawDefaultBackground();

    GlStateManager.pushMatrix();
    GlStateManager.color(1, 1, 1, 1);

    // Bind the texture for rendering
    mc.getTextureManager().bindTexture(this.headerResource);

    // Render the header
    Gui.drawModalRectWithCustomSizedTexture(width / 2 - 111, height / 2 - 110, 0, 0, 222, 55, 222, 55);
    GlStateManager.popMatrix();

    if (!SpotifyHandler.logged) {
        drawCenteredString(fontRendererObj, I18n.format("menu.guiservices.text.spotifyNotLogged.name"), width / 2, height / 2 - 53, Color.red.getRGB());
    } else {
        drawCenteredString(fontRendererObj, I18n.format("menu.guiservices.text.spotifyLogged.name"), width / 2, height / 2 - 53, Color.green.getRGB());
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
Example #3
Source File: GuiOmnidirectionalHopper.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initGui(){
    super.initGui();
    statusStat = addAnimatedStat("gui.tab.hopperStatus", new ItemStack(Blockss.omnidirectionalHopper), 0xFFFFAA00, false);

    GuiAnimatedStat optionStat = addAnimatedStat("gui.tab.gasLift.mode", new ItemStack(net.minecraft.init.Blocks.lever), 0xFFFFCC00, false);
    List<String> text = new ArrayList<String>();
    for(int i = 0; i < 4; i++)
        text.add("               ");
    optionStat.setTextWithoutCuttingString(text);

    GuiButtonSpecial button = new GuiButtonSpecial(1, 5, 20, 20, 20, "");
    button.setRenderStacks(new ItemStack(Items.bucket));
    button.setTooltipText(I18n.format("gui.tab.omnidirectionalHopper.mode.empty"));
    optionStat.addWidget(button);
    modeButtons[0] = button;

    button = new GuiButtonSpecial(2, 30, 20, 20, 20, "");
    button.setRenderStacks(new ItemStack(Items.water_bucket));
    button.setTooltipText(I18n.format("gui.tab.omnidirectionalHopper.mode.leaveItem"));
    optionStat.addWidget(button);
    modeButtons[1] = button;
}
 
Example #4
Source File: ScreenEntityEntry.java    From WearableBackpacks with MIT License 6 votes vote down vote up
public EntryButtonRenderOptions(EntryEntityID entityID, Optional<RenderOptions> value,
                                Supplier<List<BackpackEntry>> backpacks) {
	_previousValue = value;
	_value = value.orElse(RenderOptions.DEFAULT);
	
	GuiButton button = new GuiButton(EntryCategory.BUTTON_WIDTH);
	String languageKey = "config." + WearableBackpacks.MOD_ID + ".entity.renderOptions";
	button.setText(I18n.format(languageKey));
	button.setTooltip(formatTooltip(languageKey, languageKey + ".tooltip", null, null));
	button.setAction(() -> display(new ScreenRenderOptions(this, backpacks.get(),
		entityID.entityEntry.map(e -> (Class<? extends EntityLivingBase>)e.getEntityClass()).orElse(null))));
	
	setSpacing(6);
	addWeighted(button);
	addFixed(buttonUndo);
}
 
Example #5
Source File: VillageLordGuiContainer.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
private static String processListParamter(String s) {
	StringBuilder sb = new StringBuilder();
	String[] sStacks = s.substring(2).split(";");

	boolean isFirst = true;

	for (String sStack : sStacks) {
		if (isFirst) {
			isFirst = false;
		} else {
			sb.append(", ");
		}

		String[] sStackParts = sStack.split(",");

		if (sStackParts.length == 2) {
			sb.append(I18n.format(sStackParts[0] + ".name"));
			sb.append("[").append(sStackParts[1]).append("]");
		} else {
			sb.append(sStackParts);
		}
	}

	return sb.toString();
}
 
Example #6
Source File: GuiFluidKineticGenerator.java    From Production-Line with MIT License 6 votes vote down vote up
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
    super.drawGuiContainerForegroundLayer(x, y);
    if (this.container.tile.fluidTank.getFluidAmount() > 0) {
        String tooltip = this.container.tile.fluidTank.getFluid().getLocalizedName() + ": " + this.container.tile.fluidTank.getFluidAmount() + "mB";
        drawTooltip(x - this.guiLeft, y - this.guiTop, Collections.singletonList(tooltip));
    }

    String output = I18n.format(GUI_PREFIX + "FluidKineticGenerator.output",
            this.container.getTileEntity().maxrequestkineticenergyTick(
                    this.container.getTileEntity().facing));
    this.drawString(this.fontRendererObj, output, 96, 33, 2157374);

    String max_output = I18n.format(GUI_PREFIX + "FluidKineticGenerator.max-output",
            this.container.getTileEntity().kuOutput);
    this.drawString(this.fontRendererObj, max_output, 96, 52, 2157374);
}
 
Example #7
Source File: GuiPortalPanel.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
    super.drawGuiContainerForegroundLayer(mouseX, mouseY);

    String s = this.tepp.hasCustomName() ? this.tepp.getName() : I18n.format(this.tepp.getName());
    this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 5, 0x404040);
    this.fontRenderer.drawString(I18n.format("enderutilities.gui.label.settargetname"), 8, 118, 0x404040);
    this.fontRenderer.drawString(I18n.format("container.inventory"), 8, 156, 0x404040);

    GlStateManager.disableLighting();
    GlStateManager.disableBlend();

    String name = this.tepp.getPanelDisplayName();

    if (this.nameLast.equals(name) == false)
    {
        this.nameField.setText(name);
        this.nameLast = name;
    }

    this.nameField.drawTextBox();
}
 
Example #8
Source File: ChangeBackgroundGui.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void initGui() {
    downloadUrlField = new GuiTextField(0, mc.fontRendererObj, width / 4, height / 2 - 10, width / 2, 20);
    downloadUrlField.setFocused(true);
    downloadUrlField.setMaxStringLength(150);
    buttonList.add(new GuiButton(1, width / 2 - 150 / 2, height / 2 + 20, 150, 20,
        I18n.format("button.changebackground.seturl")));
    buttonList.add(new GuiButton(2, width / 2 - 150 / 2, height / 2 + 42, 150, 20,
        I18n.format("button.changebackground.choosefile")));
    buttonList.add(new GuiButton(3, width / 2 - 150 / 2, height / 2 + 64, 150, 20,
        I18n.format("button.changebackground.resetbackground")));
    buttonList.add(new GuiButton(4, width / 2 - 150 / 2, height / 2 + 86, 150, 20,
        I18n.format("gui.cancel")));

    if (Minecraft.getMinecraft().isFullScreen()) Minecraft.getMinecraft().toggleFullscreen();
}
 
Example #9
Source File: GuiInserter.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
    if (this.tef.isFiltered())
    {
        this.fontRenderer.drawString(I18n.format("enderutilities.container.inserter_filtered"), 8, 6, 0x404040);
        this.fontRenderer.drawString(I18n.format("container.inventory"), 8, 105, 0x404040);
    }
    else
    {
        this.fontRenderer.drawString(I18n.format("enderutilities.container.inserter_normal"), 8, 6, 0x404040);
        this.fontRenderer.drawString(I18n.format("container.inventory"), 8, 49, 0x404040);
    }

    String str = String.valueOf(this.tef.getBaseItemHandler().getInventoryStackLimit());
    this.fontRenderer.drawString(str, 134 - this.fontRenderer.getStringWidth(str), 22, 0x404040);
    str = String.valueOf(this.tef.getUpdateDelay());
    this.fontRenderer.drawString(str, 134 - this.fontRenderer.getStringWidth(str), 36, 0x404040);
}
 
Example #10
Source File: ConfigurationHandler.java    From Fullscreen-Windowed-Minecraft with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void load()
{
    _enableFullscreenWindowed = _configuration.get(Configuration.CATEGORY_GENERAL, "enableFullscreenWindowed", true, I18n.format("comment.fullscreenwindowed.enableFullscreenWindowed"));
    _fullscreenMonitor = _configuration.get(Configuration.CATEGORY_GENERAL, "fullscreenMonitor", Reference.AUTOMATIC_MONITOR_SELECTION, I18n.format("comment.fullscreenwindowed.fullscreenmonitor"));
    _enableAdvancedFeatures = _configuration.get(ConfigurationHandler.CATEGORY_ADVANCED, "enableAdvancedFeatures", Reference.ADVANCED_FEATURES_ENABLED, I18n.format("comment.fullscreenwindowed.enableAdvancedFeatures"));
    _enableMaximumCompatibility = _configuration.get(Configuration.CATEGORY_GENERAL, "enableMaximumCompatibility", Reference.ENABLE_MAXIMUM_COMPATIBILITY, I18n.format("comment.fullscreenwindowed.enableMaximumCompatibility"));

    _customFullscreenDimensions = _configuration.get(ConfigurationHandler.CATEGORY_ADVANCED, "customFullscreenDimensions", false, I18n.format("comment.fullscreenwindowed.customFullscreenDimensions"));
    _customFullscreenDimensionsX = _configuration.get(ConfigurationHandler.CATEGORY_ADVANCED, "customFullscreenDimensionsX", 0, I18n.format("comment.fullscreenwindowed.customFullscreenDimensionsX"));
    _customFullscreenDimensionsY = _configuration.get(ConfigurationHandler.CATEGORY_ADVANCED, "customFullscreenDimensionsY", 0, I18n.format("comment.fullscreenwindowed.customFullscreenDimensionsY"));
    _customFullscreenDimensionsW = _configuration.get(ConfigurationHandler.CATEGORY_ADVANCED, "customFullscreenDimensionsW", 0, I18n.format("comment.fullscreenwindowed.customFullscreenDimensionsW"));
    _customFullscreenDimensionsH = _configuration.get(ConfigurationHandler.CATEGORY_ADVANCED, "customFullscreenDimensionsH", 0, I18n.format("comment.fullscreenwindowed.customFullscreenDimensionsH"));

    //TODO: due to how LWJGL draws windows, it's not a good idea to have this... disabled until I can fix the bugs with X,Y being off due to decoration shadows.
    //_onlyRemoveDecorations = _configuration.get(ConfigurationHandler.CATEGORY_ADVANCED, "onlyRemoveDecorations", Reference.ONLY_REMOVE_DECORATIONS, I18n.format("comment.fullscreenwindowed.onlyRemoveDecorations"));

    if (_configuration.hasChanged()) {
        _configuration.save();
    }


}
 
Example #11
Source File: CycleButtonWidget.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void drawInForeground(int mouseX, int mouseY) {
    boolean isHovered = isMouseOverElement(mouseX, mouseY);
    boolean wasHovered = isMouseHovered;
    if (isHovered && !wasHovered) {
        this.isMouseHovered = true;
        this.hoverStartTime = System.currentTimeMillis();
    } else if (!isHovered && wasHovered) {
        this.isMouseHovered = false;
        this.hoverStartTime = 0L;
    } else if (isHovered) {
        long timeSinceHover = System.currentTimeMillis() - hoverStartTime;
        if (timeSinceHover > 1000L && tooltipHoverString != null) {
            List<String> hoverList = Arrays.asList(I18n.format(tooltipHoverString).split("/n"));
            drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY);
        }
    }
}
 
Example #12
Source File: GuiMemoryChest.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected void createButtons()
{
    this.buttonList.clear();

    int x = (this.width - this.xSize) / 2;
    int y = (this.height - this.ySize) / 2;

    String strPublic = I18n.format("enderutilities.gui.label.public") + " (" +
            I18n.format("enderutilities.tooltip.item.owner") + ": " + this.temc.getOwnerName() + ")";
    String strPrivate = I18n.format("enderutilities.gui.label.private") + " (" +
            I18n.format("enderutilities.tooltip.item.owner") + ": " + this.temc.getOwnerName() + ")";

    this.buttonList.add(new GuiButtonStateCallback(BTN_ID_TOGGLE_LOCK, x + 138, y + 15, 8, 8, 8, 0, this.guiTextureWidgets, this,
            ButtonState.create(0, 0, strPublic),
            ButtonState.create(0, 48, strPrivate)));
}
 
Example #13
Source File: BlockSieve.java    From ExNihiloAdscensio with MIT License 6 votes vote down vote up
@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world,
		IBlockState blockState, IProbeHitData data) {
	
	TileSieve sieve = (TileSieve) world.getTileEntity(data.getPos());
	if (sieve == null)
		return;
	
	if (sieve.getMeshStack() == null) {
		probeInfo.text("Mesh: None");
		return;
	}
	probeInfo.text("Mesh: " + I18n.format(sieve.getMeshStack().getUnlocalizedName() + ".name"));
	
	if (mode == ProbeMode.EXTENDED) {
		Map<Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(sieve.getMeshStack());
		for (Enchantment enchantment : enchantments.keySet()) {
			probeInfo.text(TextFormatting.BLUE + enchantment.getTranslatedName(enchantments.get(enchantment)));
		}
	}
	
}
 
Example #14
Source File: GuiAmadron.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initGui(){
    super.initGui();
    String amadron = I18n.format("gui.amadron");
    addLabel(amadron, guiLeft + xSize / 2 - mc.fontRenderer.getStringWidth(amadron) / 2, guiTop + 5);
    addLabel(I18n.format("gui.search"), guiLeft + 76 - mc.fontRenderer.getStringWidth(I18n.format("gui.search")), guiTop + 41);

    addInfoTab(I18n.format("gui.tooltip.item.amadronTablet"));
    addAnimatedStat("gui.tab.info.ghostSlotInteraction.title", new ItemStack(Blocks.hopper), 0xFF00AAFF, true).setText("gui.tab.info.ghostSlotInteraction");
    addAnimatedStat("gui.tab.amadron.disclaimer.title", new ItemStack(Items.writable_book), 0xFF0000FF, true).setText("gui.tab.amadron.disclaimer");

    searchBar = new WidgetTextField(mc.fontRenderer, guiLeft + 79, guiTop + 40, 73, mc.fontRenderer.FONT_HEIGHT);
    addWidget(searchBar);

    scrollbar = new WidgetVerticalScrollbar(-1, guiLeft + 156, guiTop + 54, 142);
    scrollbar.setStates(1);
    scrollbar.setListening(true);
    addWidget(scrollbar);

    List<String> tooltip = PneumaticCraftUtils.convertStringIntoList(I18n.format("gui.amadron.button.order.tooltip"), 40);
    addWidget(new GuiButtonSpecial(1, guiLeft + 6, guiTop + 15, 72, 20, I18n.format("gui.amadron.button.order")).setTooltipText(tooltip));
    addTradeButton = new GuiButtonSpecial(2, guiLeft + 80, guiTop + 15, 72, 20, I18n.format("gui.amadron.button.addTrade"));
    addWidget(addTradeButton);

    updateVisibleOffers();
}
 
Example #15
Source File: GuiPressureModuleSimple.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initGui(){
    super.initGui();

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

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

    thresholdField = new WidgetTextFieldNumber(fontRendererObj, guiLeft + 110, guiTop + 33, 30, fontRendererObj.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 #16
Source File: ItemGPSTool.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List infoList, boolean par4){
    super.addInformation(stack, player, infoList, par4);
    NBTTagCompound compound = stack.stackTagCompound;
    if(compound != null) {
        int x = compound.getInteger("x");
        int y = compound.getInteger("y");
        int z = compound.getInteger("z");
        if(x != 0 || y != 0 || z != 0) {
            infoList.add("\u00a72Set to " + x + ", " + y + ", " + z);
        }
        String varName = getVariable(stack);
        if(!varName.equals("")) {
            infoList.add(I18n.format("gui.tooltip.gpsTool.variable", varName));
        }
    }
}
 
Example #17
Source File: GuiSaltFurnace.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
    {
    	 this.drawDefaultBackground();
        super.drawScreen(mouseX, mouseY, partialTicks);

        if (this.isPointInRegion(114, 29, 6, 35, mouseX, mouseY))
        {
//TODO        	FluidTank tank = this.tileFurnace.getNigariTank();
//        	StringBuilder amount = new StringBuilder(TextFormatting.GRAY + "");
//        	amount.append(tank.getFluidAmount());
//        	amount.append("mb/");
//        	amount.append(tank.getCapacity());
//        	amount.append("mb");
            ArrayList<String> string = Lists.newArrayList(I18n.format("fluid.nigari"));
//TODO        	string.add(amount.toString());
            this.drawHoveringText(string, mouseX, mouseY, fontRenderer);
        }
    }
 
Example #18
Source File: GuiCustomizeWorld.java    From YUNoMakeGoodMap with Apache License 2.0 5 votes vote down vote up
@Override
public void initGui()
{
    this.list = new ScrollList();
    collectPlatforms();
    this.buttonList.clear();
    this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.format("gui.done")));
    this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.format("gui.cancel")));
}
 
Example #19
Source File: OreByProduct.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void addOreTooltip(List<String> tooltip, int byproduct, String machine, boolean result) {
	Material byProductMaterial = GTUtility.selectItemInList(byproduct, material, material.oreByProducts,
			DustMaterial.class);
	if (!result)
		tooltip.add(I18n.format("gregtech.jei.ore_by_product_from_ore", machine, byProductMaterial.getLocalizedName()));
	else {
		String oreType = byproduct == 0 ? oreIngredients.get(0).getDisplayName()
				: oreProcessingSteps.get(byproduct - 1).getDisplayName();
		tooltip.add(I18n.format("gregtech.jei.ore_by_product_from_machine", oreType, machine));
	}
}
 
Example #20
Source File: ItemMobHarness.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void addTooltipLines(ItemStack stack, EntityPlayer player, List<String> list, boolean verbose)
{
    if (stack.getTagCompound() == null || this.hasTarget(stack) == false)
    {
        list.add(I18n.format("enderutilities.tooltip.item.notlinked"));
        return;
    }

    String target = stack.getTagCompound().getString("TargetName");
    list.add(I18n.format("enderutilities.tooltip.item.linked") + ": " + TextFormatting.GREEN + target + TextFormatting.RESET + TextFormatting.GRAY);
}
 
Example #21
Source File: PluginBase.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
public String getWorldNameTranslated(boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) {
    String worldNameTranslated = "";
    if (genOverworld) {
        if (!worldNameTranslated.isEmpty())
            worldNameTranslated += ", ";
        worldNameTranslated += I18n.format("gtnop.world.overworld.name");
    }
    if (genNether) {
        if (!worldNameTranslated.isEmpty())
            worldNameTranslated += ", ";
        worldNameTranslated += I18n.format("gtnop.world.nether.name");
    }
    if (genEnd) {
        if (!worldNameTranslated.isEmpty())
            worldNameTranslated += ", ";
        worldNameTranslated += I18n.format("gtnop.world.end.name");
    }
    if (genMoon) {
        if (!worldNameTranslated.isEmpty())
            worldNameTranslated += ", ";
        worldNameTranslated += I18n.format("gtnop.world.moon.name");
    }
    if (genMars) {
        if (!worldNameTranslated.isEmpty())
            worldNameTranslated += ", ";
        worldNameTranslated += I18n.format("gtnop.world.mars.name");
    }
    return worldNameTranslated;
}
 
Example #22
Source File: RenderUtilsLiving.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) {
	glSetup(x, y, z);
	
    GL11.glScaled(0.4*scale, 0.4*scale, 0);
    
    GL11.glTranslated(offX, offY, 0);
    if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F);
    mc.getItemRenderer().renderItem(new ItemStack(item.getItem()), ItemCameraTransforms.TransformType.GUI);
    if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F);
    GL11.glDisable(GL11.GL_LIGHTING);
    
    GL11.glScalef(-0.05F, -0.05F, 0);
    
    if (item.getCount() > 0) {
	    int w = mc.fontRenderer.getStringWidth("x" + item.getCount()) / 2;
	    mc.fontRenderer.drawStringWithShadow("x" + item.getCount(), 7 - w, 5, 0xffffff);
    }
    
    GL11.glScalef(0.85F, 0.85F, 0.85F);
    
    int c = 0;
    for (Entry<Enchantment, Integer> m: EnchantmentHelper.getEnchantments(item).entrySet()) {
    	int w1 = mc.fontRenderer.getStringWidth(I18n.format(m.getKey().getName()).substring(0, 2) + m.getValue()) / 2;
    	mc.fontRenderer.drawStringWithShadow(
    			I18n.format(m.getKey().getName()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1,
    			m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE
    			? 0xff5050 : 0xffb0e0);
    	c--;
    }
    
    glCleanup();
}
 
Example #23
Source File: GuiShieldSelection.java    From Levels with GNU General Public License v2.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) 
{
	this.drawDefaultBackground();
	super.drawScreen(mouseX, mouseY, partialTicks);
	
	EntityPlayer player = this.mc.player;
	ItemStack stack = player.inventory.getCurrentItem();
	NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
	
	if (player != null && stack != null &&  nbt != null && stack.getItem() instanceof ItemShield)
	{
		drawCenteredString(fontRendererObj, I18n.format("levels.misc.attributes"), width / 2, 20, 0xFFFFFF);
		drawCenteredString(fontRendererObj, I18n.format("levels.misc.attributes.tokens") + ": " + Experience.getAttributeTokens(nbt), width / 2 - 112, 40, 0xFFFFFF);
		drawCenteredString(fontRendererObj, I18n.format("levels.misc.attributes.current"), width / 2 + 112, 40, 0xFFFFFF);
		
		int k = -1;
		
		for (int i = 0; i < BowAttribute.BOW_ATTRIBUTES.size(); i++)
		{
			if (BowAttribute.BOW_ATTRIBUTES.get(i).hasAttribute(nbt))
			{
				k++;
				drawCenteredString(fontRendererObj, BowAttribute.BOW_ATTRIBUTES.get(i).getName(nbt), width / 2 + 112, 60 + (10 * k), BowAttribute.BOW_ATTRIBUTES.get(i).getHex());
			}
		}
		
		displayButtons(nbt);
		drawTooltips(nbt, mouseX, mouseY);
	}
}
 
Example #24
Source File: ShowArmor.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
private void drawPotionEffects(EntityLiving entity) {
    int i = 100;
    int j = 10;
    boolean flag = true;
    Collection collection = entity.getActivePotionEffects();
    if (!collection.isEmpty()) {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_LIGHTING);
        int k = 33;

        if (collection.size() > 5) {
            k = 132 / (collection.size() - 1);
        }

        for (Iterator iterator = entity.getActivePotionEffects().iterator(); iterator.hasNext(); j += k) {
            PotionEffect potioneffect = (PotionEffect) iterator.next();
            Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            Wrapper.INSTANCE.mc().getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/inventory.png"));
            this.drawTexturedModalRect(i, j, 0, 166, 140, 32);

            if (potion.hasStatusIcon()) {
                int l = potion.getStatusIconIndex();
                this.drawTexturedModalRect(i + 6, j + 7, l % 8 * 18, 198 + l / 8 * 18, 18, 18);
            }

            potion.renderInventoryEffect(i, j, potioneffect, Wrapper.INSTANCE.mc());
            String s1 = I18n.format(potion.getName());

            s1 += " " + potioneffect.getAmplifier();

            Wrapper.INSTANCE.fontRenderer().drawStringWithShadow(s1, i + 10 + 18, j + 6, 16777215);
            String s = Potion.getDurationString(potioneffect);
            Wrapper.INSTANCE.fontRenderer().drawStringWithShadow(s, i + 10 + 18, j + 6 + 10, 8355711);
        }
    }
}
 
Example #25
Source File: GuiHandyBag.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
    int xOff = this.offsetXTier;
    this.fontRenderer.drawString(I18n.format("container.crafting"), xOff + 97, 5, 0x404040);
    this.fontRenderer.drawString(I18n.format("enderutilities.gui.label.memorycards"), xOff + 99, 59, 0x404040);
    this.fontRenderer.drawString(I18n.format("enderutilities.container.handybag"), xOff + 8, 5, 0x404040);
}
 
Example #26
Source File: VillageLordGuiContainer.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
private static String translate(String in) {
	if (in == null || in.trim().length() < 1) {
		return "";
	}
	String[] parts = in.split("\\|");
	if (parts.length == 1) {
		return I18n.format(parts[0]);
	}
	Object[] parameters = Arrays.copyOfRange(parts, 1, parts.length);

	processComplexParamters(parameters);

	return I18n.format(parts[0], parameters);
}
 
Example #27
Source File: GTBlockBaseMachine.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
	if (tooltipSize == 0) {
		return;
	}
	for (int i = 0; i < this.tooltipSize; i++) {
		tooltip.add(I18n.format(this.getUnlocalizedName().replace("tile", "tooltip") + i));
	}
}
 
Example #28
Source File: PluginGT5AsteroidStat.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
@Override
public void drawExtras(int recipe) {
    CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe);
    OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
    GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedAsteroidName(oreLayer.veinName), 2, 18, 0x404040, false);
    GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2, 31, 0x404040, false);
    GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2, 44, 0x404040, false);
    GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false);
    GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false);
    GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false);        
    GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false);
}
 
Example #29
Source File: GuiPastebin.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private void readFromString(String string){
    try {
        outputTag = new JsonToNBTConverter(string).convert();
    } catch(Exception e) {
        e.printStackTrace();
        errorMessage = I18n.format("gui.pastebin.invalidFormattedPastebin");
    }
}
 
Example #30
Source File: GuiShieldSelection.java    From Levels with GNU General Public License v2.0 5 votes vote down vote up
private void drawTooltips(NBTTagCompound nbt, int mouseX, int mouseY)
{	
	for (int i = 0; i < attributes.length; i++)
	{
		HoverChecker checker = new HoverChecker(attributes[i], 0);

		if (checker.checkHover(mouseX, mouseY))
		{
			int cost = 1;
			
			if (ShieldAttribute.SHIELD_ATTRIBUTES.get(i).getRarity() == Rarity.UNCOMMON && !ShieldAttribute.SHIELD_ATTRIBUTES.get(i).hasAttribute(nbt)) cost = 1;
			else if (ShieldAttribute.SHIELD_ATTRIBUTES.get(i).getRarity() == Rarity.RARE && !ShieldAttribute.SHIELD_ATTRIBUTES.get(i).hasAttribute(nbt)) cost = 2;
			else if (ShieldAttribute.SHIELD_ATTRIBUTES.get(i).getRarity() == Rarity.LEGENDARY && !ShieldAttribute.SHIELD_ATTRIBUTES.get(i).hasAttribute(nbt)) cost = 3;
			else if (ShieldAttribute.SHIELD_ATTRIBUTES.get(i).getAttributeTier(nbt) == 3) cost = 0;
			
			List<String> list = new ArrayList<String>();
			list.add(ShieldAttribute.SHIELD_ATTRIBUTES.get(i).getColor() + ShieldAttribute.SHIELD_ATTRIBUTES.get(i).getName(nbt));
			list.add(TextFormatting.GRAY + "Cost: " + cost + " token(s)");
			list.add("");
			list.add(I18n.format("levels.attributes.shields.info." + ShieldAttribute.SHIELD_ATTRIBUTES.get(i).ordinal()));
			list.add("");
			list.add("Tiers:");
			list.add(" I - " + ShieldAttribute.SHIELD_ATTRIBUTES.get(i).getColor() + I18n.format("levels.attributes.shields.info." + ShieldAttribute.SHIELD_ATTRIBUTES.get(i).ordinal() + ".tier1"));
			list.add(" II - " + ShieldAttribute.SHIELD_ATTRIBUTES.get(i).getColor() + I18n.format("levels.attributes.shields.info." + ShieldAttribute.SHIELD_ATTRIBUTES.get(i).ordinal() + ".tier2"));
			list.add(" III - " + ShieldAttribute.SHIELD_ATTRIBUTES.get(i).getColor() + I18n.format("levels.attributes.shields.info." + ShieldAttribute.SHIELD_ATTRIBUTES.get(i).ordinal() + ".tier3"));
			drawHoveringText(list, mouseX + 3, mouseY + 3);
		}
	}
}