Minor tweaks + experimenting with a reagent guage for Project: Omega

This commit is contained in:
WayofTime 2014-12-09 19:06:47 -05:00
parent dd4c36b39c
commit 9ad3330e08
10 changed files with 259 additions and 189 deletions

View file

@ -1,22 +1,31 @@
package WayofTime.alchemicalWizardry.client.renderer;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.List;
public class RenderHelper
{
@ -24,6 +33,8 @@ public class RenderHelper
public static boolean enableItemName = false;
public static boolean enabled = true;
public static boolean showInChat = true;
public static int zLevel = 0;
private static int xOffsetDefault = +50;
public static int xOffset = xOffsetDefault;
@ -53,6 +64,7 @@ public class RenderHelper
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
displayArmorStatus(mc);
renderTestHUD(mc);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
@ -141,6 +153,68 @@ public class RenderHelper
return r;
}
private static void renderTestHUD(Minecraft mc)
{
int x = 0;
int y = 0;
int l;
float f;
float f3;
float f4;
TextureManager p_77015_2_ = mc.getTextureManager();
ItemStack p_77015_3_ = new ItemStack(ModItems.activationCrystal);
Object object = p_77015_3_.getIconIndex();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
ResourceLocation resourcelocation = p_77015_2_.getResourceLocation(p_77015_3_.getItemSpriteNumber());
p_77015_2_.bindTexture(resourcelocation);
if (object == null)
{
object = ((TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("missingno");
}
l = p_77015_3_.getItem().getColorFromItemStack(p_77015_3_, 0);
f3 = (float)(l >> 16 & 255) / 255.0F;
f4 = (float)(l >> 8 & 255) / 255.0F;
f = (float)(l & 255) / 255.0F;
// if (this.renderWithColor)
// {
// GL11.glColor4f(f3, f4, f, 1.0F);
// }
GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, a renderEffect can derp them up.
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
renderIcon(x, y, (IIcon)object, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
// if (renderEffect && p_77015_3_.hasEffect(0))
// {
// renderEffect(p_77015_2_, x, y);
// }
GL11.glEnable(GL11.GL_LIGHTING);
}
public static void renderIcon(int p_94149_1_, int p_94149_2_, IIcon p_94149_3_, int p_94149_4_, int p_94149_5_)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(p_94149_1_ + 0), (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMaxV());
tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMaxV());
tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)(p_94149_2_ + 0), (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMinV());
tessellator.addVertexWithUV((double)(p_94149_1_ + 0), (double)(p_94149_2_ + 0), (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMinV());
tessellator.draw();
}
private static void displayArmorStatus(Minecraft mc)
{