Guest User

RenderWandBolt

a guest
Nov 1st, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. package wop;
  2.  
  3. import javax.swing.Icon;
  4.  
  5. import net.minecraft.client.renderer.Tessellator;
  6. import net.minecraft.client.renderer.entity.Render;
  7. import net.minecraft.client.renderer.texture.TextureMap;
  8. import net.minecraft.entity.Entity;
  9. import net.minecraft.entity.projectile.EntityPotion;
  10. import net.minecraft.item.Item;
  11. import net.minecraft.item.ItemPotion;
  12. import net.minecraft.potion.PotionHelper;
  13. import net.minecraft.util.IIcon;
  14. import net.minecraft.util.ResourceLocation;
  15.  
  16. import org.lwjgl.opengl.GL11;
  17. import org.lwjgl.opengl.GL12;
  18.  
  19. import wop.items.EntityWandBolt;
  20. import wop.lib.Constants;
  21. import cpw.mods.fml.relauncher.Side;
  22. import cpw.mods.fml.relauncher.SideOnly;
  23.  
  24. @SideOnly(Side.CLIENT)
  25. public class RenderWandBolt extends Render
  26. {
  27. private Item field_94151_a;
  28. private int field_94150_f;
  29.  
  30. public RenderWandBolt(Item par1Item, int par2)
  31. {
  32. this.field_94151_a = par1Item;
  33. this.field_94150_f = par2;
  34. }
  35.  
  36. public RenderWandBolt(Item par1Item)
  37. {
  38. this(par1Item, 0);
  39. }
  40.  
  41. //ResourceLocations are typically static and final, but that is not an absolute requirement
  42. private static final ResourceLocation texture = new ResourceLocation("wop/textures/entity/magic_Pro.png");
  43.  
  44.  
  45. @Override
  46. protected ResourceLocation getEntityTexture(Entity entity) {
  47. //this method should return your texture, which may be different based
  48. //on certain characteristics of your custom entity; if that is the case,
  49. //you may want to make a second method that takes your class:
  50. return texture;
  51. }
  52.  
  53. private void func_77026_a(Tessellator p_77026_1_, IIcon p_77026_2_)
  54. {
  55. float f = p_77026_2_.getMinU();
  56. float f1 = p_77026_2_.getMaxU();
  57. float f2 = p_77026_2_.getMinV();
  58. float f3 = p_77026_2_.getMaxV();
  59. float f4 = 1.0F;
  60. float f5 = 0.5F;
  61. float f6 = 0.25F;
  62. GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
  63. GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
  64. p_77026_1_.startDrawingQuads();
  65. p_77026_1_.setNormal(0.0F, 1.0F, 0.0F);
  66. p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
  67. p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
  68. p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
  69. p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
  70. p_77026_1_.draw();
  71. }
  72. /**
  73. * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
  74. * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
  75. * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
  76. * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
  77. */
  78. public void doRender(Entity par1Entity, double p2, double p3, double p4, float par8, float par9)
  79. {
  80. IIcon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);
  81.  
  82. if(icon != null) {
  83. GL11.glPushMatrix();
  84. GL11.glTranslatef((float)p2, (float)p3, (float)p4);
  85. GL11.glEnable(GL12.GL_RESCALE_NORMAL);
  86. GL11.glScalef(0.5F, 0.5F, 0.5F);
  87. bindTexture(texture);
  88. Tessellator tessellator = Tessellator.instance;
  89. func_77026_a(tessellator, icon);
  90. GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  91. GL11.glPopMatrix();
  92. }
  93. }
  94.  
  95.  
  96. // For Forge 804:
  97.  
  98.  
  99. // For Forge 871:
  100.  
  101.  
  102.  
  103. }
Advertisement
Add Comment
Please, Sign In to add comment