Advertisement
Guest User

Untitled

a guest
Feb 12th, 2014
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package hdr.entity;
  2.  
  3. import hdr.MainData;
  4. import cpw.mods.fml.client.FMLClientHandler;
  5. import cpw.mods.fml.relauncher.Side;
  6. import cpw.mods.fml.relauncher.SideOnly;
  7. import net.minecraft.client.Minecraft;
  8. import net.minecraft.client.particle.EntityFX;
  9. import net.minecraft.client.renderer.Tessellator;
  10. import net.minecraft.util.ResourceLocation;
  11. import net.minecraft.world.World;
  12.  
  13. public class EntityLorienLeaveFallFX extends EntityFX {
  14.  
  15. public EntityLorienLeaveFallFX(World par1World, double par2, double par4, double par6, float par8, float par9, float par10)
  16. {
  17. this(par1World, par2, par4, par6, 1.0F, par8, par9, par10);
  18. }
  19. public EntityLorienLeaveFallFX(World par1World, double par2, double par4, double par6, float par8, float par9, float par10, float par11)
  20. {
  21. super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
  22. this.motionX = par9;//initial motion value X
  23. this.motionY = par10;//initial motion value Y
  24. this.motionZ = par11;//initial motion value Z
  25. if (par9 == 0.0F)
  26. {
  27. par9 = 1.0F;
  28. }
  29. float var12 = (float)Math.random() * 0.4F + 0.6F;
  30. this.particleTextureIndexX = 0; //
  31. this.particleTextureIndexY = 1;
  32. this.particleRed = 1.0F;//RGB of your particle
  33. this.particleGreen = 1.0F;
  34. this.particleBlue = 1.0F;
  35. this.particleScale *= 3.4F;
  36. this.particleScale *= par8;
  37. this.particleMaxAge = 80;//how soon the particle dies. You can use randomizer for this
  38. this.noClip = true;//does your particle collide with blocks?
  39. }
  40.  
  41. @Override
  42. public void onUpdate()
  43. {
  44. this.prevPosX = this.posX;
  45. this.prevPosY = this.posY;
  46. this.prevPosZ = this.posZ;
  47.  
  48. if (this.particleAge++ >= this.particleMaxAge)
  49. {
  50. this.setDead();
  51. }
  52.  
  53. if (!this.onGround) { this.motionY -= 0.002D; }
  54. this.moveEntity(this.motionX, this.motionY, this.motionZ);
  55.  
  56. if (this.posY == this.prevPosY)
  57. {
  58. this.motionX *= 1.1D;
  59. this.motionZ *= 1.1D;
  60. }
  61.  
  62. this.motionX *= 0.9599999785423279D;
  63. this.motionY *= 0.9599999785423279D;
  64. this.motionZ *= 0.9599999785423279D;
  65.  
  66. if (this.onGround || this.isCollidedHorizontally)
  67. {
  68. this.motionX *= 0.0D;
  69. this.motionZ *= 0.0D;
  70. this.setDead();
  71. }
  72. }
  73. @Override
  74. @SideOnly(Side.CLIENT)
  75. public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
  76. {
  77. float f6 = 2 * ((float)this.particleTextureIndexX / 16.0F);
  78. float f7 = 2 * (f6 + 0.0624375F);
  79. float f8 = 2 * ((float)this.particleTextureIndexY / 16.0F);
  80. float f9 = 2 * (f8 + 0.0624375F);
  81. float f10 = 0.1F * this.particleScale;
  82.  
  83. if (this.particleIcon != null)
  84. {
  85. f6 = this.particleIcon.getMinU();
  86. f7 = this.particleIcon.getMaxU();
  87. f8 = this.particleIcon.getMinV();
  88. f9 = this.particleIcon.getMaxV();
  89. }
  90.  
  91. float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
  92. float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
  93. float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
  94. float f14 = 1.0F;
  95. par1Tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
  96. par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
  97. par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
  98. par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
  99. par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
  100. par1Tessellator.draw();
  101. Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(MainData.modid + ":" + "textures/particle/particles.png"));
  102. par1Tessellator.startDrawingQuads();
  103. par1Tessellator.setBrightness(200);//make sure you have this!!
  104. par1Tessellator.draw();
  105. Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(MainData.modid + ":" + "textures/particle/particles.png"));
  106. par1Tessellator.startDrawingQuads();
  107. }
  108.  
  109. }
Advertisement
RAW Paste Data Copied
Advertisement