2025-03-11 00:23:54 +01:00
|
|
|
package game.renderer.particle;
|
|
|
|
|
2025-03-18 10:14:37 +01:00
|
|
|
import org.lwjgl.opengl.GL13;
|
|
|
|
|
2025-03-11 00:23:54 +01:00
|
|
|
import game.Game;
|
|
|
|
import game.entity.Entity;
|
|
|
|
import game.renderer.GlState;
|
|
|
|
import game.renderer.RenderBuffer;
|
|
|
|
import game.renderer.entity.RenderManager;
|
2025-03-11 10:26:48 +01:00
|
|
|
import game.window.WCF;
|
2025-03-11 00:23:54 +01:00
|
|
|
import game.world.World;
|
|
|
|
|
|
|
|
public class EntityPickupFX extends EntityFX
|
|
|
|
{
|
|
|
|
private Entity field_174840_a;
|
|
|
|
private Entity field_174843_ax;
|
|
|
|
private int age;
|
|
|
|
private int maxAge;
|
|
|
|
private float field_174841_aA;
|
|
|
|
private RenderManager field_174842_aB = Game.getGame().getRenderManager();
|
|
|
|
|
|
|
|
public EntityPickupFX(World worldIn, Entity p_i1233_2_, Entity p_i1233_3_, float p_i1233_4_)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
this.field_174840_a = p_i1233_2_;
|
|
|
|
this.field_174843_ax = p_i1233_3_;
|
|
|
|
this.maxAge = 3;
|
|
|
|
this.field_174841_aA = p_i1233_4_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the particle
|
|
|
|
*/
|
|
|
|
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
|
|
|
|
{
|
|
|
|
float f = ((float)this.age + partialTicks) / (float)this.maxAge;
|
|
|
|
f = f * f;
|
|
|
|
double d0 = this.field_174840_a.posX;
|
|
|
|
double d1 = this.field_174840_a.posY;
|
|
|
|
double d2 = this.field_174840_a.posZ;
|
|
|
|
double d3 = this.field_174843_ax.lastTickPosX + (this.field_174843_ax.posX - this.field_174843_ax.lastTickPosX) * (double)partialTicks;
|
|
|
|
double d4 = this.field_174843_ax.lastTickPosY + (this.field_174843_ax.posY - this.field_174843_ax.lastTickPosY) * (double)partialTicks + (double)this.field_174841_aA;
|
|
|
|
double d5 = this.field_174843_ax.lastTickPosZ + (this.field_174843_ax.posZ - this.field_174843_ax.lastTickPosZ) * (double)partialTicks;
|
|
|
|
double d6 = d0 + (d3 - d0) * (double)f;
|
|
|
|
double d7 = d1 + (d4 - d1) * (double)f;
|
|
|
|
double d8 = d2 + (d5 - d2) * (double)f;
|
|
|
|
int i = this.getBrightnessForRender(partialTicks);
|
|
|
|
int j = i % 65536;
|
|
|
|
int k = i / 65536;
|
2025-03-18 10:14:37 +01:00
|
|
|
WCF.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)j / 1.0F, (float)k / 1.0F);
|
2025-03-11 00:23:54 +01:00
|
|
|
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
|
|
|
d6 = d6 - interpPosX;
|
|
|
|
d7 = d7 - interpPosY;
|
|
|
|
d8 = d8 - interpPosZ;
|
|
|
|
this.field_174842_aB.renderEntity(this.field_174840_a, (double)((float)d6), (double)((float)d7), (double)((float)d8), partialTicks);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called to update the entity's position/logic.
|
|
|
|
*/
|
|
|
|
public void onUpdate()
|
|
|
|
{
|
|
|
|
++this.age;
|
|
|
|
|
|
|
|
if (this.age == this.maxAge)
|
|
|
|
{
|
|
|
|
this.setDead();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getFXLayer()
|
|
|
|
{
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
}
|