RenderVillager .java

net.minecraft.client.renderer.entity.RenderVillager (class, 77 lines): members: librarianVillagerTextures, butcherVillagerTextures, farmerVillagerTextures.

net.minecraft.client.renderer.entityclass77 linesclientextends RenderLiving<EntityVillager>2.6 KB

API Surface (3)

ModelVillager getMainModel()
ResourceLocation getEntityTexture(EntityVillager entity)
void preRenderCallback(EntityVillager entitylivingbaseIn, float partialTickTime)

Fields & Constants (6)

villagerTextures
farmerVillagerTextures
librarianVillagerTextures
priestVillagerTextures
smithVillagerTextures
butcherVillagerTextures

String literals (6)

"textures/entity/villager/villager.png"
"textures/entity/villager/farmer.png"
"textures/entity/villager/librarian.png"
"textures/entity/villager/priest.png"
"textures/entity/villager/smith.png"
"textures/entity/villager/butcher.png"

Full Source

RenderVillager.java77 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.renderer.entity;
2
3
import net.minecraft.client.model.ModelVillager;
4
import net.minecraft.client.renderer.GlStateManager;
5
import net.minecraft.client.renderer.entity.layers.LayerCustomHead;
6
import net.minecraft.entity.passive.EntityVillager;
7
import net.minecraft.util.ResourceLocation;
8
9
public class RenderVillager extends RenderLiving<EntityVillager>
10
{
11
    private static final ResourceLocation villagerTextures = new ResourceLocation("textures/entity/villager/villager.png");
12
    private static final ResourceLocation farmerVillagerTextures = new ResourceLocation("textures/entity/villager/farmer.png");
13
    private static final ResourceLocation librarianVillagerTextures = new ResourceLocation("textures/entity/villager/librarian.png");
14
    private static final ResourceLocation priestVillagerTextures = new ResourceLocation("textures/entity/villager/priest.png");
15
    private static final ResourceLocation smithVillagerTextures = new ResourceLocation("textures/entity/villager/smith.png");
16
    private static final ResourceLocation butcherVillagerTextures = new ResourceLocation("textures/entity/villager/butcher.png");
17
18
    public RenderVillager(RenderManager renderManagerIn)
19
    {
20
        super(renderManagerIn, new ModelVillager(0.0F), 0.5F);
21
        this.addLayer(new LayerCustomHead(this.getMainModel().villagerHead));
22
    }
23
24
    public ModelVillager getMainModel()
25
    {
26
        return (ModelVillager)super.getMainModel();
27
    }
28
29
    /**
30
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
31
     */
32
    protected ResourceLocation getEntityTexture(EntityVillager entity)
33
    {
34
        switch (entity.getProfession())
35
        {
36
            case 0:
37
                return farmerVillagerTextures;
38
39
            case 1:
40
                return librarianVillagerTextures;
41
42
            case 2:
43
                return priestVillagerTextures;
44
45
            case 3:
46
                return smithVillagerTextures;
47
48
            case 4:
49
                return butcherVillagerTextures;
50
51
            default:
52
                return villagerTextures;
53
        }
54
    }
55
56
    /**
57
     * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
58
     * entityLiving, partialTickTime
59
     */
60
    protected void preRenderCallback(EntityVillager entitylivingbaseIn, float partialTickTime)
61
    {
62
        float f = 0.9375F;
63
64
        if (entitylivingbaseIn.getGrowingAge() < 0)
65
        {
66
            f = (float)((double)f * 0.5D);
67
            this.shadowSize = 0.25F;
68
        }
69
        else
70
        {
71
            this.shadowSize = 0.5F;
72
        }
73
74
        GlStateManager.scale(f, f, f);
75
    }
76
}
77

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