diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java | 104 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/proxy/ClientProxy.java | 6 |
2 files changed, 109 insertions, 1 deletions
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<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. + */ + @Override + public void doRender(final EntityTNTPrimed entity, final double p_76986_2_, final double p_76986_4_, final double p_76986_6_, final float p_76986_8_, final float p_76986_9_){ + GL11.glPushMatrix(); + GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_); + float f2; + + if (((entity.fuse - p_76986_9_) + 1.0F) < 10.0F) + { + f2 = 1.0F - (((entity.fuse - p_76986_9_) + 1.0F) / 10.0F); + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 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<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. + */ + @Override + public void doRender(final Entity p_76986_1_, final double p_76986_2_, final double p_76986_4_, final double p_76986_6_, final float p_76986_8_, final float p_76986_9_){ + this.doRender((EntityTNTPrimed)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index 222c1e891b..fde950bace 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -7,8 +7,10 @@ import cpw.mods.fml.common.event.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; +import gtPlusPlus.core.client.renderer.RenderMiningExplosivesPrimed; import gtPlusPlus.core.common.CommonProxy; import gtPlusPlus.core.common.compat.COMPAT_PlayerAPI; +import gtPlusPlus.core.entity.EntityPrimedMiningExplosive; import gtPlusPlus.core.handler.render.FirepitRender; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.tileentities.general.TileEntityFirepit; @@ -64,7 +66,9 @@ public class ClientProxy extends CommonProxy{ //MinecraftForgeClient.registerItemRenderer(ModItems.FluidCell.getItem(), new RenderLiquidCell()); //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelMob.class, new RenderBloodSteelMob(new ModelBloodSteelMob(), 0)); //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelHostileMob.class, new RenderBloodSteelMobHostile(new ModelBloodSteelMob(), 0)); - //RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(ModItems.tutGrenade)); + //RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(ModItems.tutGrenade)); + + RenderingRegistry.registerEntityRenderingHandler(EntityPrimedMiningExplosive.class, new RenderMiningExplosivesPrimed()); //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer()); //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest()); |