EntitySpellParticleFX .java

net.minecraft.client.particle.EntitySpellParticleFX (class): members: setBaseSpellTextureIndex, baseSpellTextureIndex, AmbientMobFactory, InstantFactory.

net.minecraft.client.particleclass136 linesclientextends EntityFX5.3 KB

API Surface (8)

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

Fields & Constants (2)

RANDOM
baseSpellTextureIndex

Code Graph: Dependencies (6)

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

Full Source

EntitySpellParticleFX.java136 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.particle;
2
3
import java.util.Random;
4
import net.minecraft.client.renderer.WorldRenderer;
5
import net.minecraft.entity.Entity;
6
import net.minecraft.util.MathHelper;
7
import net.minecraft.world.World;
8
9
public class EntitySpellParticleFX extends EntityFX
10
{
11
    private static final Random RANDOM = new Random();
12
13
    /** Base spell texture index */
14
    private int baseSpellTextureIndex = 128;
15
16
    protected EntitySpellParticleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double p_i1229_10_, double p_i1229_12_)
17
    {
18
        super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.5D - RANDOM.nextDouble(), p_i1229_10_, 0.5D - RANDOM.nextDouble());
19
        this.motionY *= 0.20000000298023224D;
20
21
        if (p_i1229_8_ == 0.0D && p_i1229_12_ == 0.0D)
22
        {
23
            this.motionX *= 0.10000000149011612D;
24
            this.motionZ *= 0.10000000149011612D;
25
        }
26
27
        this.particleScale *= 0.75F;
28
        this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
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
        super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
40
    }
41
42
    /**
43
     * Called to update the entity's position/logic.
44
     */
45
    public void onUpdate()
46
    {
47
        this.prevPosX = this.posX;
48
        this.prevPosY = this.posY;
49
        this.prevPosZ = this.posZ;
50
51
        if (this.particleAge++ >= this.particleMaxAge)
52
        {
53
            this.setDead();
54
        }
55
56
        this.setParticleTextureIndex(this.baseSpellTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge));
57
        this.motionY += 0.004D;
58
        this.moveEntity(this.motionX, this.motionY, this.motionZ);
59
60
        if (this.posY == this.prevPosY)
61
        {
62
            this.motionX *= 1.1D;
63
            this.motionZ *= 1.1D;
64
        }
65
66
        this.motionX *= 0.9599999785423279D;
67
        this.motionY *= 0.9599999785423279D;
68
        this.motionZ *= 0.9599999785423279D;
69
70
        if (this.onGround)
71
        {
72
            this.motionX *= 0.699999988079071D;
73
            this.motionZ *= 0.699999988079071D;
74
        }
75
    }
76
77
    /**
78
     * Sets the base spell texture index
79
     */
80
    public void setBaseSpellTextureIndex(int baseSpellTextureIndexIn)
81
    {
82
        this.baseSpellTextureIndex = baseSpellTextureIndexIn;
83
    }
84
85
    public static class AmbientMobFactory implements IParticleFactory
86
    {
87
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
88
        {
89
            EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
90
            entityfx.setAlphaF(0.15F);
91
            entityfx.setRBGColorF((float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn);
92
            return entityfx;
93
        }
94
    }
95
96
    public static class Factory implements IParticleFactory
97
    {
98
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
99
        {
100
            return new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
101
        }
102
    }
103
104
    public static class InstantFactory implements IParticleFactory
105
    {
106
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
107
        {
108
            EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
109
            ((EntitySpellParticleFX)entityfx).setBaseSpellTextureIndex(144);
110
            return entityfx;
111
        }
112
    }
113
114
    public static class MobFactory implements IParticleFactory
115
    {
116
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
117
        {
118
            EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
119
            entityfx.setRBGColorF((float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn);
120
            return entityfx;
121
        }
122
    }
123
124
    public static class WitchFactory implements IParticleFactory
125
    {
126
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
127
        {
128
            EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
129
            ((EntitySpellParticleFX)entityfx).setBaseSpellTextureIndex(144);
130
            float f = worldIn.rand.nextFloat() * 0.5F + 0.35F;
131
            entityfx.setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f);
132
            return entityfx;
133
        }
134
    }
135
}
136

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