Mekanism-tilera-Edition/common/mekanism/client/render/entity/RenderObsidianTNTPrimed.java

91 lines
2.8 KiB
Java
Raw Normal View History

package mekanism.client.render.entity;
2013-11-03 17:38:36 +01:00
import mekanism.client.model.ModelObsidianTNT;
import mekanism.common.EntityObsidianTNT;
import mekanism.common.Mekanism;
2013-11-03 17:38:36 +01:00
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.Render;
2013-07-20 18:10:14 +02:00
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
2013-11-03 17:38:36 +01:00
import net.minecraft.src.FMLRenderAccessLibrary;
2013-07-20 18:10:14 +02:00
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
2013-11-03 17:38:36 +01:00
public class RenderObsidianTNTPrimed extends Render
{
private RenderBlocks blockRenderer = new RenderBlocks();
2013-11-03 17:38:36 +01:00
private ModelObsidianTNT model = new ModelObsidianTNT();
2013-11-03 17:38:36 +01:00
public RenderObsidianTNTPrimed()
{
shadowSize = 0.5F;
}
@Override
public void doRender(Entity entity, double x, double y, double z, float f, float f1)
{
renderObsidianTNT((EntityObsidianTNT)entity, x, y, z, f, f1);
}
public void renderObsidianTNT(EntityObsidianTNT entityobsidiantnt, double x, double y, double z, float f, float f1)
{
GL11.glPushMatrix();
2013-11-03 17:38:36 +01:00
GL11.glTranslatef((float)x, (float)y-1.2f, (float)z);
GL11.glScalef(0.8F, 0.8F, 0.8F);
2013-11-03 22:54:33 +01:00
GL11.glRotatef(180, 1, 0, 0);
if((entityobsidiantnt.fuse - f1) + 1.0F < 10F)
{
float scale = 1.0F - ((entityobsidiantnt.fuse - f1) + 1.0F) / 10F;
if(scale < 0.0F)
{
scale = 0.0F;
}
if(scale > 1.0F)
{
scale = 1.0F;
}
scale *= scale;
scale *= scale;
float renderScale = 1.0F + scale * 0.3F;
GL11.glScalef(renderScale, renderScale, renderScale);
}
float f3 = (1.0F - ((entityobsidiantnt.fuse - f1) + 1.0F) / 100F) * 0.8F;
2013-11-03 17:38:36 +01:00
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ObsidianTNT.png"));
model.render(0.0625F);
if(entityobsidiantnt.fuse / 5 % 2 == 0)
{
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
GL11.glColor4f(1.0F, 1.0F, 1.0F, f3);
2013-11-03 17:38:36 +01:00
model.render(0.0625F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
GL11.glPopMatrix();
}
2013-07-20 18:10:14 +02:00
@Override
protected ResourceLocation getEntityTexture(Entity entity)
2013-07-20 18:10:14 +02:00
{
return TextureMap.locationBlocksTexture;
2013-07-20 18:10:14 +02:00
}
}