Added offhand stack power hub rendering
This commit is contained in:
parent
eca6144c66
commit
5773bf66d0
1 changed files with 26 additions and 2 deletions
|
@ -52,6 +52,7 @@ public class ChargeHud
|
||||||
{
|
{
|
||||||
EntityPlayer player = mc.thePlayer;
|
EntityPlayer player = mc.thePlayer;
|
||||||
ItemStack armorstack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
ItemStack armorstack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||||
|
ItemStack offHandstack = player.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||||
ItemStack stack = mc.thePlayer.inventory.getCurrentItem();
|
ItemStack stack = mc.thePlayer.inventory.getCurrentItem();
|
||||||
|
|
||||||
int y = 5;
|
int y = 5;
|
||||||
|
@ -86,6 +87,30 @@ public class ChargeHud
|
||||||
|
|
||||||
if (showHud)
|
if (showHud)
|
||||||
{
|
{
|
||||||
|
if (offHandstack != null && offHandstack.getItem() instanceof IEnergyInterfaceItem)
|
||||||
|
{
|
||||||
|
double MaxCharge = ((IEnergyInterfaceItem) offHandstack.getItem()).getMaxPower(offHandstack);
|
||||||
|
double CurrentCharge = ((IEnergyInterfaceItem) offHandstack.getItem()).getEnergy(offHandstack);
|
||||||
|
Color color = Color.GREEN;
|
||||||
|
double quarter = MaxCharge / 4;
|
||||||
|
double half = MaxCharge / 2;
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GL11.glEnable(32826);
|
||||||
|
RenderHelper.enableStandardItemLighting();
|
||||||
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
renderItemStack(offHandstack, 0, y - 5);
|
||||||
|
if (CurrentCharge <= half)
|
||||||
|
{
|
||||||
|
color = Color.YELLOW;
|
||||||
|
}
|
||||||
|
if (CurrentCharge <= quarter)
|
||||||
|
{
|
||||||
|
color = Color.DARK_RED;
|
||||||
|
}
|
||||||
|
mc.fontRendererObj.drawString(color + PowerSystem.getLocaliszedPower(CurrentCharge) + "/"
|
||||||
|
+ PowerSystem.getLocaliszedPower(MaxCharge), 20, y, 0);
|
||||||
|
y += 20;
|
||||||
|
}
|
||||||
if (stack != null && stack.getItem() instanceof IEnergyInterfaceItem)
|
if (stack != null && stack.getItem() instanceof IEnergyInterfaceItem)
|
||||||
{
|
{
|
||||||
double MaxCharge = ((IEnergyInterfaceItem) stack.getItem()).getMaxPower(stack);
|
double MaxCharge = ((IEnergyInterfaceItem) stack.getItem()).getMaxPower(stack);
|
||||||
|
@ -106,8 +131,7 @@ public class ChargeHud
|
||||||
{
|
{
|
||||||
color = Color.DARK_RED;
|
color = Color.DARK_RED;
|
||||||
}
|
}
|
||||||
mc.fontRendererObj.drawString(color + PowerSystem.getLocaliszedPower(CurrentCharge) + "/"
|
mc.fontRendererObj.drawString(color + PowerSystem.getLocaliszedPower(CurrentCharge) + "/" + PowerSystem.getLocaliszedPower(MaxCharge), 20, y, 0);
|
||||||
+ PowerSystem.getLocaliszedPower(MaxCharge), 20, y, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
Loading…
Reference in a new issue