EntityEnchantmentTableParticleFX .java

net.minecraft.client.particle.EntityEnchantmentTableParticleFX (class): members: EnchantmentTable, field_70565_a, coordX, coordY, coordZ, getBrightness.

net.minecraft.client.particleclass95 linesclientextends EntityFX3.1 KB

API Surface (4)

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 (4)

field_70565_a
coordX
coordY
coordZ

Code Graph: Dependencies (3)

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

Full Source

EntityEnchantmentTableParticleFX.java95 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.particle;
2
3
import net.minecraft.world.World;
4
5
public class EntityEnchantmentTableParticleFX extends EntityFX
6
{
7
    private float field_70565_a;
8
    private double coordX;
9
    private double coordY;
10
    private double coordZ;
11
12
    protected EntityEnchantmentTableParticleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
13
    {
14
        super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
15
        this.motionX = xSpeedIn;
16
        this.motionY = ySpeedIn;
17
        this.motionZ = zSpeedIn;
18
        this.coordX = xCoordIn;
19
        this.coordY = yCoordIn;
20
        this.coordZ = zCoordIn;
21
        this.posX = this.prevPosX = xCoordIn + xSpeedIn;
22
        this.posY = this.prevPosY = yCoordIn + ySpeedIn;
23
        this.posZ = this.prevPosZ = zCoordIn + zSpeedIn;
24
        float f = this.rand.nextFloat() * 0.6F + 0.4F;
25
        this.field_70565_a = this.particleScale = this.rand.nextFloat() * 0.5F + 0.2F;
26
        this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f;
27
        this.particleGreen *= 0.9F;
28
        this.particleRed *= 0.9F;
29
        this.particleMaxAge = (int)(Math.random() * 10.0D) + 30;
30
        this.noClip = true;
31
        this.setParticleTextureIndex((int)(Math.random() * 26.0D + 1.0D + 224.0D));
32
    }
33
34
    public int getBrightnessForRender(float partialTicks)
35
    {
36
        int i = super.getBrightnessForRender(partialTicks);
37
        float f = (float)this.particleAge / (float)this.particleMaxAge;
38
        f = f * f;
39
        f = f * f;
40
        int j = i & 255;
41
        int k = i >> 16 & 255;
42
        k = k + (int)(f * 15.0F * 16.0F);
43
44
        if (k > 240)
45
        {
46
            k = 240;
47
        }
48
49
        return j | k << 16;
50
    }
51
52
    /**
53
     * Gets how bright this entity is.
54
     */
55
    public float getBrightness(float partialTicks)
56
    {
57
        float f = super.getBrightness(partialTicks);
58
        float f1 = (float)this.particleAge / (float)this.particleMaxAge;
59
        f1 = f1 * f1;
60
        f1 = f1 * f1;
61
        return f * (1.0F - f1) + f1;
62
    }
63
64
    /**
65
     * Called to update the entity's position/logic.
66
     */
67
    public void onUpdate()
68
    {
69
        this.prevPosX = this.posX;
70
        this.prevPosY = this.posY;
71
        this.prevPosZ = this.posZ;
72
        float f = (float)this.particleAge / (float)this.particleMaxAge;
73
        f = 1.0F - f;
74
        float f1 = 1.0F - f;
75
        f1 = f1 * f1;
76
        f1 = f1 * f1;
77
        this.posX = this.coordX + this.motionX * (double)f;
78
        this.posY = this.coordY + this.motionY * (double)f - (double)(f1 * 1.2F);
79
        this.posZ = this.coordZ + this.motionZ * (double)f;
80
81
        if (this.particleAge++ >= this.particleMaxAge)
82
        {
83
            this.setDead();
84
        }
85
    }
86
87
    public static class EnchantmentTable implements IParticleFactory
88
    {
89
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
90
        {
91
            return new EntityEnchantmentTableParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
92
        }
93
    }
94
}
95

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