2013-08-27 00:57:08 +02:00
|
|
|
package mekanism.client.render.entity;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.EntityObsidianTNT;
|
|
|
|
import mekanism.common.Mekanism;
|
2012-12-20 22:53:39 +01:00
|
|
|
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;
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.entity.Entity;
|
2013-07-20 18:10:14 +02:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2012-08-15 22:41:41 +02:00
|
|
|
public class RenderObsidianTNT extends Render
|
|
|
|
{
|
2013-04-18 04:40:11 +02:00
|
|
|
private RenderBlocks blockRenderer = new RenderBlocks();
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
public RenderObsidianTNT()
|
|
|
|
{
|
|
|
|
shadowSize = 0.5F;
|
|
|
|
}
|
2013-04-13 02:25:21 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void doRender(Entity entity, double x, double y, double z, float f, float f1)
|
|
|
|
{
|
|
|
|
renderObsidianTNT((EntityObsidianTNT)entity, x, y, z, f, f1);
|
|
|
|
}
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2013-04-13 02:25:21 +02:00
|
|
|
public void renderObsidianTNT(EntityObsidianTNT entityobsidiantnt, double x, double y, double z, float f, float f1)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
GL11.glPushMatrix();
|
2013-04-13 02:25:21 +02:00
|
|
|
GL11.glTranslatef((float)x, (float)y, (float)z);
|
|
|
|
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2013-04-13 02:25:21 +02:00
|
|
|
if((entityobsidiantnt.fuse - f1) + 1.0F < 10F)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
2013-04-13 02:25:21 +02:00
|
|
|
float scale = 1.0F - ((entityobsidiantnt.fuse - f1) + 1.0F) / 10F;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2013-04-13 02:25:21 +02:00
|
|
|
if(scale < 0.0F)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
2013-04-13 02:25:21 +02:00
|
|
|
scale = 0.0F;
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2013-04-13 02:25:21 +02:00
|
|
|
if(scale > 1.0F)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
2013-04-13 02:25:21 +02:00
|
|
|
scale = 1.0F;
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2013-04-13 02:25:21 +02:00
|
|
|
scale *= scale;
|
|
|
|
scale *= scale;
|
|
|
|
float renderScale = 1.0F + scale * 0.3F;
|
|
|
|
GL11.glScalef(renderScale, renderScale, renderScale);
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2013-04-13 02:25:21 +02:00
|
|
|
float f3 = (1.0F - ((entityobsidiantnt.fuse - f1) + 1.0F) / 100F) * 0.8F;
|
2013-09-28 03:59:47 +02:00
|
|
|
bindEntityTexture(entityobsidiantnt);
|
2012-11-05 20:29:04 +01:00
|
|
|
blockRenderer.renderBlockAsItem(Mekanism.ObsidianTNT, 0, entityobsidiantnt.getBrightness(f1));
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2013-03-18 17:23:57 +01:00
|
|
|
if(entityobsidiantnt.fuse / 5 % 2 == 0)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
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);
|
2012-11-05 20:29:04 +01:00
|
|
|
blockRenderer.renderBlockAsItem(Mekanism.ObsidianTNT, 0, 1.0F);
|
2012-08-15 22:41:41 +02:00
|
|
|
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
|
2013-09-28 03:59:47 +02:00
|
|
|
protected ResourceLocation getEntityTexture(Entity entity)
|
2013-07-20 18:10:14 +02:00
|
|
|
{
|
2013-09-28 03:59:47 +02:00
|
|
|
return TextureMap.locationBlocksTexture;
|
2013-07-20 18:10:14 +02:00
|
|
|
}
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|