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