Advertisement
Guest User

Untitled

a guest
Dec 10th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. package DSFoFG.entities;
  2.  
  3. import net.minecraft.client.renderer.Tessellator;
  4. import net.minecraft.client.renderer.entity.Render;
  5. import net.minecraft.client.renderer.texture.TextureMap;
  6. import net.minecraft.entity.Entity;
  7. import net.minecraft.entity.projectile.EntityPotion;
  8. import net.minecraft.item.Item;
  9. import net.minecraft.item.ItemPotion;
  10. import net.minecraft.potion.PotionHelper;
  11. import net.minecraft.util.IIcon;
  12. import net.minecraft.util.ResourceLocation;
  13.  
  14. import org.lwjgl.opengl.GL11;
  15. import org.lwjgl.opengl.GL12;
  16.  
  17. import cpw.mods.fml.relauncher.Side;
  18. import cpw.mods.fml.relauncher.SideOnly;
  19.  
  20. @SideOnly(Side.CLIENT)
  21. public class RenderTD extends Render
  22. {
  23. private Item field_94151_a;
  24. private int field_94150_f;
  25. private static final String __OBFID = "CL_00001008";
  26.  
  27. public RenderTD(Item p_i1259_1_, int p_i1259_2_)
  28. {
  29. this.field_94151_a = p_i1259_1_;
  30. this.field_94150_f = p_i1259_2_;
  31. }
  32.  
  33. public RenderTD(Item thermalDetonators)
  34. {
  35. this(thermalDetonators, 0);
  36. }
  37.  
  38. /**
  39. * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
  40. * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
  41. * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
  42. * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
  43. */
  44. 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_)
  45. {
  46. IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f);
  47.  
  48. if (iicon != null)
  49. {
  50. GL11.glPushMatrix();
  51. GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
  52. GL11.glEnable(GL12.GL_RESCALE_NORMAL);
  53. GL11.glScalef(0.5F, 0.5F, 0.5F);
  54. this.bindEntityTexture(p_76986_1_);
  55. Tessellator tessellator = Tessellator.instance;
  56.  
  57. if (iicon == ItemPotion.func_94589_d("bottle_splash"))
  58. {
  59. int i = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).getPotionDamage(), false);
  60. float f2 = (float)(i >> 16 & 255) / 255.0F;
  61. float f3 = (float)(i >> 8 & 255) / 255.0F;
  62. float f4 = (float)(i & 255) / 255.0F;
  63. GL11.glColor3f(f2, f3, f4);
  64. GL11.glPushMatrix();
  65. this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
  66. GL11.glPopMatrix();
  67. GL11.glColor3f(1.0F, 1.0F, 1.0F);
  68. }
  69.  
  70. this.func_77026_a(tessellator, iicon);
  71. GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  72. GL11.glPopMatrix();
  73. }
  74. }
  75.  
  76. /**
  77. * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
  78. */
  79. protected ResourceLocation getEntityTexture(Entity p_110775_1_)
  80. {
  81. return TextureMap.locationItemsTexture;
  82. }
  83.  
  84. private void func_77026_a(Tessellator p_77026_1_, IIcon p_77026_2_)
  85. {
  86. float f = p_77026_2_.getMinU();
  87. float f1 = p_77026_2_.getMaxU();
  88. float f2 = p_77026_2_.getMinV();
  89. float f3 = p_77026_2_.getMaxV();
  90. float f4 = 1.0F;
  91. float f5 = 0.5F;
  92. float f6 = 0.25F;
  93. GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
  94. GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
  95. p_77026_1_.startDrawingQuads();
  96. p_77026_1_.setNormal(0.0F, 1.0F, 0.0F);
  97. p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
  98. p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
  99. p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
  100. p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
  101. p_77026_1_.draw();
  102. }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement