Removed the transparency from the bars themselves for the Demon Will gauge and set them to always render for testing

This commit is contained in:
WayofTime 2016-07-27 07:54:32 -04:00
parent e82bc6027b
commit bf7e9eed6e
2 changed files with 34 additions and 25 deletions

View file

@ -1,10 +1,11 @@
package WayofTime.bloodmagic.client.hud;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
@ -21,8 +22,9 @@ import WayofTime.bloodmagic.util.Utils;
public class HUDElementDemonWillAura extends HUDElement
{
protected Map<EnumDemonWillType, ResourceLocation> crystalTextures = new HashMap<EnumDemonWillType, ResourceLocation>();
protected List<EnumDemonWillType> barOrder = new ArrayList<EnumDemonWillType>();
private double maxBarSize = 54;
// private double maxBarSize = 54;
public HUDElementDemonWillAura()
{
@ -32,6 +34,11 @@ public class HUDElementDemonWillAura extends HUDElement
crystalTextures.put(EnumDemonWillType.DESTRUCTIVE, new ResourceLocation(Constants.Mod.MODID, "textures/models/DestructiveCrystal.png"));
crystalTextures.put(EnumDemonWillType.VENGEFUL, new ResourceLocation(Constants.Mod.MODID, "textures/models/VengefulCrystal.png"));
crystalTextures.put(EnumDemonWillType.STEADFAST, new ResourceLocation(Constants.Mod.MODID, "textures/models/SteadfastCrystal.png"));
barOrder.add(EnumDemonWillType.DEFAULT);
barOrder.add(EnumDemonWillType.CORROSIVE);
barOrder.add(EnumDemonWillType.STEADFAST);
barOrder.add(EnumDemonWillType.DESTRUCTIVE);
barOrder.add(EnumDemonWillType.VENGEFUL);
}
@Override
@ -47,16 +54,17 @@ public class HUDElementDemonWillAura extends HUDElement
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexBuffer = tessellator.getBuffer();
minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/gui/demonWillBar.png"));
minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/hud/bars.png"));
GlStateManager.color(1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(getXOffset(), getYOffset(), 45, 0, 45, 65);
this.drawTexturedModalRect(getXOffset(), getYOffset(), 0, 105 * 2, 80, 46);
double maxAmount = Utils.getDemonWillResolution(player);
for (EnumDemonWillType type : EnumDemonWillType.values())
for (EnumDemonWillType type : barOrder)
{
GlStateManager.color(1.0F, 1.0F, 1.0F);
minecraft.getTextureManager().bindTexture(crystalTextures.get(type));
// minecraft.getTextureManager().bindTexture(crystalTextures.get(type));
double maxBarSize = 26;
double amount = ClientProxy.currentAura == null ? 0 : ClientProxy.currentAura.getWill(type);
double ratio = Math.max(Math.min(amount / maxAmount, 1), 0);
@ -66,28 +74,29 @@ public class HUDElementDemonWillAura extends HUDElement
double height = maxBarSize * ratio;
double width = 5;
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexBuffer.pos((double) (x), (double) (y + height), 0).tex(0, 1).endVertex();
vertexBuffer.pos((double) (x + width), (double) (y + height), 0).tex(5d / 16d, 1).endVertex();
vertexBuffer.pos((double) (x + width), (double) (y), 0).tex(5d / 16d, 1 - ratio).endVertex();
vertexBuffer.pos((double) (x), (double) (y), 0).tex(0, 1 - ratio).endVertex();
tessellator.draw();
// vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
// vertexBuffer.pos((double) (x), (double) (y + height), 0).tex(0, 1).endVertex();
// vertexBuffer.pos((double) (x + width), (double) (y + height), 0).tex(5d / 16d, 1).endVertex();
// vertexBuffer.pos((double) (x + width), (double) (y), 0).tex(5d / 16d, 1 - ratio).endVertex();
// vertexBuffer.pos((double) (x), (double) (y), 0).tex(0, 1 - ratio).endVertex();
// tessellator.draw();
if (player.isSneaking())
{
GlStateManager.pushMatrix();
String value = "" + (int) amount;
GlStateManager.translate(x, (y + height + 4 + value.length() * 3), 0);
GlStateManager.scale(0.5, 0.5, 1);
GlStateManager.rotate(-90, 0, 0, 1);
minecraft.fontRendererObj.drawStringWithShadow("" + (int) amount, 0, 2, 0xffffff);
GlStateManager.popMatrix();
}
// if (player.isSneaking())
// {
// GlStateManager.pushMatrix();
// String value = "" + (int) amount;
// GlStateManager.translate(x, (y + height + 4 + value.length() * 3), 0);
// GlStateManager.scale(0.5, 0.5, 1);
// GlStateManager.rotate(-90, 0, 0, 1);
// minecraft.fontRendererObj.drawStringWithShadow("" + (int) amount, 0, 2, 0xffffff);
// GlStateManager.popMatrix();
// }
}
minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/gui/demonWillBar.png"));
GlStateManager.color(1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(getXOffset(), getYOffset(), 0, 0, 45, 65);
// minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/gui/demonWillBar.png"));
minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/hud/bars.png"));
GlStateManager.color(1.0F, 1.0F, 1.0F, 1f);
this.drawTexturedModalRect(getXOffset() + 10, getYOffset() + 14, 42 * 2, 112 * 2, 60, 20);
}
@Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB