From 776f96df847e2337549d4298d51015aff4d0c0d9 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sat, 18 Mar 2017 11:37:01 +1000 Subject: + Added a custom mining explosives renderer. --- .../renderer/RenderMiningExplosivesPrimed.java | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java (limited to 'src/Java/gtPlusPlus/core/client/renderer') diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java new file mode 100644 index 0000000000..697ea4e2b2 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java @@ -0,0 +1,104 @@ +package gtPlusPlus.core.client.renderer; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.block.ModBlocks; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.entity.RenderTNTPrimed; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.init.Blocks; +import net.minecraft.util.ResourceLocation; + +@SideOnly(Side.CLIENT) +public class RenderMiningExplosivesPrimed extends RenderTNTPrimed +{ + private final RenderBlocks blockRenderer = new RenderBlocks(); + + public RenderMiningExplosivesPrimed(){ + this.shadowSize = 0.5F; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render 1.0F) + { + f2 = 1.0F; + } + + f2 *= f2; + f2 *= f2; + final float f3 = 1.0F + (f2 * 0.3F); + GL11.glScalef(f3, f3, f3); + } + + f2 = (1.0F - (((entity.fuse - p_76986_9_) + 1.0F) / 100.0F)) * 0.8F; + this.bindEntityTexture(entity); + this.blockRenderer.renderBlockAsItem(ModBlocks.blockMiningExplosive, 0, entity.getBrightness(p_76986_9_)); + + if (((entity.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, f2); + this.blockRenderer.renderBlockAsItem(Blocks.tnt, 0, 1.0F); + 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(); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + @Override + protected ResourceLocation getEntityTexture(final EntityTNTPrimed p_110775_1_){ + return TextureMap.locationBlocksTexture; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + @Override + protected ResourceLocation getEntityTexture(final Entity p_110775_1_){ + return this.getEntityTexture((EntityTNTPrimed)p_110775_1_); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render