EntityFootStepFX .java

net.minecraft.client.particle.EntityFootStepFX (class): members: FOOTPRINT_TEXTURE, currentFootSteps, footstepMaxAge, footstepAge, getFXLayer, Factory.

net.minecraft.client.particleclass89 linesclientextends EntityFX3.4 KB

API Surface (4)

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

FOOTPRINT_TEXTURE
footstepAge
footstepMaxAge
currentFootSteps

String literals (1)

"textures/particle/footprint.png"

Full Source

EntityFootStepFX.java89 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.GlStateManager;
5
import net.minecraft.client.renderer.Tessellator;
6
import net.minecraft.client.renderer.WorldRenderer;
7
import net.minecraft.client.renderer.texture.TextureManager;
8
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
9
import net.minecraft.entity.Entity;
10
import net.minecraft.util.BlockPos;
11
import net.minecraft.util.ResourceLocation;
12
import net.minecraft.world.World;
13
14
public class EntityFootStepFX extends EntityFX
15
{
16
    private static final ResourceLocation FOOTPRINT_TEXTURE = new ResourceLocation("textures/particle/footprint.png");
17
    private int footstepAge;
18
    private int footstepMaxAge;
19
    private TextureManager currentFootSteps;
20
21
    protected EntityFootStepFX(TextureManager currentFootStepsIn, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn)
22
    {
23
        super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
24
        this.currentFootSteps = currentFootStepsIn;
25
        this.motionX = this.motionY = this.motionZ = 0.0D;
26
        this.footstepMaxAge = 200;
27
    }
28
29
    /**
30
     * Renders the particle
31
     */
32
    public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
33
    {
34
        float f = ((float)this.footstepAge + partialTicks) / (float)this.footstepMaxAge;
35
        f = f * f;
36
        float f1 = 2.0F - f * 2.0F;
37
38
        if (f1 > 1.0F)
39
        {
40
            f1 = 1.0F;
41
        }
42
43
        f1 = f1 * 0.2F;
44
        GlStateManager.disableLighting();
45
        float f2 = 0.125F;
46
        float f3 = (float)(this.posX - interpPosX);
47
        float f4 = (float)(this.posY - interpPosY);
48
        float f5 = (float)(this.posZ - interpPosZ);
49
        float f6 = this.worldObj.getLightBrightness(new BlockPos(this));
50
        this.currentFootSteps.bindTexture(FOOTPRINT_TEXTURE);
51
        GlStateManager.enableBlend();
52
        GlStateManager.blendFunc(770, 771);
53
        worldRendererIn.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
54
        worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(0.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
55
        worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(1.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
56
        worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(1.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
57
        worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(0.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
58
        Tessellator.getInstance().draw();
59
        GlStateManager.disableBlend();
60
        GlStateManager.enableLighting();
61
    }
62
63
    /**
64
     * Called to update the entity's position/logic.
65
     */
66
    public void onUpdate()
67
    {
68
        ++this.footstepAge;
69
70
        if (this.footstepAge == this.footstepMaxAge)
71
        {
72
            this.setDead();
73
        }
74
    }
75
76
    public int getFXLayer()
77
    {
78
        return 3;
79
    }
80
81
    public static class Factory implements IParticleFactory
82
    {
83
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
84
        {
85
            return new EntityFootStepFX(Minecraft.getMinecraft().getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn);
86
        }
87
    }
88
}
89

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