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.h"
5#include "RedlightTile.h"
6
7RedlightTile::RedlightTile(int id, bool isLit) : Tile(id, Material::buildable_glass)
8{
9 this->isLit = isLit;
10
11 if (isLit)
12 {
13 setLightEmission(1.0f);
14 }
15}
16
17void RedlightTile::registerIcons(IconRegister *iconRegister)
18{
19 if (isLit)
20 {
21 icon = iconRegister->registerIcon(L"redstoneLight_lit");
22 }
23 else
24 {
25 icon = iconRegister->registerIcon(L"redstoneLight");
26 }
27}
28
29void RedlightTile::onPlace(Level *level, int x, int y, int z)
30{
31 if (!level->isClientSide)
32 {
33 if (isLit && !level->hasNeighborSignal(x, y, z))
34 {
35 level->addToTickNextTick(x, y, z, id, 4);
36 }
37 else if (!isLit && level->hasNeighborSignal(x, y, z))
38 {
39 level->setTileAndData(x, y, z, Tile::redstoneLight_lit_Id, 0, UPDATE_CLIENTS);
40 }
41 }
42}
43
44void RedlightTile::neighborChanged(Level *level, int x, int y, int z, int type)
45{
46 if (!level->isClientSide)
47 {
48 if (isLit && !level->hasNeighborSignal(x, y, z))
49 {
50 level->addToTickNextTick(x, y, z, id, 4);
51 }
52 else if (!isLit && level->hasNeighborSignal(x, y, z))
53 {
54 level->setTileAndData(x, y, z, Tile::redstoneLight_lit_Id, 0, UPDATE_CLIENTS);
55 }
56 }
57}
58
59void RedlightTile::tick(Level *level, int x, int y, int z, Random *random)
60{
61 if (!level->isClientSide)
62 {
63 if (isLit && !level->hasNeighborSignal(x, y, z))
64 {
65 level->setTileAndData(x, y, z, Tile::redstoneLight_Id, 0, UPDATE_CLIENTS);
66 }
67 }
68}
69
70int RedlightTile::getResource(int data, Random *random, int playerBonusLevel)
71{
72 return Tile::redstoneLight_Id;
73}
74
75int RedlightTile::cloneTileId(Level *level, int x, int y, int z)
76{
77 return Tile::redstoneLight_Id;
78}