Removed ChatColor and replaced with ChatFormatting

This commit is contained in:
modmuss50 2015-10-25 18:55:49 +00:00
parent edddb552c8
commit dabe79a877
3 changed files with 13 additions and 78 deletions

View file

@ -1,5 +1,6 @@
package techreborn.client;
import com.mojang.realmsclient.gui.ChatFormatting;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
@ -9,8 +10,6 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import org.lwjgl.input.Keyboard;
import techreborn.api.IListInfoProvider;
import techreborn.api.power.IEnergyInterfaceItem;
import techreborn.cofhLib.util.helpers.MathHelper;
import techreborn.lib.ChatColor;
import techreborn.util.Color;
public class StackToolTipEvent {
@ -21,19 +20,19 @@ public class StackToolTipEvent {
((IListInfoProvider) event.itemStack.getItem()).addInfo(event.toolTip, false);
} else if (event.itemStack.getItem() instanceof IEnergyInterfaceItem){
int percentage = percentage((int)((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxPower(event.itemStack), (int)((IEnergyInterfaceItem) event.itemStack.getItem()).getEnergy(event.itemStack));
ChatColor color;
ChatFormatting color;
if(percentage<= 10){
color = ChatColor.RED;
color = ChatFormatting.RED;
} else if(percentage >= 75){
color = ChatColor.GREEN;
color = ChatFormatting.GREEN;
} else {
color = ChatColor.YELLOW;
color = ChatFormatting.YELLOW;
}
event.toolTip.add(color + "" + (int)((IEnergyInterfaceItem) event.itemStack.getItem()).getEnergy(event.itemStack) + ChatColor.LIGHT_PURPLE + " stored eu");
event.toolTip.add(Color.GREEN + "" + (int)((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxPower(event.itemStack) + ChatColor.LIGHT_PURPLE + " max eu");
event.toolTip.add(color + "" + (int)((IEnergyInterfaceItem) event.itemStack.getItem()).getEnergy(event.itemStack) + ChatFormatting.LIGHT_PURPLE + " stored eu");
event.toolTip.add(Color.GREEN + "" + (int)((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxPower(event.itemStack) + ChatFormatting.LIGHT_PURPLE + " max eu");
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)){
event.toolTip.add(ChatColor.GREEN +"" + percentage + "%" + ChatColor.LIGHT_PURPLE +" charged");
event.toolTip.add(Color.GREEN + "" + (int)((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxTransfer(event.itemStack) + ChatColor.LIGHT_PURPLE + " eu/tick in/out");
event.toolTip.add(ChatFormatting.GREEN +"" + percentage + "%" + ChatFormatting.LIGHT_PURPLE +" charged");
event.toolTip.add(Color.GREEN + "" + (int)((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxTransfer(event.itemStack) + ChatFormatting.LIGHT_PURPLE + " eu/tick in/out");
}
} else {
Block block = Block.getBlockFromItem(event.itemStack.getItem());

View file

@ -1,64 +0,0 @@
package techreborn.lib;
public enum ChatColor {
BLACK('0'),
DARK_BLUE('1'),
DARK_GREEN('2'),
DARK_AQUA('3'),
DARK_RED('4'),
DARK_PURPLE('5'),
GOLD('6'),
GRAY('7'),
DARK_GRAY('8'),
BLUE('9'),
GREEN('a'),
AQUA('b'),
RED('c'),
LIGHT_PURPLE('d'),
YELLOW('e'),
WHITE('f'),
MAGIC('k'),
BOLD('l'),
STRIKETHROUGH('m'),
UNDERLINE('n'),
ITALIC('o'),
RESET('r');
public static final char COLOR_CHAR = '\u00A7';
private final String toString;
ChatColor(char code) {
this.toString = new String(new char[] {COLOR_CHAR, code});
}
@Override
public String toString() {
return toString;
}
}

View file

@ -2,6 +2,7 @@ package techreborn.powerSystem;
import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyReceiver;
import com.mojang.realmsclient.gui.ChatFormatting;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional;
import ic2.api.energy.event.EnergyTileLoadEvent;
@ -19,7 +20,6 @@ import techreborn.api.IListInfoProvider;
import techreborn.api.power.IEnergyInterfaceTile;
import techreborn.asm.Strippable;
import techreborn.config.ConfigTechReborn;
import techreborn.lib.ChatColor;
import java.util.List;
@ -290,9 +290,9 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
@Override
public void addInfo(List<String> info, boolean isRealTile) {
info.add(ChatColor.LIGHT_PURPLE + "Energy buffer Size " + ChatColor.GREEN + getEUString(getMaxPower()));
info.add(ChatColor.LIGHT_PURPLE +"Max Input " + ChatColor.GREEN + getEUString(getMaxInput()));
info.add(ChatColor.LIGHT_PURPLE +"Max Output " + ChatColor.GREEN + getEUString(getMaxOutput()));
info.add(ChatFormatting.LIGHT_PURPLE + "Energy buffer Size " + ChatFormatting.GREEN + getEUString(getMaxPower()));
info.add(ChatFormatting.LIGHT_PURPLE +"Max Input " + ChatFormatting.GREEN + getEUString(getMaxInput()));
info.add(ChatFormatting.LIGHT_PURPLE +"Max Output " + ChatFormatting.GREEN + getEUString(getMaxOutput()));
}
private String getEUString(double euValue) {