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 "Entity.h"
3#include "EntityPos.h"
4
5EntityPos::EntityPos(double x, double y, double z, float yRot, float xRot)
6{
7 this->x = x;
8 this->y = y;
9 this->z = z;
10 this->yRot = yRot;
11 this->xRot = xRot;
12 rot = true;
13 move = true;
14}
15
16EntityPos::EntityPos(double x, double y, double z)
17{
18 yRot = xRot = 0.0f;
19
20 this->x = x;
21 this->y = y;
22 this->z = z;
23 move = true;
24 rot = false;
25}
26
27EntityPos::EntityPos(float yRot, float xRot)
28{
29 x = y = z = 0.0;
30
31 this->yRot = yRot;
32 this->xRot = xRot;
33 rot = true;
34 move = false;
35}
36
37EntityPos *EntityPos::lerp(shared_ptr<Entity> e, float f)
38{
39 double xd = e->x+(x-e->x)*f;
40 double yd = e->y+(y-e->y)*f;
41 double zd = e->z+(z-e->z)*f;
42
43 float yrdd = Mth::wrapDegrees(yRot - e->yRot);
44 float xrdd = Mth::wrapDegrees(xRot - e->xRot);
45
46 float yrd = Mth::wrapDegrees(e->yRot + yrdd * f);
47 float xrd = Mth::wrapDegrees(e->xRot + xrdd * f);
48
49 if (rot && move)
50 {
51 return new EntityPos(xd, yd, zd, yrd, xrd);
52 }
53 if (move)
54 {
55 return new EntityPos(xd, yd, zd);
56 }
57 if (rot)
58 {
59 return new EntityPos(yrd, xrd);
60 }
61 return NULL;
62}