WIP work on the Demon Aura rendering (Halp, Yulife!)
This commit is contained in:
parent
b8745e34ee
commit
0ac2b78803
|
@ -0,0 +1,92 @@
|
|||
package WayofTime.bloodmagic.client.hud;
|
||||
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
|
||||
public class HUDElementDemonWillAura extends HUDElement
|
||||
{
|
||||
protected Map<EnumDemonWillType, ResourceLocation> crystalTextures = new HashMap<EnumDemonWillType, ResourceLocation>();
|
||||
|
||||
private double maxBarSize = 54;
|
||||
|
||||
public HUDElementDemonWillAura()
|
||||
{
|
||||
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"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Minecraft minecraft, ScaledResolution resolution, float partialTicks)
|
||||
{
|
||||
// ItemStack sigilHolding = minecraft.thePlayer.getHeldItemMainhand();
|
||||
// // TODO - Clean this mess
|
||||
// // Check mainhand for Sigil of Holding
|
||||
// if (sigilHolding == null)
|
||||
// return;
|
||||
// if (!(sigilHolding.getItem() == ModItems.sigilHolding))
|
||||
// sigilHolding = minecraft.thePlayer.getHeldItemOffhand();
|
||||
// // Check offhand for Sigil of Holding
|
||||
// if (sigilHolding == null)
|
||||
// return;
|
||||
// if (!(sigilHolding.getItem() == ModItems.sigilHolding))
|
||||
// return;
|
||||
|
||||
Gui ingameGui = minecraft.ingameGUI;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
||||
|
||||
minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/gui/demonWillBar.png"));
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F);
|
||||
this.drawTexturedModalRect(getXOffset(), getYOffset(), 45, 0, 45, 65);
|
||||
|
||||
// GlStateManager.pushMatrix();
|
||||
|
||||
double maxAmount = 100;
|
||||
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
minecraft.getTextureManager().bindTexture(crystalTextures.get(type));
|
||||
|
||||
double amount = 10 + type.ordinal() * 15;
|
||||
double ratio = Math.max(Math.min(amount / maxAmount, 1), 0);
|
||||
|
||||
double x = getXOffset() + 8 + type.ordinal() * 6;
|
||||
double y = getYOffset() + 5 + (1 - ratio) * maxBarSize;
|
||||
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(1d / 8d, 1).endVertex();
|
||||
vertexBuffer.pos((double) (x + width), (double) (y), 0).tex(1d / 8d, 1 - ratio).endVertex();
|
||||
vertexBuffer.pos((double) (x), (double) (y), 0).tex(0, 1 - ratio).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(Minecraft minecraft)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,36 @@
|
|||
package WayofTime.bloodmagic.proxy;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.client.IMeshProvider;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.client.helper.ShaderHelper;
|
||||
import WayofTime.bloodmagic.client.hud.HUDElementDemonWillAura;
|
||||
import WayofTime.bloodmagic.client.hud.HUDElementHolding;
|
||||
import WayofTime.bloodmagic.client.render.*;
|
||||
import WayofTime.bloodmagic.client.render.LayerBloodElytra;
|
||||
import WayofTime.bloodmagic.client.render.RenderAlchemyArray;
|
||||
import WayofTime.bloodmagic.client.render.RenderAltar;
|
||||
import WayofTime.bloodmagic.client.render.RenderDemonCrucible;
|
||||
import WayofTime.bloodmagic.client.render.RenderItemRoutingNode;
|
||||
import WayofTime.bloodmagic.client.render.entity.BloodLightRenderFactory;
|
||||
import WayofTime.bloodmagic.client.render.entity.SentientArrowRenderFactory;
|
||||
import WayofTime.bloodmagic.client.render.entity.SoulSnareRenderFactory;
|
||||
|
@ -19,27 +43,8 @@ import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
|||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrucible;
|
||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||
import WayofTime.bloodmagic.util.handler.event.ClientHandler;
|
||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
|
@ -115,6 +120,7 @@ public class ClientProxy extends CommonProxy
|
|||
public void postInit()
|
||||
{
|
||||
new HUDElementHolding();
|
||||
new HUDElementDemonWillAura();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 740 B |
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Loading…
Reference in a new issue