protected void drawSlot( int p_180791_1_, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) { StatBase var7 = (StatBase) StatList.generalStats.get(p_180791_1_); GuiStats.this.drawString( GuiStats.this.fontRenderer, var7.getStatName().getUnformattedText(), p_180791_2_ + 2, p_180791_3_ + 1, p_180791_1_ % 2 == 0 ? 16777215 : 9474192); String var8 = var7.func_75968_a(GuiStats.this.field_146546_t.writeStat(var7)); GuiStats.this.drawString( GuiStats.this.fontRenderer, var8, p_180791_2_ + 2 + 213 - GuiStats.this.fontRenderer.getStringWidth(var8), p_180791_3_ + 1, p_180791_1_ % 2 == 0 ? 16777215 : 9474192); }
/** Adds a value to a statistic field. */ public void addStat(StatBase p_71064_1_, int p_71064_2_) { if (p_71064_1_ != null) { if (p_71064_1_.isAchievement() && MinecraftForge.EVENT_BUS.post( new net.minecraftforge.event.entity.player.AchievementEvent( this, (net.minecraft.stats.Achievement) p_71064_1_))) return; this.field_147103_bO.func_150871_b(this, p_71064_1_, p_71064_2_); Iterator iterator = this.getWorldScoreboard().func_96520_a(p_71064_1_.func_150952_k()).iterator(); while (iterator.hasNext()) { ScoreObjective scoreobjective = (ScoreObjective) iterator.next(); this.getWorldScoreboard() .getValueFromObjective(this.getCommandSenderName(), scoreobjective) .func_96648_a(); } if (this.field_147103_bO.func_150879_e()) { this.field_147103_bO.func_150876_a(this); } } }
/** Adds a value to a statistic field. */ public void addStat(StatBase par1StatBase, int par2) { if (par1StatBase != null) { if (par1StatBase.isAchievement()) { Achievement achievement = (Achievement) par1StatBase; if (achievement.parentAchievement == null || this.mc.statFileWriter.hasAchievementUnlocked(achievement.parentAchievement)) { if (!this.mc.statFileWriter.hasAchievementUnlocked(achievement)) { this.mc.guiAchievement.queueTakenAchievement(achievement); } this.mc.statFileWriter.readStat(par1StatBase, par2); } } else { this.mc.statFileWriter.readStat(par1StatBase, par2); } } }
protected void func_148209_a( StatBase p_148209_1_, int p_148209_2_, int p_148209_3_, boolean p_148209_4_) { String var5; if (p_148209_1_ != null) { var5 = p_148209_1_.func_75968_a(GuiStats.this.field_146546_t.writeStat(p_148209_1_)); GuiStats.this.drawString( GuiStats.this.fontRenderer, var5, p_148209_2_ - GuiStats.this.fontRenderer.getStringWidth(var5), p_148209_3_ + 5, p_148209_4_ ? 16777215 : 9474192); } else { var5 = "-"; GuiStats.this.drawString( GuiStats.this.fontRenderer, var5, p_148209_2_ - GuiStats.this.fontRenderer.getStringWidth(var5), p_148209_3_ + 5, p_148209_4_ ? 16777215 : 9474192); } }
/** Draws the hover event specified by the given chat component */ protected void handleComponentHover( IChatComponent p_175272_1_, int p_175272_2_, int p_175272_3_) { if (p_175272_1_ != null && p_175272_1_.getChatStyle().getChatHoverEvent() != null) { HoverEvent hoverevent = p_175272_1_.getChatStyle().getChatHoverEvent(); if (hoverevent.getAction() == HoverEvent.Action.SHOW_ITEM) { ItemStack itemstack = null; try { NBTBase nbtbase = JsonToNBT.getTagFromJson(hoverevent.getValue().getUnformattedText()); if (nbtbase instanceof NBTTagCompound) { itemstack = ItemStack.loadItemStackFromNBT((NBTTagCompound) nbtbase); } } catch (NBTException var11) {; } if (itemstack != null) { this.renderToolTip(itemstack, p_175272_2_, p_175272_3_); } else { this.drawCreativeTabHoveringText( EnumChatFormatting.RED + "Invalid Item!", p_175272_2_, p_175272_3_); } } else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ENTITY) { if (this.mc.gameSettings.advancedItemTooltips) { try { NBTBase nbtbase1 = JsonToNBT.getTagFromJson(hoverevent.getValue().getUnformattedText()); if (nbtbase1 instanceof NBTTagCompound) { List<String> list1 = Lists.<String>newArrayList(); NBTTagCompound nbttagcompound = (NBTTagCompound) nbtbase1; list1.add(nbttagcompound.getString("name")); if (nbttagcompound.hasKey("type", 8)) { String s = nbttagcompound.getString("type"); list1.add("Type: " + s + " (" + EntityList.getIDFromString(s) + ")"); } list1.add(nbttagcompound.getString("id")); this.drawHoveringText(list1, p_175272_2_, p_175272_3_); } else { this.drawCreativeTabHoveringText( EnumChatFormatting.RED + "Invalid Entity!", p_175272_2_, p_175272_3_); } } catch (NBTException var10) { this.drawCreativeTabHoveringText( EnumChatFormatting.RED + "Invalid Entity!", p_175272_2_, p_175272_3_); } } } else if (hoverevent.getAction() == HoverEvent.Action.SHOW_TEXT) { this.drawHoveringText( NEWLINE_SPLITTER.splitToList(hoverevent.getValue().getFormattedText()), p_175272_2_, p_175272_3_); } else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ACHIEVEMENT) { StatBase statbase = StatList.getOneShotStat(hoverevent.getValue().getUnformattedText()); if (statbase != null) { IChatComponent ichatcomponent = statbase.getStatName(); IChatComponent ichatcomponent1 = new ChatComponentTranslation( "stats.tooltip.type." + (statbase.isAchievement() ? "achievement" : "statistic"), new Object[0]); ichatcomponent1.getChatStyle().setItalic(Boolean.valueOf(true)); String s1 = statbase instanceof Achievement ? ((Achievement) statbase).getDescription() : null; List<String> list = Lists.newArrayList( new String[] { ichatcomponent.getFormattedText(), ichatcomponent1.getFormattedText() }); if (s1 != null) { list.addAll(this.fontRendererObj.listFormattedStringToWidth(s1, 150)); } this.drawHoveringText(list, p_175272_2_, p_175272_3_); } else { this.drawCreativeTabHoveringText( EnumChatFormatting.RED + "Invalid statistic/achievement!", p_175272_2_, p_175272_3_); } } GlStateManager.disableLighting(); } }