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 "NetherStalkTile.h"
3#include "net.minecraft.world.level.h"
4#include "net.minecraft.world.level.biome.h"
5#include "net.minecraft.world.item.h"
6#include "net.minecraft.world.h"
7
8const wstring NetherStalkTile::TEXTURE_NAMES[] = { L"netherStalk_0", L"netherStalk_1", L"netherStalk_2" };
9
10NetherStalkTile::NetherStalkTile(int id) : Bush(id)
11{
12 setTicking(true);
13 updateDefaultShape();
14
15 icons = NULL;
16}
17
18// 4J Added override
19void NetherStalkTile::updateDefaultShape()
20{
21 float ss = 0.5f;
22 this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss);
23}
24
25bool NetherStalkTile::mayPlaceOn(int tile)
26{
27 return tile == Tile::hellSand_Id;
28}
29
30// Brought forward to fix #60073 - TU7: Content: Gameplay: Nether Warts cannot be placed next to each other in the Nether
31bool NetherStalkTile::canSurvive(Level *level, int x, int y, int z)
32{
33 return mayPlaceOn(level->getTile(x, y - 1, z));
34}
35
36void NetherStalkTile::tick(Level *level, int x, int y, int z, Random *random)
37{
38 int age = level->getData(x, y, z);
39 if (age < MAX_AGE)
40 {
41 //Biome *biome = biomeSource->getBiome(x, z);
42 //if (dynamic_cast<HellBiome *>(biome) != NULL)
43 //{
44 if (random->nextInt(10) == 0)
45 {
46 age++;
47 level->setData(x, y, z, age);
48 }
49 //}
50 }
51
52 Bush::tick(level, x, y, z, random);
53}
54
55void NetherStalkTile::growCropsToMax(Level *level, int x, int y, int z)
56{
57 level->setData(x, y, z, MAX_AGE);
58}
59
60Icon *NetherStalkTile::getTexture(int face, int data)
61{
62 if (data >= MAX_AGE)
63 {
64 return icons[2];
65 }
66 if (data > 0)
67 {
68 return icons[1];
69 }
70 return icons[0];
71}
72
73int NetherStalkTile::getRenderShape()
74{
75 return Tile::SHAPE_ROWS;
76}
77
78void NetherStalkTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus)
79{
80 if (level->isClientSide)
81 {
82 return;
83 }
84 int count = 1;
85 if (data >= MAX_AGE)
86 {
87 count = 2 + level->random->nextInt(3);
88 if (playerBonus > 0)
89 {
90 count += level->random->nextInt(playerBonus + 1);
91 }
92 }
93 for (int i = 0; i < count; i++)
94 {
95 popResource(level, x, y, z, shared_ptr<ItemInstance>(new ItemInstance(Item::netherStalkSeeds)));
96 }
97}
98
99int NetherStalkTile::getResource(int data, Random *random, int playerBonusLevel)
100{
101 return 0;
102}
103
104int NetherStalkTile::getResourceCount(Random *random)
105{
106 return 0;
107}
108
109int NetherStalkTile::cloneTileId(Level *level, int x, int y, int z)
110{
111 return Item::netherStalkSeeds_Id;
112}
113
114void NetherStalkTile::registerIcons(IconRegister *iconRegister)
115{
116 icons = new Icon*[NETHER_STALK_TEXTURE_COUNT];
117
118 for (int i = 0; i < NETHER_STALK_TEXTURE_COUNT; i++)
119 {
120 icons[i] = iconRegister->registerIcon(TEXTURE_NAMES[i]);
121 }
122}