aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h
blob: 5e99cc320ebf492a159d965d6a98eae04df62042 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include "Tile_SPU.h"

class FenceGateTile_SPU : public Tile_SPU
{
private:
	static const int DIRECTION_MASK = 3;
    static const int OPEN_BIT = 4;

public:
	FenceGateTile_SPU(int id) : Tile_SPU(id) {}
	Icon_SPU *getTexture(int face, int data) { 	return TileRef_SPU(wood_Id)->getTexture(face); }
	static int getDirection(int data)	{ return (data & DIRECTION_MASK); }

	virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param // Brought forward from 1.2.3
	{
		int data = getDirection(level->getData(x, y, z));
		if (data == Direction::NORTH || data == Direction::SOUTH)
		{
			setShape(0, 0, 6.0f / 16.0f, 1, 1.0f, 10.0f / 16.0f);
		}
		else
		{
			setShape(6.0f / 16.0f, 0, 0, 10.0f / 16.0f, 1.0f, 1);
		}
	}
    virtual bool blocksLight() { return false; }
    virtual bool isSolidRender(bool isServerLevel = false) { return false; }
    virtual int getRenderShape() { return Tile_SPU::SHAPE_FENCE_GATE; }
	virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face){	return true;	}
	static bool isOpen(int data) { 	return (data & OPEN_BIT) != 0; }
};