This commit is contained in:
modmuss50 2015-06-14 12:35:41 +01:00
commit 81f75abf22
2 changed files with 54 additions and 2 deletions

View file

@ -1,5 +1,8 @@
package techreborn.client.hud;
import org.lwjgl.opengl.GL11;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import ic2.api.item.IElectricItemManager;
import ic2.core.item.ElectricItemManager;
@ -9,6 +12,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -40,8 +44,11 @@ public class ChargeHud
if((stack.getItem() instanceof IElectricItem))
{
double MaxCharge = ((IElectricItem) stack.getItem()).getMaxCharge(stack);
//TODO find a way to get current charge
double CurrentCharge = ((IElectricItem) stack.getItem()).getMaxCharge(stack);
double CurrentCharge = ElectricItem.manager.getCharge(stack);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(32826);
RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting();
mc.fontRenderer.drawString(Double.toString(CurrentCharge) + "/" + Double.toString(MaxCharge), 0, 0, 0);
}
}

View file

@ -0,0 +1,45 @@
package techreborn.util;
/**
* @author TeamC4
*/
public enum Color
{
BLACK("\u00A70"), //
DARK_BLUE("\u00A71"), //
DARK_GREEN("\u00A72"), //
DARK_AQUA("\u00A73"), //
DARK_RED("\u00A74"), //
DARK_PURPLE("\u00A75"), //
GOLD("\u00A76"), //
GRAY("\u00A77"), //
DARK_GRAY("\u00A78"), //
BLUE("\u00A79"), //
GREEN("\u00A7a"), //
AQUA("\u00A7b"), //
RED("\u00A7c"), //
LIGHT_PURPLE("\u00A7d"), //
YELLOW("\u00A7e"), //
WHITE("\u00A7f"), //
STRIKE_THROUGH("\u00A7m"), //
UNDERLINE("\u00A7n"), //
BOLD("\u00A7l"), //
RANDOM("\u00A7k"), //
ITALIC("\u00A7o"), //
RESET("\u00A7r"); //
public String code = "";
private Color(String code) {
this.code = code;
}
@Override
public String toString() {
return code;
}
}