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 "BoatRenderer.h"
3#include "BoatModel.h"
4#include "..\Minecraft.World\net.minecraft.world.entity.item.h"
5#include "..\Minecraft.World\Mth.h"
6
7ResourceLocation BoatRenderer::BOAT_LOCATION = ResourceLocation(TN_ITEM_BOAT);
8
9BoatRenderer::BoatRenderer() : EntityRenderer()
10{
11 this->shadowRadius = 0.5f;
12 model = new BoatModel();
13}
14
15void BoatRenderer::render(shared_ptr<Entity> _boat, double x, double y, double z, float rot, float a)
16{
17 // 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr<Entity> we have here -
18 // do some casting around instead
19 shared_ptr<Boat> boat = dynamic_pointer_cast<Boat>(_boat);
20
21 glPushMatrix();
22
23 glTranslatef((float) x, (float) y, (float) z);
24
25 glRotatef(180-rot, 0, 1, 0);
26 float hurt = boat->getHurtTime() - a;
27 float dmg = boat->getDamage() - a;
28 if (dmg<0) dmg = 0;
29 if (hurt>0)
30 {
31 glRotatef(Mth::sin(hurt)*hurt*dmg/10*boat->getHurtDir(), 1, 0, 0);
32 }
33
34 float ss = 12/16.0f;
35 glScalef(ss, ss, ss);
36 glScalef(1/ss, 1/ss, 1/ss);
37
38 bindTexture(boat);
39 glScalef(-1, -1, 1);
40 model->render(boat, 0, 0, -0.1f, 0, 0, 1 / 16.0f, true);
41 glPopMatrix();
42}
43
44ResourceLocation *BoatRenderer::getTextureLocation(shared_ptr<Entity> mob)
45{
46 return &BOAT_LOCATION;
47}