Semi-finalized the bar texture for Demon Will (Thanks Yulife <3)
This commit is contained in:
parent
bf7e9eed6e
commit
1c8faa03ef
|
@ -47,7 +47,7 @@ public abstract class HUDElement
|
||||||
this.yOffset = yOffsetDefault;
|
this.yOffset = yOffsetDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
|
public void drawTexturedModalRect(double x, double y, double textureX, double textureY, double width, double height)
|
||||||
{
|
{
|
||||||
float f = 0.00390625F;
|
float f = 0.00390625F;
|
||||||
float f1 = 0.00390625F;
|
float f1 = 0.00390625F;
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
package WayofTime.bloodmagic.client.hud;
|
package WayofTime.bloodmagic.client.hud;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.VertexBuffer;
|
import net.minecraft.client.renderer.VertexBuffer;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
|
@ -21,19 +18,12 @@ import WayofTime.bloodmagic.util.Utils;
|
||||||
|
|
||||||
public class HUDElementDemonWillAura extends HUDElement
|
public class HUDElementDemonWillAura extends HUDElement
|
||||||
{
|
{
|
||||||
protected Map<EnumDemonWillType, ResourceLocation> crystalTextures = new HashMap<EnumDemonWillType, ResourceLocation>();
|
|
||||||
protected List<EnumDemonWillType> barOrder = new ArrayList<EnumDemonWillType>();
|
protected List<EnumDemonWillType> barOrder = new ArrayList<EnumDemonWillType>();
|
||||||
|
|
||||||
// private double maxBarSize = 54;
|
|
||||||
|
|
||||||
public HUDElementDemonWillAura()
|
public HUDElementDemonWillAura()
|
||||||
{
|
{
|
||||||
super(5, 5, RenderGameOverlayEvent.ElementType.HOTBAR);
|
super(5, 5, RenderGameOverlayEvent.ElementType.HOTBAR);
|
||||||
crystalTextures.put(EnumDemonWillType.DEFAULT, new ResourceLocation(Constants.Mod.MODID, "textures/models/DefaultCrystal.png"));
|
|
||||||
crystalTextures.put(EnumDemonWillType.CORROSIVE, new ResourceLocation(Constants.Mod.MODID, "textures/models/CorrosiveCrystal.png"));
|
|
||||||
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.DEFAULT);
|
||||||
barOrder.add(EnumDemonWillType.CORROSIVE);
|
barOrder.add(EnumDemonWillType.CORROSIVE);
|
||||||
barOrder.add(EnumDemonWillType.STEADFAST);
|
barOrder.add(EnumDemonWillType.STEADFAST);
|
||||||
|
@ -51,52 +41,44 @@ public class HUDElementDemonWillAura extends HUDElement
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
|
||||||
|
|
||||||
minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/hud/bars.png"));
|
minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/hud/bars.png"));
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
||||||
this.drawTexturedModalRect(getXOffset(), getYOffset(), 0, 105 * 2, 80, 46);
|
this.drawTexturedModalRect(getXOffset(), getYOffset(), 0, 105 * 2, 80, 46);
|
||||||
|
|
||||||
double maxAmount = Utils.getDemonWillResolution(player);
|
double maxAmount = Utils.getDemonWillResolution(player);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
for (EnumDemonWillType type : barOrder)
|
for (EnumDemonWillType type : barOrder)
|
||||||
{
|
{
|
||||||
|
i++;
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
||||||
// minecraft.getTextureManager().bindTexture(crystalTextures.get(type));
|
minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/hud/bars.png"));
|
||||||
double maxBarSize = 26;
|
int textureXOffset = (i > 3) ? (i - 3) : (3 - i);
|
||||||
|
int maxBarSize = 30 - 2 * textureXOffset;
|
||||||
|
|
||||||
double amount = ClientProxy.currentAura == null ? 0 : ClientProxy.currentAura.getWill(type);
|
double amount = ClientProxy.currentAura == null ? 0 : ClientProxy.currentAura.getWill(type);
|
||||||
double ratio = Math.max(Math.min(amount / maxAmount, 1), 0);
|
double ratio = Math.max(Math.min(amount / maxAmount, 1), 0);
|
||||||
|
|
||||||
double x = getXOffset() + 8 + type.ordinal() * 6;
|
double width = maxBarSize * ratio * 2;
|
||||||
double y = getYOffset() + 5 + (1 - ratio) * maxBarSize;
|
double height = 2;
|
||||||
double height = maxBarSize * ratio;
|
double x = getXOffset() + 2 * textureXOffset + 10;
|
||||||
double width = 5;
|
double y = getYOffset() + 4 * i + 10;
|
||||||
|
|
||||||
// vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
double textureX = 2 * textureXOffset + 2 * 42;
|
||||||
// vertexBuffer.pos((double) (x), (double) (y + height), 0).tex(0, 1).endVertex();
|
double textureY = 4 * i + 220;
|
||||||
// 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())
|
this.drawTexturedModalRect(x, y, textureX, textureY, width, height);
|
||||||
// {
|
|
||||||
// GlStateManager.pushMatrix();
|
if (player.isSneaking())
|
||||||
// String value = "" + (int) amount;
|
{
|
||||||
// GlStateManager.translate(x, (y + height + 4 + value.length() * 3), 0);
|
GlStateManager.pushMatrix();
|
||||||
// GlStateManager.scale(0.5, 0.5, 1);
|
String value = "" + (int) amount;
|
||||||
// GlStateManager.rotate(-90, 0, 0, 1);
|
GlStateManager.translate(x - 2 * textureXOffset - value.length() * 0 + 70, (y - 1), 0);
|
||||||
// minecraft.fontRendererObj.drawStringWithShadow("" + (int) amount, 0, 2, 0xffffff);
|
GlStateManager.scale(0.5, 0.5, 1);
|
||||||
// GlStateManager.popMatrix();
|
minecraft.fontRendererObj.drawStringWithShadow("" + (int) amount, 0, 2, 0xffffff);
|
||||||
// }
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue