Merge pull request #157 from ganymedes01/master

Changed the life essence/blood textures so they look more like blood
This commit is contained in:
WayofTime 2014-11-14 19:54:36 -05:00
commit d23d90918d
7 changed files with 83 additions and 90 deletions

View file

@ -1,22 +1,28 @@
package WayofTime.alchemicalWizardry.common.renderer.model;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.client.FMLClientHandler;
public class ModelBloodAltar extends ModelBase
{
private static final ResourceLocation altar_texture = new ResourceLocation("alchemicalwizardry:textures/models/altar.png");
private IModelCustom modelBloodAltar;
private IModelCustom modelBloodLevel; //TODO
public ModelBloodAltar()
{
modelBloodAltar = AdvancedModelLoader.loadModel(new ResourceLocation("alchemicalwizardry:models/bloodaltar-fixeUV.obj"));
modelBloodLevel = AdvancedModelLoader.loadModel(new ResourceLocation("alchemicalwizardry:models/bloodlevel.obj"));
}
public void renderBloodAltar()
@ -24,11 +30,6 @@ public class ModelBloodAltar extends ModelBase
modelBloodAltar.renderAll();
}
public void renderBloodLevel()
{
modelBloodLevel.renderAll();
}
public void renderBloodAltar(TEAltar altar, double x, double y, double z)
{
float scale = 0.1f;
@ -39,9 +40,7 @@ public class ModelBloodAltar extends ModelBase
// Scale our object to about half-size in all directions (the OBJ file is a little large)
GL11.glScalef(scale, scale, scale);
// Bind the texture, so that OpenGL properly textures our block.
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/altar.png");
//FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/alchemicalwizardry/textures/models/altar.png");
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(altar_texture);
// Render the object, using modelTutBox.renderAll();
this.renderBloodAltar();
// Pop this matrix from the stack.
@ -50,21 +49,29 @@ public class ModelBloodAltar extends ModelBase
public void renderBloodLevel(TEAltar altar, double x, double y, double z)
{
float scale = 0.1f;
// Push a blank matrix onto the stack
GL11.glPushMatrix();
float level = altar.getFluidAmount();
// Move the object into the correct position on the block (because the OBJ's origin is the center of the object)
GL11.glTranslatef((float) x + 0.5f, (float) y + 0.6499f + 0.12f * (level / altar.getCapacity()), (float) z + 0.5f);
// Scale our object to about half-size in all directions (the OBJ file is a little large)
GL11.glScalef(scale, scale, scale);
// Bind the texture, so that OpenGL properly textures our block.
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/blood.png");
//FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/alchemicalwizardry/textures/models/altar.png");
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
// Render the object, using modelTutBox.renderAll();
this.renderBloodLevel();
// Pop this matrix from the stack.
GL11.glTranslatef((float) x , (float) y + 0.6499f + 0.12f * (level / altar.getCapacity()), (float) z);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
renderBloodLevel(AlchemicalWizardry.lifeEssenceFluid.getStillIcon());
GL11.glPopMatrix();
}
}
public void renderBloodLevel(IIcon icon)
{
Tessellator tessellator = Tessellator.instance;
double minU = (double) icon.getInterpolatedU(0);
double maxU = (double) icon.getInterpolatedU(16);
double minV = (double) icon.getInterpolatedV(0);
double maxV = (double) icon.getInterpolatedV(16);
tessellator.startDrawingQuads();
tessellator.setNormal(0, 1, 0);
tessellator.addVertexWithUV(1, 0, 1, maxU, maxV);
tessellator.addVertexWithUV(1, 0, 0, maxU, minV);
tessellator.addVertexWithUV(0, 0, 0, minU, minV);
tessellator.addVertexWithUV(0, 0, 1, minU, maxV);
tessellator.draw();
}
}