EntityBreakingFX .java

net.minecraft.client.particle.EntityBreakingFX (class): members: SnowballFactory, SlimeFactory, getFXLayer, renderParticle, Factory. imports: Minecraft.

net.minecraft.client.particleclass99 linesclientextends EntityFX5.4 KB

API Surface (5)

int getFXLayer()
void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
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_)

Full Source

EntityBreakingFX.java99 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.particle;
2
3
import net.minecraft.client.Minecraft;
4
import net.minecraft.client.renderer.WorldRenderer;
5
import net.minecraft.entity.Entity;
6
import net.minecraft.init.Blocks;
7
import net.minecraft.init.Items;
8
import net.minecraft.item.Item;
9
import net.minecraft.world.World;
10
11
public class EntityBreakingFX extends EntityFX
12
{
13
    protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1195_8_)
14
    {
15
        this(worldIn, posXIn, posYIn, posZIn, p_i1195_8_, 0);
16
    }
17
18
    protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_, int p_i1197_15_)
19
    {
20
        this(worldIn, posXIn, posYIn, posZIn, p_i1197_14_, p_i1197_15_);
21
        this.motionX *= 0.10000000149011612D;
22
        this.motionY *= 0.10000000149011612D;
23
        this.motionZ *= 0.10000000149011612D;
24
        this.motionX += xSpeedIn;
25
        this.motionY += ySpeedIn;
26
        this.motionZ += zSpeedIn;
27
    }
28
29
    protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_, int p_i1196_9_)
30
    {
31
        super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D);
32
        this.setParticleIcon(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_, p_i1196_9_));
33
        this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
34
        this.particleGravity = Blocks.snow.blockParticleGravity;
35
        this.particleScale /= 2.0F;
36
    }
37
38
    public int getFXLayer()
39
    {
40
        return 1;
41
    }
42
43
    /**
44
     * Renders the particle
45
     */
46
    public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
47
    {
48
        float f = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
49
        float f1 = f + 0.015609375F;
50
        float f2 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
51
        float f3 = f2 + 0.015609375F;
52
        float f4 = 0.1F * this.particleScale;
53
54
        if (this.particleIcon != null)
55
        {
56
            f = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
57
            f1 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
58
            f2 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
59
            f3 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
60
        }
61
62
        float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
63
        float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
64
        float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
65
        int i = this.getBrightnessForRender(partialTicks);
66
        int j = i >> 16 & 65535;
67
        int k = i & 65535;
68
        worldRendererIn.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
69
        worldRendererIn.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
70
        worldRendererIn.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
71
        worldRendererIn.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
72
    }
73
74
    public static class Factory implements IParticleFactory
75
    {
76
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
77
        {
78
            int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0;
79
            return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Item.getItemById(p_178902_15_[0]), i);
80
        }
81
    }
82
83
    public static class SlimeFactory implements IParticleFactory
84
    {
85
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
86
        {
87
            return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.slime_ball);
88
        }
89
    }
90
91
    public static class SnowballFactory implements IParticleFactory
92
    {
93
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
94
        {
95
            return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.snowball);
96
        }
97
    }
98
}
99

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