EntityPortalFX .java

net.minecraft.client.particle.EntityPortalFX (class, 104 lines): members: portalParticleScale, portalPosX, portalPosY, portalPosZ, getBrightness, Factory.

net.minecraft.client.particleclass104 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 (4)

portalParticleScale
portalPosX
portalPosY
portalPosZ

Code Graph: Dependencies (5)

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

Full Source

EntityPortalFX.java104 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.world.World;
6
7
public class EntityPortalFX extends EntityFX
8
{
9
    private float portalParticleScale;
10
    private double portalPosX;
11
    private double portalPosY;
12
    private double portalPosZ;
13
14
    protected EntityPortalFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
15
    {
16
        super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
17
        this.motionX = xSpeedIn;
18
        this.motionY = ySpeedIn;
19
        this.motionZ = zSpeedIn;
20
        this.portalPosX = this.posX = xCoordIn;
21
        this.portalPosY = this.posY = yCoordIn;
22
        this.portalPosZ = this.posZ = zCoordIn;
23
        float f = this.rand.nextFloat() * 0.6F + 0.4F;
24
        this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F;
25
        this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f;
26
        this.particleGreen *= 0.3F;
27
        this.particleRed *= 0.9F;
28
        this.particleMaxAge = (int)(Math.random() * 10.0D) + 40;
29
        this.noClip = true;
30
        this.setParticleTextureIndex((int)(Math.random() * 8.0D));
31
    }
32
33
    /**
34
     * Renders the particle
35
     */
36
    public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
37
    {
38
        float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
39
        f = 1.0F - f;
40
        f = f * f;
41
        f = 1.0F - f;
42
        this.particleScale = this.portalParticleScale * f;
43
        super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
44
    }
45
46
    public int getBrightnessForRender(float partialTicks)
47
    {
48
        int i = super.getBrightnessForRender(partialTicks);
49
        float f = (float)this.particleAge / (float)this.particleMaxAge;
50
        f = f * f;
51
        f = f * f;
52
        int j = i & 255;
53
        int k = i >> 16 & 255;
54
        k = k + (int)(f * 15.0F * 16.0F);
55
56
        if (k > 240)
57
        {
58
            k = 240;
59
        }
60
61
        return j | k << 16;
62
    }
63
64
    /**
65
     * Gets how bright this entity is.
66
     */
67
    public float getBrightness(float partialTicks)
68
    {
69
        float f = super.getBrightness(partialTicks);
70
        float f1 = (float)this.particleAge / (float)this.particleMaxAge;
71
        f1 = f1 * f1 * f1 * f1;
72
        return f * (1.0F - f1) + f1;
73
    }
74
75
    /**
76
     * Called to update the entity's position/logic.
77
     */
78
    public void onUpdate()
79
    {
80
        this.prevPosX = this.posX;
81
        this.prevPosY = this.posY;
82
        this.prevPosZ = this.posZ;
83
        float f = (float)this.particleAge / (float)this.particleMaxAge;
84
        f = -f + f * f * 2.0F;
85
        f = 1.0F - f;
86
        this.posX = this.portalPosX + this.motionX * (double)f;
87
        this.posY = this.portalPosY + this.motionY * (double)f + (double)(1.0F - f);
88
        this.posZ = this.portalPosZ + this.motionZ * (double)f;
89
90
        if (this.particleAge++ >= this.particleMaxAge)
91
        {
92
            this.setDead();
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 EntityPortalFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
101
        }
102
    }
103
}
104

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