EntityFlameFX .java

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

net.minecraft.client.particleclass101 linesclientextends EntityFX3.6 KB

API Surface (5)

void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
int getBrightnessForRender(float partialTicks)
float getBrightness(float partialTicks)
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)

flameScale

Code Graph: Dependencies (6)

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

Full Source

EntityFlameFX.java101 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.MathHelper;
6
import net.minecraft.world.World;
7
8
public class EntityFlameFX extends EntityFX
9
{
10
    /** the scale of the flame FX */
11
    private float flameScale;
12
13
    protected EntityFlameFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
14
    {
15
        super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
16
        this.motionX = this.motionX * 0.009999999776482582D + xSpeedIn;
17
        this.motionY = this.motionY * 0.009999999776482582D + ySpeedIn;
18
        this.motionZ = this.motionZ * 0.009999999776482582D + zSpeedIn;
19
        this.posX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F);
20
        this.posY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F);
21
        this.posZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F);
22
        this.flameScale = this.particleScale;
23
        this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
24
        this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4;
25
        this.noClip = true;
26
        this.setParticleTextureIndex(48);
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.particleAge + partialTicks) / (float)this.particleMaxAge;
35
        this.particleScale = this.flameScale * (1.0F - f * f * 0.5F);
36
        super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
37
    }
38
39
    public int getBrightnessForRender(float partialTicks)
40
    {
41
        float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
42
        f = MathHelper.clamp_float(f, 0.0F, 1.0F);
43
        int i = super.getBrightnessForRender(partialTicks);
44
        int j = i & 255;
45
        int k = i >> 16 & 255;
46
        j = j + (int)(f * 15.0F * 16.0F);
47
48
        if (j > 240)
49
        {
50
            j = 240;
51
        }
52
53
        return j | k << 16;
54
    }
55
56
    /**
57
     * Gets how bright this entity is.
58
     */
59
    public float getBrightness(float partialTicks)
60
    {
61
        float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
62
        f = MathHelper.clamp_float(f, 0.0F, 1.0F);
63
        float f1 = super.getBrightness(partialTicks);
64
        return f1 * f + (1.0F - f);
65
    }
66
67
    /**
68
     * Called to update the entity's position/logic.
69
     */
70
    public void onUpdate()
71
    {
72
        this.prevPosX = this.posX;
73
        this.prevPosY = this.posY;
74
        this.prevPosZ = this.posZ;
75
76
        if (this.particleAge++ >= this.particleMaxAge)
77
        {
78
            this.setDead();
79
        }
80
81
        this.moveEntity(this.motionX, this.motionY, this.motionZ);
82
        this.motionX *= 0.9599999785423279D;
83
        this.motionY *= 0.9599999785423279D;
84
        this.motionZ *= 0.9599999785423279D;
85
86
        if (this.onGround)
87
        {
88
            this.motionX *= 0.699999988079071D;
89
            this.motionZ *= 0.699999988079071D;
90
        }
91
    }
92
93
    public static class Factory implements IParticleFactory
94
    {
95
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
96
        {
97
            return new EntityFlameFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
98
        }
99
    }
100
}
101

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