/** Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks */ @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { super.drawScreen(mouseX, mouseY, partialTicks); boolean var4 = mc.thePlayer.capabilities.isCreativeMode; int var5 = field_147075_G.func_178147_e(); for (int var6 = 0; var6 < 3; ++var6) { int var7 = field_147075_G.enchantLevels[var6]; int var8 = field_147075_G.field_178151_h[var6]; int var9 = var6 + 1; if (func_146978_c(60, 14 + 19 * var6, 108, 17, mouseX, mouseY) && var7 > 0 && var8 >= 0) { ArrayList<Object> var10 = Lists.newArrayList(); String var11; if (var8 >= 0 && Enchantment.enchantmentsList[var8 & 255] != null) { var11 = Enchantment.enchantmentsList[var8 & 255].getTranslatedName((var8 & 65280) >> 8); var10.add( EnumChatFormatting.WHITE.toString() + EnumChatFormatting.ITALIC.toString() + I18n.format("container.enchant.clue", new Object[] {var11})); } if (!var4) { if (var8 >= 0) var10.add(""); if (mc.thePlayer.experienceLevel < var7) var10.add( EnumChatFormatting.RED.toString() + "Level Requirement: " + field_147075_G.enchantLevels[var6]); else { var11 = ""; if (var9 == 1) var11 = I18n.format("container.enchant.lapis.one", new Object[0]); else var11 = I18n.format("container.enchant.lapis.many", new Object[] {Integer.valueOf(var9)}); if (var5 >= var9) var10.add(EnumChatFormatting.GRAY.toString() + "" + var11); else var10.add(EnumChatFormatting.RED.toString() + "" + var11); if (var9 == 1) var11 = I18n.format("container.enchant.level.one", new Object[0]); else var11 = I18n.format("container.enchant.level.many", new Object[] {Integer.valueOf(var9)}); var10.add(EnumChatFormatting.GRAY.toString() + "" + var11); } } drawHoveringText(var10, mouseX, mouseY, fontRendererObj); break; } } }
public static String timeColor(final int time) { if (time <= 30) { return EnumChatFormatting.RED.toString(); } else if (time <= 60) { return EnumChatFormatting.GOLD.toString(); } else if (time <= 150) { return EnumChatFormatting.YELLOW.toString(); } else { return EnumChatFormatting.GREEN.toString(); } }
private static void formatStat(StringBuilder sb, int baseValue, int bonus) { if (baseValue == 0) { if (bonus == 0) { sb.append("0"); } } else { sb.append(baseValue); } if (bonus > 0) { sb.append(EnumChatFormatting.GREEN.toString()).append("+").append(bonus); } else if (bonus < 0) { sb.append(EnumChatFormatting.RED.toString()).append(bonus); } }
public static void addTooltipToSkinItem( ItemStack stack, EntityPlayer player, List tooltip, boolean showAdvancedItemTooltips) { String cRed = EnumChatFormatting.RED.toString(); boolean isEquipmentSkin = stack.getItem() == ModItems.equipmentSkin; boolean isEquipmentContainer = stack.getItem() instanceof AbstractModItemArmour; if (EquipmentNBTHelper.stackHasSkinData(stack)) { SkinPointer skinData = EquipmentNBTHelper.getSkinPointerFromStack(stack); if (!isEquipmentSkin & !skinData.lockSkin & !isEquipmentContainer) { return; } if (!isEquipmentSkin) { tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.hasSkin")); } if (ClientModelCache.INSTANCE.isEquipmentInCache(skinData.skinId)) { Skin data = ClientModelCache.INSTANCE.getEquipmentItemData(skinData.skinId); if (!data.getCustomName().trim().isEmpty()) { tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinName", data.getCustomName())); } if (!data.getAuthorName().trim().isEmpty()) { tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinAuthor", data.getAuthorName())); } if (ConfigHandler.showSkinTooltipDebugInfo) { if (GuiScreen.isShiftKeyDown()) { if (skinData.skinType != null) { String localSkinName = SkinTypeRegistry.INSTANCE.getLocalizedSkinTypeName(skinData.skinType); tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinType", localSkinName)); } tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinId", skinData.skinId)); tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinTotalCubes", data.getTotalCubes())); tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinNumCubes", data.getTotalOfCubeType(Cube.class))); tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinNumCubesGlowing", data.getTotalOfCubeType(CubeGlowing.class))); tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinNumCubesGlass", data.getTotalOfCubeType(CubeGlass.class))); tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinNumCubesGlassGlowing", data.getTotalOfCubeType(CubeGlassGlowing.class))); tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinPaintData", data.hasPaintData())); tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinMarkerCount", data.getMarkerCount())); } else { tooltip.add( TranslateUtils.translate("item.armourersworkshop:rollover.skinHoldShiftForInfo")); } } if (skinData.skinId != data.lightHash()) { tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinIdError1")); tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinIdError2")); tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skinIdError3", data.requestId, data.lightHash())); } } else { tooltip.add( TranslateUtils.translate( "item.armourersworkshop:rollover.skindownloading", skinData.skinId)); } String keyName = Keyboard.getKeyName(Keybindings.openCustomArmourGui.getKeyCode()); if (isEquipmentSkin) { tooltip.add( TranslateUtils.translate("item.armourersworkshop:rollover.skinOpenWardrobe", keyName)); } } else { if (EquipmentNBTHelper.stackHasLegacySkinData(stack)) { tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinOldType")); } else { if (isEquipmentSkin) { tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinInvalidItem")); } } } }