EntityCloudFX .java

net.minecraft.client.particle.EntityCloudFX (class): members: field_70569_a, renderParticle, Factory, onUpdate. imports: WorldRenderer, MathHelper, Entity.

net.minecraft.client.particleclass86 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)

field_70569_a

Code Graph: Dependencies (7)

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

Full Source

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

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