| 1 | package net.minecraft.client.particle;
|
| 2 |
|
| 3 | import net.minecraft.client.Minecraft;
|
| 4 | import net.minecraft.client.renderer.GlStateManager;
|
| 5 | import net.minecraft.client.renderer.OpenGlHelper;
|
| 6 | import net.minecraft.client.renderer.WorldRenderer;
|
| 7 | import net.minecraft.client.renderer.entity.RenderManager;
|
| 8 | import net.minecraft.entity.Entity;
|
| 9 | import net.minecraft.world.World;
|
| 10 |
|
| 11 | public class EntityPickupFX extends EntityFX
|
| 12 | {
|
| 13 | private Entity field_174840_a;
|
| 14 | private Entity field_174843_ax;
|
| 15 | private int age;
|
| 16 | private int maxAge;
|
| 17 | private float field_174841_aA;
|
| 18 | private RenderManager field_174842_aB = Minecraft.getMinecraft().getRenderManager();
|
| 19 |
|
| 20 | public EntityPickupFX(World worldIn, Entity p_i1233_2_, Entity p_i1233_3_, float p_i1233_4_)
|
| 21 | {
|
| 22 | super(worldIn, p_i1233_2_.posX, p_i1233_2_.posY, p_i1233_2_.posZ, p_i1233_2_.motionX, p_i1233_2_.motionY, p_i1233_2_.motionZ);
|
| 23 | this.field_174840_a = p_i1233_2_;
|
| 24 | this.field_174843_ax = p_i1233_3_;
|
| 25 | this.maxAge = 3;
|
| 26 | this.field_174841_aA = p_i1233_4_;
|
| 27 | }
|
| 28 |
|
| 29 | /**
|
| 30 | * Renders the particle
|
| 31 | */
|
| 32 | public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
| 33 | {
|
| 34 | float f = ((float)this.age + partialTicks) / (float)this.maxAge;
|
| 35 | f = f * f;
|
| 36 | double d0 = this.field_174840_a.posX;
|
| 37 | double d1 = this.field_174840_a.posY;
|
| 38 | double d2 = this.field_174840_a.posZ;
|
| 39 | double d3 = this.field_174843_ax.lastTickPosX + (this.field_174843_ax.posX - this.field_174843_ax.lastTickPosX) * (double)partialTicks;
|
| 40 | double d4 = this.field_174843_ax.lastTickPosY + (this.field_174843_ax.posY - this.field_174843_ax.lastTickPosY) * (double)partialTicks + (double)this.field_174841_aA;
|
| 41 | double d5 = this.field_174843_ax.lastTickPosZ + (this.field_174843_ax.posZ - this.field_174843_ax.lastTickPosZ) * (double)partialTicks;
|
| 42 | double d6 = d0 + (d3 - d0) * (double)f;
|
| 43 | double d7 = d1 + (d4 - d1) * (double)f;
|
| 44 | double d8 = d2 + (d5 - d2) * (double)f;
|
| 45 | int i = this.getBrightnessForRender(partialTicks);
|
| 46 | int j = i % 65536;
|
| 47 | int k = i / 65536;
|
| 48 | OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
|
| 49 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 50 | d6 = d6 - interpPosX;
|
| 51 | d7 = d7 - interpPosY;
|
| 52 | d8 = d8 - interpPosZ;
|
| 53 | this.field_174842_aB.renderEntityWithPosYaw(this.field_174840_a, (double)((float)d6), (double)((float)d7), (double)((float)d8), this.field_174840_a.rotationYaw, partialTicks);
|
| 54 | }
|
| 55 |
|
| 56 | /**
|
| 57 | * Called to update the entity's position/logic.
|
| 58 | */
|
| 59 | public void onUpdate()
|
| 60 | {
|
| 61 | ++this.age;
|
| 62 |
|
| 63 | if (this.age == this.maxAge)
|
| 64 | {
|
| 65 | this.setDead();
|
| 66 | }
|
| 67 | }
|
| 68 |
|
| 69 | public int getFXLayer()
|
| 70 | {
|
| 71 | return 3;
|
| 72 | }
|
| 73 | }
|
| 74 |
|