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 "net.minecraft.world.level.h"
3#include "net.minecraft.world.level.tile.h"
4#include "net.minecraft.world.phys.h"
5#include "FlyingMob.h"
6
7FlyingMob::FlyingMob(Level *level) : Mob( level )
8{
9}
10
11void FlyingMob::causeFallDamage(float distance)
12{
13 // this method is empty because flying creatures should
14 // not trigger the "fallOn" tile calls (such as trampling crops)
15}
16
17void FlyingMob::checkFallDamage(double ya, bool onGround)
18{
19 // this method is empty because flying creatures should
20 // not trigger the "fallOn" tile calls (such as trampling crops)
21}
22
23void FlyingMob::travel(float xa, float ya)
24{
25 if (isInWater())
26 {
27 moveRelative(xa, ya, 0.02f);
28 move(xd, yd, zd);
29
30 xd *= 0.80f;
31 yd *= 0.80f;
32 zd *= 0.80f;
33 }
34 else if (isInLava())
35 {
36 moveRelative(xa, ya, 0.02f);
37 move(xd, yd, zd);
38 xd *= 0.50f;
39 yd *= 0.50f;
40 zd *= 0.50f;
41 }
42 else
43 {
44 float friction = 0.91f;
45 if (onGround)
46 {
47 friction = 0.6f * 0.91f;
48 int t = level->getTile( Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z));
49 if (t > 0)
50 {
51 friction = Tile::tiles[t]->friction * 0.91f;
52 }
53 }
54
55 float friction2 = (0.6f * 0.6f * 0.91f * 0.91f * 0.6f * 0.91f) / (friction * friction * friction);
56 moveRelative(xa, ya, (onGround ? 0.1f * friction2 : 0.02f));
57
58 friction = 0.91f;
59 if (onGround)
60 {
61 friction = 0.6f * 0.91f;
62 int t = level->getTile( Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z));
63 if (t > 0)
64 {
65 friction = Tile::tiles[t]->friction * 0.91f;
66 }
67 }
68
69 move(xd, yd, zd);
70
71 xd *= friction;
72 yd *= friction;
73 zd *= friction;
74 }
75 walkAnimSpeedO = walkAnimSpeed;
76 double xxd = x - xo;
77 double zzd = z - zo;
78 float wst = (float) sqrt(xxd * xxd + zzd * zzd) * 4;
79 if (wst > 1) wst = 1;
80 walkAnimSpeed += (wst - walkAnimSpeed) * 0.4f;
81 walkAnimPos += walkAnimSpeed;
82}
83
84bool FlyingMob::onLadder()
85{
86 return false;
87}