Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.Cmonster.OreMod.client;
- import com.Cmonster.OreMod.entities.EntityJohn_tnt;
- import init.ModBlocks;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.renderer.BlockRendererDispatcher;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.client.renderer.entity.Render;
- import net.minecraft.client.renderer.entity.RenderManager;
- import net.minecraft.client.renderer.texture.TextureMap;
- import net.minecraft.init.Blocks;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.math.MathHelper;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- @SideOnly(Side.CLIENT)
- public class RenderJohnny_tnt extends Render<EntityJohn_tnt>
- {
- public RenderJohnny_tnt(RenderManager renderManagerIn)
- {
- super(renderManagerIn);
- this.shadowSize = 0.5F;
- }
- /**
- * Renders the desired {@code T} type Entity.
- */
- public void doRender(EntityJohn_tnt entity, double x, double y, double z, float entityYaw, float partialTicks)
- {
- BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
- GlStateManager.pushMatrix();
- GlStateManager.translate((float)x, (float)y + 0.5F, (float)z);
- if ((float)entity.getFuse() - partialTicks + 1.0F < 10.0F)
- {
- float f = 1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 10.0F;
- f = MathHelper.clamp(f, 0.0F, 1.0F);
- f = f * f;
- f = f * f;
- float f1 = 1.0F + f * 0.3F;
- GlStateManager.scale(f1, f1, f1);
- }
- float f2 = (1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 100.0F) * 0.8F;
- this.bindEntityTexture(entity);
- GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
- GlStateManager.translate(-0.5F, -0.5F, 0.5F);
- blockrendererdispatcher.renderBlockBrightness(ModBlocks.johnny_tnt.getDefaultState(), entity.getBrightness(partialTicks));
- GlStateManager.translate(0.0F, 0.0F, 1.0F);
- if (this.renderOutlines)
- {
- GlStateManager.enableColorMaterial();
- GlStateManager.enableOutlineMode(this.getTeamColor(entity));
- blockrendererdispatcher.renderBlockBrightness(ModBlocks.johnny_tnt.getDefaultState(), 1.0F);
- GlStateManager.disableOutlineMode();
- GlStateManager.disableColorMaterial();
- }
- else if (entity.getFuse() / 5 % 2 == 0)
- {
- GlStateManager.disableTexture2D();
- GlStateManager.disableLighting();
- GlStateManager.enableBlend();
- GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA);
- GlStateManager.color(1.0F, 1.0F, 1.0F, f2);
- GlStateManager.doPolygonOffset(-3.0F, -3.0F);
- GlStateManager.enablePolygonOffset();
- blockrendererdispatcher.renderBlockBrightness(ModBlocks.johnny_tnt.getDefaultState(), 1.0F);
- GlStateManager.doPolygonOffset(0.0F, 0.0F);
- GlStateManager.disablePolygonOffset();
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- GlStateManager.disableBlend();
- GlStateManager.enableLighting();
- GlStateManager.enableTexture2D();
- }
- GlStateManager.popMatrix();
- super.doRender(entity, x, y, z, entityYaw, partialTicks);
- }
- /**
- * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
- */
- @Override
- protected ResourceLocation getEntityTexture(EntityJohn_tnt entity)
- {
- return TextureMap.LOCATION_BLOCKS_TEXTURE;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement