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 "com.mojang.nbt.h"
3#include "net.minecraft.world.level.tile.h"
4#include "net.minecraft.world.phys.h"
5#include "net.minecraft.world.level.h"
6#include "net.minecraft.world.damagesource.h"
7#include "WaterAnimal.h"
8
9
10
11WaterAnimal::WaterAnimal(Level *level) : PathfinderMob( level )
12{
13 // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that
14 // the derived version of the function is called
15
16 // This should only be called for the most derive classes
17 //this->defineSynchedData();
18}
19
20bool WaterAnimal::isWaterMob()
21{
22 return true; //prevent drowning
23}
24
25bool WaterAnimal::canSpawn()
26{
27 return level->isUnobstructed(bb);
28}
29
30int WaterAnimal::getAmbientSoundInterval()
31{
32 return 20 * 6;
33}
34
35bool WaterAnimal::removeWhenFarAway()
36{
37 return true;
38}
39
40int WaterAnimal::getExperienceReward(shared_ptr<Player> killedBy)
41{
42 return 1 + level->random->nextInt(3);
43}
44
45void WaterAnimal::baseTick()
46{
47 int airSupply = getAirSupply();
48
49 PathfinderMob::baseTick(); // this modified the airsupply
50
51 if (isAlive() && !isInWater())
52 {
53 setAirSupply(--airSupply);
54 if (getAirSupply() == -20)
55 {
56 setAirSupply(0);
57 hurt(DamageSource::drown, 2);
58 }
59 }
60 else
61 {
62 setAirSupply(TOTAL_AIR_SUPPLY);
63 }
64}