Advertisement
Guest User

EntityArrowRender

a guest
Apr 20th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.14 KB | None | 0 0
  1. package yesodmod.general.client;
  2.  
  3. import net.minecraft.client.renderer.Tessellator;
  4. import net.minecraft.client.renderer.entity.Render;
  5. import net.minecraft.entity.Entity;
  6. import net.minecraft.util.MathHelper;
  7. import net.minecraft.util.ResourceLocation;
  8.  
  9. import org.lwjgl.opengl.GL11;
  10. import org.lwjgl.opengl.GL12;
  11.  
  12. import yesodmod.general.entity.EntityExplosiveArrow;
  13. import cpw.mods.fml.relauncher.Side;
  14. import cpw.mods.fml.relauncher.SideOnly;
  15.  
  16. @SideOnly(Side.CLIENT)
  17. public class RenderEntityExplosiveArrow extends Render
  18. {
  19.     private static final ResourceLocation arrowTextures = new ResourceLocation("yesodmod:textures/entity/explosivearrow.png");
  20.     private static final String __OBFID = "CL_00000978";
  21.  
  22.     /**
  23.      * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
  24.      * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
  25.      * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
  26.      * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
  27.      */
  28.     public void doRender(EntityExplosiveArrow p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
  29.     {
  30.         this.bindEntityTexture(p_76986_1_);
  31.         GL11.glPushMatrix();
  32.         GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
  33.         GL11.glRotatef(p_76986_1_.prevRotationYaw + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
  34.         GL11.glRotatef(p_76986_1_.prevRotationPitch + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
  35.         Tessellator tessellator = Tessellator.instance;
  36.         byte b0 = 0;
  37.         float f2 = 0.0F;
  38.         float f3 = 0.5F;
  39.         float f4 = (float)(0 + b0 * 10) / 32.0F;
  40.         float f5 = (float)(5 + b0 * 10) / 32.0F;
  41.         float f6 = 0.0F;
  42.         float f7 = 0.15625F;
  43.         float f8 = (float)(5 + b0 * 10) / 32.0F;
  44.         float f9 = (float)(10 + b0 * 10) / 32.0F;
  45.         float f10 = 0.05625F;
  46.         GL11.glEnable(GL12.GL_RESCALE_NORMAL);
  47.  
  48.         GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
  49.         GL11.glScalef(f10, f10, f10);
  50.         GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
  51.         GL11.glNormal3f(f10, 0.0F, 0.0F);
  52.         tessellator.startDrawingQuads();
  53.         tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8);
  54.         tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8);
  55.         tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9);
  56.         tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9);
  57.         tessellator.draw();
  58.         GL11.glNormal3f(-f10, 0.0F, 0.0F);
  59.         tessellator.startDrawingQuads();
  60.         tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8);
  61.         tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8);
  62.         tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9);
  63.         tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9);
  64.         tessellator.draw();
  65.  
  66.         for (int i = 0; i < 4; ++i)
  67.         {
  68.             GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
  69.             GL11.glNormal3f(0.0F, 0.0F, f10);
  70.             tessellator.startDrawingQuads();
  71.             tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4);
  72.             tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4);
  73.             tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5);
  74.             tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5);
  75.             tessellator.draw();
  76.         }
  77.  
  78.         GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  79.         GL11.glPopMatrix();
  80.     }
  81.  
  82.     /**
  83.      * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
  84.      */
  85.     protected ResourceLocation getEntityTexture(EntityExplosiveArrow p_110775_1_)
  86.     {
  87.         return arrowTextures;
  88.     }
  89.  
  90.     /**
  91.      * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
  92.      */
  93.     protected ResourceLocation getEntityTexture(Entity p_110775_1_)
  94.     {
  95.         return this.getEntityTexture((EntityExplosiveArrow)p_110775_1_);
  96.     }
  97.  
  98.     /**
  99.      * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
  100.      * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
  101.      * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
  102.      * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
  103.      */
  104.     public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
  105.     {
  106.         this.doRender((EntityExplosiveArrow)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
  107.     }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement