EntityLavaFX .java

net.minecraft.client.particle.EntityLavaFX (class): members: lavaParticleScale, getBrightness, getBrightnessForRender, renderParticle, Factory, onUpdate.

net.minecraft.client.particleclass98 linesclientextends EntityFX3.3 KB

API Surface (5)

int getBrightnessForRender(float partialTicks)
float getBrightness(float partialTicks)
void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
void onUpdate()
EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)

Fields & Constants (1)

lavaParticleScale

Code Graph: Dependencies (7)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

EntityLavaFX.java98 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.particle;
2
3
import net.minecraft.client.renderer.WorldRenderer;
4
import net.minecraft.entity.Entity;
5
import net.minecraft.util.EnumParticleTypes;
6
import net.minecraft.util.MathHelper;
7
import net.minecraft.world.World;
8
9
public class EntityLavaFX extends EntityFX
10
{
11
    private float lavaParticleScale;
12
13
    protected EntityLavaFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn)
14
    {
15
        super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
16
        this.motionX *= 0.800000011920929D;
17
        this.motionY *= 0.800000011920929D;
18
        this.motionZ *= 0.800000011920929D;
19
        this.motionY = (double)(this.rand.nextFloat() * 0.4F + 0.05F);
20
        this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
21
        this.particleScale *= this.rand.nextFloat() * 2.0F + 0.2F;
22
        this.lavaParticleScale = this.particleScale;
23
        this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
24
        this.noClip = false;
25
        this.setParticleTextureIndex(49);
26
    }
27
28
    public int getBrightnessForRender(float partialTicks)
29
    {
30
        float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
31
        f = MathHelper.clamp_float(f, 0.0F, 1.0F);
32
        int i = super.getBrightnessForRender(partialTicks);
33
        int j = 240;
34
        int k = i >> 16 & 255;
35
        return j | k << 16;
36
    }
37
38
    /**
39
     * Gets how bright this entity is.
40
     */
41
    public float getBrightness(float partialTicks)
42
    {
43
        return 1.0F;
44
    }
45
46
    /**
47
     * Renders the particle
48
     */
49
    public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
50
    {
51
        float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
52
        this.particleScale = this.lavaParticleScale * (1.0F - f * f);
53
        super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
54
    }
55
56
    /**
57
     * Called to update the entity's position/logic.
58
     */
59
    public void onUpdate()
60
    {
61
        this.prevPosX = this.posX;
62
        this.prevPosY = this.posY;
63
        this.prevPosZ = this.posZ;
64
65
        if (this.particleAge++ >= this.particleMaxAge)
66
        {
67
            this.setDead();
68
        }
69
70
        float f = (float)this.particleAge / (float)this.particleMaxAge;
71
72
        if (this.rand.nextFloat() > f)
73
        {
74
            this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, new int[0]);
75
        }
76
77
        this.motionY -= 0.03D;
78
        this.moveEntity(this.motionX, this.motionY, this.motionZ);
79
        this.motionX *= 0.9990000128746033D;
80
        this.motionY *= 0.9990000128746033D;
81
        this.motionZ *= 0.9990000128746033D;
82
83
        if (this.onGround)
84
        {
85
            this.motionX *= 0.699999988079071D;
86
            this.motionZ *= 0.699999988079071D;
87
        }
88
    }
89
90
    public static class Factory implements IParticleFactory
91
    {
92
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
93
        {
94
            return new EntityLavaFX(worldIn, xCoordIn, yCoordIn, zCoordIn);
95
        }
96
    }
97
}
98

Deobfuscated MCP 1.8.9 source of EntityLavaFX from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/particle/EntityLavaFX.java), stored verbatim.