BloodMagic/BM_src/WayofTime/alchemicalWizardry/common/renderer/model/ModelBloodAltar.java
Fenn e3644f2d2b Massive rework of configs, items and blocks.
I redone where the items/blocsks are stored and how the configs are
handled to clean up it and give space. You can change the config line to
AWWayofTime if you want to keep the compatibility with old configs. Now
you reference the blocks from the ModBlocks and Items from the ModItems.
2014-01-17 21:05:38 +00:00

69 lines
3.2 KiB
Java

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.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
public class ModelBloodAltar extends ModelBase {
private IModelCustom modelBloodAltar;
private IModelCustom modelBloodLevel; //TODO
public ModelBloodAltar()
{
modelBloodAltar = AdvancedModelLoader.loadModel("/assets/alchemicalwizardry/models/bloodaltar-fixeUV.obj");
modelBloodLevel = AdvancedModelLoader.loadModel("/assets/alchemicalwizardry/models/bloodlevel.obj");
}
public void renderBloodAltar()
{
modelBloodAltar.renderAll();
}
public void renderBloodLevel()
{
modelBloodLevel.renderAll();
}
public void renderBloodAltar(TEAltar altar, double x, double y, double z)
{
float scale = 0.1f;
// Push a blank matrix onto the stack
GL11.glPushMatrix();
// 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, (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/altar.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.renderBloodAltar();
// Pop this matrix from the stack.
GL11.glPopMatrix();
}
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.glPopMatrix();
}
}