MobAppearance .java

net.minecraft.client.particle.MobAppearance (class): members: entity, getFXLayer, renderParticle, Factory, onUpdate. imports: RenderManager, OpenGlHelper.

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

API Surface (4)

int getFXLayer()
void onUpdate()
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_)

Fields & Constants (1)

entity

Full Source

MobAppearance.java88 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.OpenGlHelper;
6
import net.minecraft.client.renderer.WorldRenderer;
7
import net.minecraft.client.renderer.entity.RenderManager;
8
import net.minecraft.entity.Entity;
9
import net.minecraft.entity.EntityLivingBase;
10
import net.minecraft.entity.monster.EntityGuardian;
11
import net.minecraft.util.MathHelper;
12
import net.minecraft.world.World;
13
14
public class MobAppearance extends EntityFX
15
{
16
    private EntityLivingBase entity;
17
18
    protected MobAppearance(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn)
19
    {
20
        super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D);
21
        this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
22
        this.motionX = this.motionY = this.motionZ = 0.0D;
23
        this.particleGravity = 0.0F;
24
        this.particleMaxAge = 30;
25
    }
26
27
    public int getFXLayer()
28
    {
29
        return 3;
30
    }
31
32
    /**
33
     * Called to update the entity's position/logic.
34
     */
35
    public void onUpdate()
36
    {
37
        super.onUpdate();
38
39
        if (this.entity == null)
40
        {
41
            EntityGuardian entityguardian = new EntityGuardian(this.worldObj);
42
            entityguardian.setElder();
43
            this.entity = entityguardian;
44
        }
45
    }
46
47
    /**
48
     * Renders the particle
49
     */
50
    public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
51
    {
52
        if (this.entity != null)
53
        {
54
            RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
55
            rendermanager.setRenderPosition(EntityFX.interpPosX, EntityFX.interpPosY, EntityFX.interpPosZ);
56
            float f = 0.42553192F;
57
            float f1 = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
58
            GlStateManager.depthMask(true);
59
            GlStateManager.enableBlend();
60
            GlStateManager.enableDepth();
61
            GlStateManager.blendFunc(770, 771);
62
            float f2 = 240.0F;
63
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f2, f2);
64
            GlStateManager.pushMatrix();
65
            float f3 = 0.05F + 0.5F * MathHelper.sin(f1 * (float)Math.PI);
66
            GlStateManager.color(1.0F, 1.0F, 1.0F, f3);
67
            GlStateManager.translate(0.0F, 1.8F, 0.0F);
68
            GlStateManager.rotate(180.0F - entityIn.rotationYaw, 0.0F, 1.0F, 0.0F);
69
            GlStateManager.rotate(60.0F - 150.0F * f1 - entityIn.rotationPitch, 1.0F, 0.0F, 0.0F);
70
            GlStateManager.translate(0.0F, -0.4F, -1.5F);
71
            GlStateManager.scale(f, f, f);
72
            this.entity.rotationYaw = this.entity.prevRotationYaw = 0.0F;
73
            this.entity.rotationYawHead = this.entity.prevRotationYawHead = 0.0F;
74
            rendermanager.renderEntityWithPosYaw(this.entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks);
75
            GlStateManager.popMatrix();
76
            GlStateManager.enableDepth();
77
        }
78
    }
79
80
    public static class Factory implements IParticleFactory
81
    {
82
        public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
83
        {
84
            return new MobAppearance(worldIn, xCoordIn, yCoordIn, zCoordIn);
85
        }
86
    }
87
}
88

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