EntitySmokeFX .java

net.minecraft.client.particle.EntitySmokeFX (class): members: smokeParticleScale, renderParticle, Factory, onUpdate. imports: WorldRenderer, MathHelper.

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

API Surface (3)

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)

smokeParticleScale

Code Graph: Dependencies (6)

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

Full Source

EntitySmokeFX.java89 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 EntitySmokeFX extends EntityFX
9
{
10
    float smokeParticleScale;
11
12
    private EntitySmokeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46347_8_, double p_i46347_10_, double p_i46347_12_)
13
    {
14
        this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46347_8_, p_i46347_10_, p_i46347_12_, 1.0F);
15
    }
16
17
    protected EntitySmokeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46348_8_, double p_i46348_10_, double p_i46348_12_, float p_i46348_14_)
18
    {
19
        super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
20
        this.motionX *= 0.10000000149011612D;
21
        this.motionY *= 0.10000000149011612D;
22
        this.motionZ *= 0.10000000149011612D;
23
        this.motionX += p_i46348_8_;
24
        this.motionY += p_i46348_10_;
25
        this.motionZ += p_i46348_12_;
26
        this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D);
27
        this.particleScale *= 0.75F;
28
        this.particleScale *= p_i46348_14_;
29
        this.smokeParticleScale = this.particleScale;
30
        this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
31
        this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46348_14_);
32
        this.noClip = false;
33
    }
34
35
    /**
36
     * Renders the particle
37
     */
38
    public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
39
    {
40
        float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
41
        f = MathHelper.clamp_float(f, 0.0F, 1.0F);
42
        this.particleScale = this.smokeParticleScale * f;
43
        super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
44
    }
45
46
    /**
47
     * Called to update the entity's position/logic.
48
     */
49
    public void onUpdate()
50
    {
51
        this.prevPosX = this.posX;
52
        this.prevPosY = this.posY;
53
        this.prevPosZ = this.posZ;
54
55
        if (this.particleAge++ >= this.particleMaxAge)
56
        {
57
            this.setDead();
58
        }
59
60
        this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
61
        this.motionY += 0.004D;
62
        this.moveEntity(this.motionX, this.motionY, this.motionZ);
63
64
        if (this.posY == this.prevPosY)
65
        {
66
            this.motionX *= 1.1D;
67
            this.motionZ *= 1.1D;
68
        }
69
70
        this.motionX *= 0.9599999785423279D;
71
        this.motionY *= 0.9599999785423279D;
72
        this.motionZ *= 0.9599999785423279D;
73
74
        if (this.onGround)
75
        {
76
            this.motionX *= 0.699999988079071D;
77
            this.motionZ *= 0.699999988079071D;
78
        }
79
    }
80
81
    public static class Factory implements IParticleFactory
82
    {
83
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
84
        {
85
            return new EntitySmokeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
86
        }
87
    }
88
}
89

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