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 "LiquidTileStatic.h"
4#include "FireTile.h"
5
6LiquidTileStatic::LiquidTileStatic(int id, Material *material) : LiquidTile(id, material)
7{
8 setTicking(false);
9 if (material == Material::lava) setTicking(true);
10}
11
12bool LiquidTileStatic::isPathfindable(LevelSource *level, int x, int y, int z)
13{
14 return material != Material::lava;
15}
16
17void LiquidTileStatic::neighborChanged(Level *level, int x, int y, int z, int type)
18{
19 LiquidTile::neighborChanged(level, x, y, z, type);
20 if (level->getTile(x, y, z) == id)
21 {
22 setDynamic(level, x, y, z);
23 }
24}
25
26void LiquidTileStatic::setDynamic(Level *level, int x, int y, int z)
27{
28 int d = level->getData(x, y, z);
29 level->setTileAndData(x, y, z, id - 1, d, Tile::UPDATE_CLIENTS);
30 level->addToTickNextTick(x, y, z, id - 1, getTickDelay(level));
31}
32
33void LiquidTileStatic::tick(Level *level, int x, int y, int z, Random *random)
34{
35 if (material == Material::lava)
36 {
37 int h = random->nextInt(3);
38 for (int i = 0; i < h; i++)
39 {
40 x += random->nextInt(3) - 1;
41 y++;
42 z += random->nextInt(3) - 1;
43 int t = level->getTile(x, y, z);
44 if (t == 0)
45 {
46 if (isFlammable(level, x - 1, y, z) ||
47 isFlammable(level, x + 1, y, z) ||
48 isFlammable(level, x, y, z - 1) ||
49 isFlammable(level, x, y, z + 1) ||
50 isFlammable(level, x, y - 1, z) ||
51 isFlammable(level, x, y + 1, z))
52 {
53 level->setTileAndUpdate(x, y, z, Tile::fire_Id);
54 return;
55 }
56 }
57 else if (Tile::tiles[t]->material->blocksMotion())
58 {
59 return;
60 }
61
62 }
63 if (h == 0)
64 {
65 int ox = x;
66 int oz = z;
67 for (int i = 0; i< 3; i++)
68 {
69 x = ox + random->nextInt(3) - 1;
70 z = oz + random->nextInt(3) - 1;
71 if (level->isEmptyTile(x, y + 1, z) && isFlammable(level, x, y, z))
72 {
73 level->setTileAndUpdate(x, y + 1, z, Tile::fire_Id);
74 }
75 }
76 }
77 }
78}
79
80bool LiquidTileStatic::isFlammable(Level *level, int x, int y, int z)
81{
82 return level->getMaterial(x, y, z)->isFlammable();
83}