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.ambient.h"
3#include "BatRenderer.h"
4#include "BatModel.h"
5
6ResourceLocation BatRenderer::BAT_LOCATION = ResourceLocation(TN_MOB_BAT);
7
8BatRenderer::BatRenderer() : MobRenderer(new BatModel(), 0.25f)
9{
10 modelVersion = ((BatModel *)model)->modelVersion();
11}
12
13void BatRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
14{
15 int modelVersion = (dynamic_cast<BatModel*>(model))->modelVersion();
16 if (modelVersion != this->modelVersion) {
17 this->modelVersion = modelVersion;
18 model = new BatModel();
19 }
20 MobRenderer::render(_mob, x, y, z, rot, a);
21}
22
23ResourceLocation *BatRenderer::getTextureLocation(shared_ptr<Entity> mob)
24{
25 return &BAT_LOCATION;
26}
27
28void BatRenderer::scale(shared_ptr<LivingEntity> mob, float a)
29{
30 glScalef(.35f, .35f, .35f);
31}
32
33void BatRenderer::setupPosition(shared_ptr<LivingEntity> mob, double x, double y, double z)
34{
35 MobRenderer::setupPosition(mob, x, y, z);
36}
37
38void BatRenderer::setupRotations(shared_ptr<LivingEntity> _mob, float bob, float bodyRot, float a)
39{
40 shared_ptr<Bat> mob = dynamic_pointer_cast<Bat>(_mob);
41 if (!mob->isResting())
42 {
43 glTranslatef(0, cos(bob * .3f) * .1f, 0);
44 }
45 else
46 {
47 glTranslatef(0, -.1f, 0);
48 }
49 MobRenderer::setupRotations(mob, bob, bodyRot, a);
50}