the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "..\Minecraft.World\net.minecraft.world.entity.npc.h"
3#include "VillagerModel.h"
4#include "VillagerRenderer.h"
5
6ResourceLocation VillagerRenderer::VILLAGER_LOCATION = ResourceLocation(TN_MOB_VILLAGER_VILLAGER);
7ResourceLocation VillagerRenderer::VILLAGER_FARMER_LOCATION = ResourceLocation(TN_MOB_VILLAGER_FARMER);
8ResourceLocation VillagerRenderer::VILLAGER_LIBRARIAN_LOCATION = ResourceLocation(TN_MOB_VILLAGER_LIBRARIAN);
9ResourceLocation VillagerRenderer::VILLAGER_PRIEST_LOCATION = ResourceLocation(TN_MOB_VILLAGER_PRIEST);
10ResourceLocation VillagerRenderer::VILLAGER_SMITH_LOCATION = ResourceLocation(TN_MOB_VILLAGER_SMITH);
11ResourceLocation VillagerRenderer::VILLAGER_BUTCHER_LOCATION = ResourceLocation(TN_MOB_VILLAGER_BUTCHER);
12
13VillagerRenderer::VillagerRenderer() : MobRenderer(new VillagerModel(0), 0.5f)
14{
15 villagerModel = (VillagerModel *) model;
16}
17
18int VillagerRenderer::prepareArmor(shared_ptr<LivingEntity> villager, int layer, float a)
19{
20 return -1;
21}
22
23void VillagerRenderer::render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a)
24{
25 MobRenderer::render(mob, x, y, z, rot, a);
26}
27
28ResourceLocation *VillagerRenderer::getTextureLocation(shared_ptr<Entity> _mob)
29{
30 shared_ptr<Villager> mob = dynamic_pointer_cast<Villager>(_mob);
31
32 switch (mob->getProfession())
33 {
34 case Villager::PROFESSION_FARMER:
35 return &VILLAGER_FARMER_LOCATION;
36 case Villager::PROFESSION_LIBRARIAN:
37 return &VILLAGER_LIBRARIAN_LOCATION;
38 case Villager::PROFESSION_PRIEST:
39 return &VILLAGER_PRIEST_LOCATION;
40 case Villager::PROFESSION_SMITH:
41 return &VILLAGER_SMITH_LOCATION;
42 case Villager::PROFESSION_BUTCHER:
43 return &VILLAGER_BUTCHER_LOCATION;
44 default:
45 return &VILLAGER_LOCATION;
46 }
47}
48
49void VillagerRenderer::additionalRendering(shared_ptr<LivingEntity> mob, float a)
50{
51 MobRenderer::additionalRendering(mob, a);
52}
53
54void VillagerRenderer::scale(shared_ptr<LivingEntity> _mob, float a)
55{
56 // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr<Entity> we have here -
57 // do some casting around instead
58 shared_ptr<Villager> mob = dynamic_pointer_cast<Villager>(_mob);
59 float s = 15 / 16.0f;
60 if (mob->getAge() < 0)
61 {
62 s *= 0.5;
63 shadowRadius = 0.25f;
64 } else shadowRadius = 0.5f;
65 glScalef(s, s, s);
66}