Created
March 9, 2013 21:59
-
-
Save mDiyo/5125931 to your computer and use it in GitHub Desktop.
Colored tooltip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Tags and information about the tool */ | |
| @Override | |
| @SideOnly(Side.CLIENT) | |
| public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) | |
| { | |
| if (!stack.hasTagCompound()) | |
| return; | |
| NBTTagCompound tags = stack.getTagCompound(); | |
| if (tags.hasKey("charge")) | |
| { | |
| String color = ""; | |
| int power = tags.getInteger("charge"); | |
| if (power != 0) | |
| { | |
| if (power <= this.getMaxCharge() / 3) | |
| color = "\u00a74"; | |
| else if (power > this.getMaxCharge() * 2 / 3) | |
| color = "\u00a72"; | |
| else | |
| color = "\u00a76"; | |
| } | |
| String charge = new StringBuilder().append(color).append(tags.getInteger("charge")).append("/").append(getMaxCharge()).append(" En").toString(); | |
| list.add(charge); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment