aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/TheEndPortalFrameTile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.World/TheEndPortalFrameTile.cpp')
-rw-r--r--Minecraft.World/TheEndPortalFrameTile.cpp56
1 files changed, 38 insertions, 18 deletions
diff --git a/Minecraft.World/TheEndPortalFrameTile.cpp b/Minecraft.World/TheEndPortalFrameTile.cpp
index cab8319f..f7b10a05 100644
--- a/Minecraft.World/TheEndPortalFrameTile.cpp
+++ b/Minecraft.World/TheEndPortalFrameTile.cpp
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "TheEndPortalFrameTile.h"
#include "net.minecraft.world.level.h"
+#include "net.minecraft.world.level.redstone.h"
#include "net.minecraft.world.h"
#include "Facing.h"
@@ -14,15 +15,15 @@ TheEndPortalFrameTile::TheEndPortalFrameTile(int id) : Tile(id, Material::glass,
Icon *TheEndPortalFrameTile::getTexture(int face, int data)
{
- if (face == Facing::UP)
+ if (face == Facing::UP)
{
- return iconTop;
- }
- if (face == Facing::DOWN)
+ return iconTop;
+ }
+ if (face == Facing::DOWN)
{
- return Tile::whiteStone->getTexture(face);
- }
- return icon;
+ return Tile::endStone->getTexture(face);
+ }
+ return icon;
}
void TheEndPortalFrameTile::registerIcons(IconRegister *iconRegister)
@@ -54,16 +55,16 @@ void TheEndPortalFrameTile::updateDefaultShape()
void TheEndPortalFrameTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source)
{
- setShape(0, 0, 0, 1, 13.0f / 16.0f, 1);
- Tile::addAABBs(level, x, y, z, box, boxes, source);
+ setShape(0, 0, 0, 1, 13.0f / 16.0f, 1);
+ Tile::addAABBs(level, x, y, z, box, boxes, source);
- int data = level->getData(x, y, z);
- if (hasEye(data))
+ int data = level->getData(x, y, z);
+ if (hasEye(data))
{
- setShape(5.0f / 16.0f, 13.0f / 16.0f, 5.0f / 16.0f, 11.0f / 16.0f, 1, 11.0f / 16.0f);
- Tile::addAABBs(level, x, y, z, box, boxes, source);
- }
- updateDefaultShape();
+ setShape(5.0f / 16.0f, 13.0f / 16.0f, 5.0f / 16.0f, 11.0f / 16.0f, 1, 11.0f / 16.0f);
+ Tile::addAABBs(level, x, y, z, box, boxes, source);
+ }
+ updateDefaultShape();
}
bool TheEndPortalFrameTile::hasEye(int data)
@@ -76,8 +77,27 @@ int TheEndPortalFrameTile::getResource(int data, Random *random, int playerBonus
return 0;
}
-void TheEndPortalFrameTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr<Mob> by)
+void TheEndPortalFrameTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr<LivingEntity> by, shared_ptr<ItemInstance> itemInstance)
{
- int dir = (((Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3) + 2) % 4;
- level->setData(x, y, z, dir);
+ int dir = (((Mth::floor(by->yRot * 4 / (360) + 0.5)) & 3) + 2) % 4;
+ level->setData(x, y, z, dir, Tile::UPDATE_CLIENTS);
}
+
+bool TheEndPortalFrameTile::hasAnalogOutputSignal()
+{
+ return true;
+}
+
+int TheEndPortalFrameTile::getAnalogOutputSignal(Level *level, int x, int y, int z, int dir)
+{
+ int data = level->getData(x, y, z);
+
+ if (hasEye(data))
+ {
+ return Redstone::SIGNAL_MAX;
+ }
+ else
+ {
+ return Redstone::SIGNAL_NONE;
+ }
+} \ No newline at end of file