@SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack is, EntityPlayer ep, List li, boolean verbose) { int i = is.getItemDamage(); if (i < MaterialRegistry.matList.length) { if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { MaterialRegistry mat = MaterialRegistry.matList[i]; double torque = mat.getMaxShaftTorque(); double speed = mat.getMaxShaftSpeed(); li.add( String.format( "Max Speed: %.3f %srad/s", ReikaMathLibrary.getThousandBase(speed), ReikaEngLibrary.getSIPrefix(speed))); li.add( String.format( "Max Torque: %.3f %sNm", ReikaMathLibrary.getThousandBase(torque), ReikaEngLibrary.getSIPrefix(torque))); } else { StringBuilder sb = new StringBuilder(); sb.append("Hold "); sb.append(EnumChatFormatting.GREEN.toString()); sb.append("Shift"); sb.append(EnumChatFormatting.GRAY.toString()); sb.append(" for load data"); li.add(sb.toString()); } } }
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); } }