public void renderIcon(float p_178663_1_, int alpha) { int i = -1; String s = FontRenderer.getFormatFromString(this.team.getColorPrefix()); if (s.length() >= 2) { i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1)); } if (i >= 0) { float f = (float) (i >> 16 & 255) / 255.0F; float f1 = (float) (i >> 8 & 255) / 255.0F; float f2 = (float) (i & 255) / 255.0F; Gui.drawRect( 1, 1, 15, 15, MathHelper.rgb(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24); } Minecraft.getMinecraft().getTextureManager().bindTexture(this.location); GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float) alpha / 255.0F); Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); }
public void drawScrollBar(GuiEnchantmentModifier gui) { if (!hasScrollBar()) return; int sbary = rely + (int) ((height - getScrollBarHeight()) * percentscrolled + 0.5); int sbarx = relx + cwidth; Gui.drawRect(sbarx, rely, sbarx + getScrollBarWidth(), rely + height, 0xFF202020); // background Gui.drawRect( sbarx, sbary, sbarx + getScrollBarWidth(), sbary + getScrollBarHeight(), 0xFF8B8B8B); // corners Gui.drawRect( sbarx, sbary, sbarx + getScrollBarWidth() - 1, sbary + getScrollBarHeight() - 1, 0xFFF0F0F0); // topleft up Gui.drawRect( sbarx + 1, sbary + 1, sbarx + getScrollBarWidth() - 1, sbary + getScrollBarHeight() - 1, 0xFF555555); // bottom right down Gui.drawRect( sbarx + 1, sbary + 1, sbarx + getScrollBarWidth() - 2, sbary + getScrollBarHeight() - 2, 0xFFC6C6C6); // scrollbar }
@SubscribeEvent public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) { if (event.type == ElementType.HOTBAR && ClientHelper.minecraft().currentScreen == null) { boolean up = !Config.dialBottom; int xpos = 4; int ypos = up ? 50 : event.resolution.getScaledHeight() - 70; ItemStack item = ClientHelper.clientPlayer().getCurrentEquippedItem(); if (item != null && item.getItem() instanceof ItemWandCasting) { ItemWandCasting wand = (ItemWandCasting) item.getItem(); wand.getFocusItem(item); ItemFocusBasic focus = wand.getFocus(item); if (focus != null && focus instanceof ItemFocusDislocation) { ItemStack pickedBlock = ((ItemFocusDislocation) focus).getPickedBlock(item); if (pickedBlock != null) { Gui.drawRect(xpos - 1, ypos - 1, xpos + 18, ypos + 18, 0x66000000); FontRenderer font = ClientHelper.fontRenderer(); boolean unicode = font.getUnicodeFlag(); font.setUnicodeFlag(true); String name = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltip"); int strLength = font.getStringWidth(name); Gui.drawRect(xpos + 18, ypos, xpos + 18 + strLength + 4, ypos + 9, 0x66000000); font.drawStringWithShadow(name, xpos + 20, ypos, 0xFFAA00); NBTTagCompound cmp = ((ItemFocusDislocation) focus).getStackTileEntity(item); if (cmp != null && !cmp.hasNoTags()) { String content = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltipExtra"); font.getStringWidth(content); Gui.drawRect(xpos + 18, ypos + 9, xpos + 18 + strLength + 4, ypos + 18, 0x66000000); font.drawStringWithShadow(content, xpos + 20, ypos + 9, 0xFFAA00); } if (new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a).getItem() != null) renderItem.renderItemIntoGUI( font, ClientHelper.minecraft().renderEngine, new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a), xpos, ypos); else { if (((ItemBlock) pickedBlock.getItem()).field_150939_a == Blocks.reeds) renderItem.renderItemIntoGUI( font, ClientHelper.minecraft().renderEngine, new ItemStack(Items.reeds), xpos, ypos); } font.setUnicodeFlag(unicode); } } } } }
@SubscribeEvent public void onRenderGUI(RenderGameOverlayEvent.Pre event) { // we're only interested in the inventory if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) { return; } EntityPlayer player = Minecraft.getMinecraft().thePlayer; ItemStack stack = player.getCurrentEquippedItem(); if (stack == null) { return; } // do we hold a tool that supports secondary item usage? if (stack.getItem() instanceof ToolCore && ((ToolCore) stack.getItem()).canUseSecondaryItem()) { int slot = ToolHelper.getSecondaryItemSlot(player); if (slot != player.inventory.currentItem) { // render the special border around the secondary item that would be used int x = event.resolution.getScaledWidth() / 2 - 90 + slot * 20 + 2; int y = event.resolution.getScaledHeight() - 16 - 3; // render a cool underlay thing GlStateManager.color(1, 1, 1, 0.5f); Minecraft.getMinecraft().getTextureManager().bindTexture(widgetsTexPath); Gui.drawScaledCustomSizeModalRect(x, y, 1, 23, 22, 22, 16, 16, 256, 256); } } }
@Override public void overlayBackground() { this.client.renderEngine.bindTexture(Gui.optionsBackground); GL11.glColor4f(0.25F, 0.25F, 0.25F, 1.0F); Gui.drawModalRectWithCustomSizedTexture( left - 10, top - slotHeight, 0, 0, listWidth + 20, slotHeight, 32, 32); Gui.drawModalRectWithCustomSizedTexture( left - 10, top + listHeight, 0, listHeight + slotHeight, listWidth + 20, slotHeight, 32, 32); }
/** Draws the textbox */ public void drawTextBox() { if (this.getVisible()) { int var1 = this.isEnabled ? this.enabledColor : this.disabledColor; int var2 = this.cursorPosition - this.field_73816_n; int var3 = this.selectionEnd - this.field_73816_n; String var4 = this.fontRenderer.trimStringToWidth( this.text.substring(this.field_73816_n), this.getWidth()); boolean var5 = var2 >= 0 && var2 <= var4.length(); boolean var6 = this.isFocused && this.cursorCounter / 6 % 2 == 0 && var5; int var7 = this.enableBackgroundDrawing ? this.xPos + 4 : this.xPos; int var8 = this.enableBackgroundDrawing ? this.yPos + (this.height - 8) / 2 : this.yPos; int var9 = var7; if (var3 > var4.length()) { var3 = var4.length(); } if (var4.length() > 0) { String var10 = var5 ? var4.substring(0, var2) : var4; var9 = this.fontRenderer.drawStringWithShadow(var10, var7, var8, var1); } boolean var13 = this.cursorPosition < this.text.length() || this.text.length() >= this.getMaxStringLength(); int var11 = var9; if (!var5) { var11 = var2 > 0 ? var7 + this.width : var7; } else if (var13) { var11 = var9 - 1; --var9; } if (var4.length() > 0 && var5 && var2 < var4.length()) { this.fontRenderer.drawStringWithShadow(var4.substring(var2), var9, var8, var1); } if (var6) { if (var13) { Gui.drawRect( var11, var8 - 1, var11 + 1, var8 + 1 + this.fontRenderer.FONT_HEIGHT, -3092272); } else { this.fontRenderer.drawStringWithShadow("_", var11, var8, var1); } } if (var3 != var2) { int var12 = var7 + this.fontRenderer.getStringWidth(var4.substring(0, var3)); this.drawCursorVertical( var11, var8 - 1, var12 - 1, var8 + 1 + this.fontRenderer.FONT_HEIGHT); } } }
@Override public void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { super.drawGradientRect(par1, par2, par3, par4, par5, par6); }
public void drawEntry( int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) { this.func_148313_c(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, 32, 32, 32.0F, 32.0F); int var10; if ((this.field_148317_a.gameSettings.touchscreen || isSelected) && this.func_148310_d()) { this.field_148317_a.getTextureManager().bindTexture(field_148316_c); Gui.drawRect(x, y, x + 32, y + 32, -1601138544); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); int var9 = mouseX - x; var10 = mouseY - y; if (this.func_148309_e()) { if (var9 < 32) { Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 32.0F, 32, 32, 256.0F, 256.0F); } else { Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, 32, 32, 256.0F, 256.0F); } } else { if (this.func_148308_f()) { if (var9 < 16) { Gui.drawModalRectWithCustomSizedTexture(x, y, 32.0F, 32.0F, 32, 32, 256.0F, 256.0F); } else { Gui.drawModalRectWithCustomSizedTexture(x, y, 32.0F, 0.0F, 32, 32, 256.0F, 256.0F); } } if (this.func_148314_g()) { if (var9 < 32 && var9 > 16 && var10 < 16) { Gui.drawModalRectWithCustomSizedTexture(x, y, 96.0F, 32.0F, 32, 32, 256.0F, 256.0F); } else { Gui.drawModalRectWithCustomSizedTexture(x, y, 96.0F, 0.0F, 32, 32, 256.0F, 256.0F); } } if (this.func_148307_h()) { if (var9 < 32 && var9 > 16 && var10 > 16) { Gui.drawModalRectWithCustomSizedTexture(x, y, 64.0F, 32.0F, 32, 32, 256.0F, 256.0F); } else { Gui.drawModalRectWithCustomSizedTexture(x, y, 64.0F, 0.0F, 32, 32, 256.0F, 256.0F); } } } } String var13 = this.func_148312_b(); var10 = this.field_148317_a.fontRendererObj.getStringWidth(var13); if (var10 > 157) { var13 = this.field_148317_a.fontRendererObj.trimStringToWidth( var13, 157 - this.field_148317_a.fontRendererObj.getStringWidth("...")) + "..."; } this.field_148317_a.fontRendererObj.func_175063_a( var13, (float) (x + 32 + 2), (float) (y + 1), 16777215); List var11 = this.field_148317_a.fontRendererObj.listFormattedStringToWidth(this.func_148311_a(), 157); for (int var12 = 0; var12 < 2 && var12 < var11.size(); ++var12) { this.field_148317_a.fontRendererObj.func_175063_a( (String) var11.get(var12), (float) (x + 32 + 2), (float) (y + 12 + 10 * var12), 8421504); } }
public void renderIcon(float p_178663_1_, int alpha) { Minecraft.getMinecraft().getTextureManager().bindTexture(GuiSpectator.SPECTATOR_WIDGETS); Gui.drawModalRectWithCustomSizedTexture(0, 0, 16.0F, 0.0F, 16, 16, 256.0F, 256.0F); }
/** Draws the textbox */ public void drawTextBox() { if (this.func_146176_q()) { if (this.func_146181_i()) { drawRect( this.field_146209_f - 1, this.field_146210_g - 1, this.field_146209_f + this.field_146218_h + 1, this.field_146210_g + this.field_146219_i + 1, -6250336); drawRect( this.field_146209_f, this.field_146210_g, this.field_146209_f + this.field_146218_h, this.field_146210_g + this.field_146219_i, -16777216); } int var1 = this.field_146226_p ? this.field_146222_t : this.field_146221_u; int var2 = this.field_146224_r - this.field_146225_q; int var3 = this.field_146223_s - this.field_146225_q; String var4 = this.field_146211_a.trimStringToWidth( this.field_146216_j.substring(this.field_146225_q), this.func_146200_o()); boolean var5 = var2 >= 0 && var2 <= var4.length(); boolean var6 = this.field_146213_o && this.field_146214_l / 6 % 2 == 0 && var5; int var7 = this.field_146215_m ? this.field_146209_f + 4 : this.field_146209_f; int var8 = this.field_146215_m ? this.field_146210_g + (this.field_146219_i - 8) / 2 : this.field_146210_g; int var9 = var7; if (var3 > var4.length()) { var3 = var4.length(); } if (var4.length() > 0) { String var10 = var5 ? var4.substring(0, var2) : var4; var9 = this.field_146211_a.drawStringWithShadow(var10, var7, var8 - 2, var1); text = var10; } boolean var13 = this.field_146224_r < this.field_146216_j.length() || this.field_146216_j.length() >= this.func_146208_g(); int var11 = var9; if (!var5) { var11 = var2 > 0 ? var7 + this.field_146218_h : var7; } else if (var13) { var11 = var9 - 1; --var9; } if (var4.length() > 0 && var5 && var2 < var4.length()) { this.field_146211_a.drawStringWithShadow(var4.substring(var2), var9, var8 - 2, var1); } if (var6) { if (var13) { Gui.drawRect( var11, var8 - 1, var11 + 1, (int) (var8 + 1 + this.field_146211_a.getHeight(text)), -3092272); } else { // this.field_146211_a.drawStringWithShadow("_", var11, var8, var1); } } if (var3 != var2) { int var12 = (int) (var7 + this.field_146211_a.getWidth(var4.substring(0, var3))); this.func_146188_c( var11, var8 - 1, var12 - 1, (int) (var8 + 1 + this.field_146211_a.getHeight(text))); } } }
@Override protected void drawSlot( int slotIndex, int minX, int maxX, int minY, int maxY, Tessellator tesselator) { Update update = updateList.get(slotIndex); if (update != null && !update.oldVersion.matches(update.newVersion)) { this.parent .getFontRenderer() .drawString( this.parent.getFontRenderer().trimStringToWidth(update.displayName, listWidth - 10), minX + 5, minY + 4, 0xFFFFFF); if (this.parent.getFontRenderer().getStringWidth(update.newVersion) >= (listWidth - 125)) { this.parent .getFontRenderer() .drawString( this.parent .getFontRenderer() .trimStringToWidth(update.oldVersion + " -> ", listWidth - 10), minX + 5, minY + 15, 0xCCCCCC); this.parent .getFontRenderer() .drawString( this.parent .getFontRenderer() .trimStringToWidth(" " + update.newVersion, listWidth - 10), minX + 5, minY + 25, 0xCCCCCC); } else { this.parent .getFontRenderer() .drawString( this.parent .getFontRenderer() .trimStringToWidth( update.oldVersion + " -> " + update.newVersion, listWidth - 10), minX + 5, minY + 15, 0xCCCCCC); } String info; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().renderEngine.bindTexture(Resources.GUI_ICONS); if (DownloadThread.isUpdating(update)) { Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 0, 0, 16, 16, 64, 32); info = StatCollector.translateToLocal(Strings.UPDATING); } else if (update.isDownloaded()) { Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 16, 0, 16, 16, 64, 32); if (!update.MOD_ID.equalsIgnoreCase(Reference.MOD_ID)) { info = StatCollector.translateToLocal(Strings.IS_DOWNLOADED); } else { info = StatCollector.translateToLocal(Strings.UNABLE_TO_REMOVE_SELF); } } else if (update.isErrored()) { Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 32, 0, 16, 16, 64, 32); info = StatCollector.translateToLocal(Strings.ERRORED); } else if (update.isDirectLink) { Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 16, 16, 16, 16, 64, 32); info = StatCollector.translateToLocal(Strings.DL_AVAILABLE); } else if (update.updateURL != null) { Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 0, 16, 16, 16, 64, 32); info = StatCollector.translateToLocal(Strings.LINK_TO_DL); } else { info = StatCollector.translateToLocal(Strings.CANNOT_UPDATE); } if (update.updateType == Update.UpdateType.NOT_ENOUGH_MODS) { Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 32, 16, 16, 16, 64, 32); } else if (update.updateType == Update.UpdateType.CURSE) { Gui.drawModalRectWithCustomSizedTexture(maxX - 30, minY + 8, 48, 0, 16, 16, 64, 32); } this.parent .getFontRenderer() .drawString( this.parent.getFontRenderer().trimStringToWidth(info, listWidth - 10), minX + 5, minY + 35, 0xCCCCCC); } }