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 "TheEndPortalFrameTile.h"
3#include "net.minecraft.world.level.h"
4#include "net.minecraft.world.level.redstone.h"
5#include "net.minecraft.world.h"
6#include "Facing.h"
7
8const wstring TheEndPortalFrameTile::TEXTURE_EYE = L"endframe_eye";
9
10TheEndPortalFrameTile::TheEndPortalFrameTile(int id) : Tile(id, Material::glass, isSolidRender() )
11{
12 iconTop = NULL;
13 iconEye = NULL;
14}
15
16Icon *TheEndPortalFrameTile::getTexture(int face, int data)
17{
18 if (face == Facing::UP)
19 {
20 return iconTop;
21 }
22 if (face == Facing::DOWN)
23 {
24 return Tile::endStone->getTexture(face);
25 }
26 return icon;
27}
28
29void TheEndPortalFrameTile::registerIcons(IconRegister *iconRegister)
30{
31 icon = iconRegister->registerIcon(L"endframe_side");
32 iconTop = iconRegister->registerIcon(L"endframe_top");
33 iconEye = iconRegister->registerIcon(L"endframe_eye");
34}
35
36Icon *TheEndPortalFrameTile::getEye()
37{
38 return iconEye;
39}
40
41bool TheEndPortalFrameTile::isSolidRender(bool isServerLevel)
42{
43 return false;
44}
45
46int TheEndPortalFrameTile::getRenderShape()
47{
48 return SHAPE_PORTAL_FRAME;
49}
50
51void TheEndPortalFrameTile::updateDefaultShape()
52{
53 setShape(0, 0, 0, 1, 13.0f / 16.0f, 1);
54}
55
56void TheEndPortalFrameTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source)
57{
58 setShape(0, 0, 0, 1, 13.0f / 16.0f, 1);
59 Tile::addAABBs(level, x, y, z, box, boxes, source);
60
61 int data = level->getData(x, y, z);
62 if (hasEye(data))
63 {
64 setShape(5.0f / 16.0f, 13.0f / 16.0f, 5.0f / 16.0f, 11.0f / 16.0f, 1, 11.0f / 16.0f);
65 Tile::addAABBs(level, x, y, z, box, boxes, source);
66 }
67 updateDefaultShape();
68}
69
70bool TheEndPortalFrameTile::hasEye(int data)
71{
72 return (data & EYE_BIT) != 0;
73}
74
75int TheEndPortalFrameTile::getResource(int data, Random *random, int playerBonusLevel)
76{
77 return 0;
78}
79
80void TheEndPortalFrameTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr<LivingEntity> by, shared_ptr<ItemInstance> itemInstance)
81{
82 int dir = (((Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3) + 2) % 4;
83 level->setData(x, y, z, dir, Tile::UPDATE_CLIENTS);
84}
85
86bool TheEndPortalFrameTile::hasAnalogOutputSignal()
87{
88 return true;
89}
90
91int TheEndPortalFrameTile::getAnalogOutputSignal(Level *level, int x, int y, int z, int dir)
92{
93 int data = level->getData(x, y, z);
94
95 if (hasEye(data))
96 {
97 return Redstone::SIGNAL_MAX;
98 }
99 else
100 {
101 return Redstone::SIGNAL_NONE;
102 }
103}