Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package swords.entity;
- import net.minecraft.client.renderer.RenderHelper;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.entity.Render;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.projectile.EntityFireball;
- import net.minecraft.util.MathHelper;
- 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)
- public class RenderFlames extends Render
- {
- private static final ResourceLocation flames = new ResourceLocation("swordsmod:textures/entity/fire_beam.png");
- private float field_77002_a;
- public RenderFlames(float par1)
- {
- this.field_77002_a = par1;
- }
- public void doRenderFlames(EntityFlames entityflames, double relX, double relY, double relZ, double centerX, double centerY, double centerZ, double targetX, double targetY, double targetZ, float tickStuff)
- {
- float f2 = 50000;
- float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
- f3 = (f3 * f3 + f3) * 0.2F;
- float wayX = (float) (targetX - centerX);
- float wayY = (float) (targetY - centerY);
- float wayZ = (float) (targetZ - centerZ);
- float distFlat = MathHelper.sqrt_float(wayX * wayX + wayZ * wayZ);
- float dist = MathHelper.sqrt_float(wayX * wayX + wayY * wayY + wayZ * wayZ);
- GL11.glPushMatrix();
- GL11.glTranslatef((float) relX, (float) relY, (float) relZ);
- GL11.glRotatef((float) (-Math.atan2(wayZ, wayX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
- GL11.glRotatef((float) (-Math.atan2(distFlat, wayY)) * 180.0F / (float) Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
- Tessellator tessellator = Tessellator.instance;
- RenderHelper.disableStandardItemLighting();
- GL11.glDisable(GL11.GL_CULL_FACE);
- this.bindEntityTexture(entityflames);
- this.bindTexture(flames);
- GL11.glColor3d(1.0F, 0.0F, 0.0F);
- GL11.glShadeModel(GL11.GL_SMOOTH);
- float f9 = -(tickStuff * 0.005F);
- float f10 = MathHelper.sqrt_float(wayX * wayX + wayY * wayY + wayZ * wayZ) / 32.0F + f9;
- tessellator.startDrawing(5);
- //Add all 2*8 vertex/corners
- byte b0 = 8;
- for (int i = 0; i <= b0; ++i)
- {
- float f11 = 0.2F * (MathHelper.sin(i % b0 * (float) Math.PI * 2.0F / b0) * 0.75F);
- float f12 = 0.2F * (MathHelper.cos(i % b0 * (float) Math.PI * 2.0F / b0) * 0.75F);
- float f13 = i % b0 * 1.0F / b0;
- tessellator.setColorOpaque(255, 0, 0);
- tessellator.addVertexWithUV((f11), (f12), 0.0D, f13, f10);
- tessellator.setColorOpaque_I(16777215);
- tessellator.addVertexWithUV(f11, f12, dist, f13, f9);
- }
- tessellator.draw();
- GL11.glEnable(GL11.GL_CULL_FACE);
- GL11.glShadeModel(GL11.GL_FLAT);
- RenderHelper.enableStandardItemLighting();
- GL11.glPopMatrix();
- }
- protected ResourceLocation getEntityTexture(Entity par1Entity)
- {
- return flames;
- }
- public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
- {
- this.doRenderFlames((EntityFlames)par1Entity, par2, par4, par6, par8, par9, par6, par6, par6, par6, par9);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement