aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/StoneSlabTile.cpp
blob: e4de58dab5a116d51e8206e5c7509b60ecc705db (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "stdafx.h"
#include "net.minecraft.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.h"
#include "StoneSlabTile.h"


const unsigned int StoneSlabTile::SLAB_NAMES[SLAB_NAMES_LENGTH] = {	IDS_TILE_STONESLAB_STONE,
													IDS_TILE_STONESLAB_SAND,
													IDS_TILE_STONESLAB_WOOD,
													IDS_TILE_STONESLAB_COBBLE,
													IDS_TILE_STONESLAB_BRICK,
													IDS_TILE_STONESLAB_SMOOTHBRICK,
													IDS_TILE_STONESLAB_NETHERBRICK,
													IDS_TILE_STONESLAB_QUARTZ,
												};

StoneSlabTile::StoneSlabTile(int id, bool fullSize) : HalfSlabTile(id, fullSize, Material::stone)
{
}

Icon *StoneSlabTile::getTexture(int face, int data)
{
	int type = data & TYPE_MASK;
	if (fullSize && (data & TOP_SLOT_BIT) != 0)
	{
		face = Facing::UP;
	}
	switch(type)
	{
	case STONE_SLAB:
		if (face == Facing::UP || face == Facing::DOWN) return icon;
		return iconSide;
		break;	
	case SAND_SLAB:
		return Tile::sandStone->getTexture(face);
	case WOOD_SLAB:
		return Tile::wood->getTexture(face);
	case COBBLESTONE_SLAB:
		return Tile::cobblestone->getTexture(face);
	case BRICK_SLAB:
		return Tile::redBrick->getTexture(face);
	case SMOOTHBRICK_SLAB:
		return Tile::stoneBrick->getTexture(face, SmoothStoneBrickTile::TYPE_DEFAULT);
	case NETHERBRICK_SLAB:
		return Tile::netherBrick->getTexture(Facing::UP);
	case QUARTZ_SLAB:
		return Tile::quartzBlock->getTexture(face);
	}
	
	return icon;
}

void StoneSlabTile::registerIcons(IconRegister *iconRegister)
{
	icon = iconRegister->registerIcon(L"stoneslab_top");
	iconSide = iconRegister->registerIcon(L"stoneslab_side");
}

int StoneSlabTile::getResource(int data, Random *random, int playerBonusLevel)
{
	return Tile::stoneSlabHalf_Id;
}

unsigned int StoneSlabTile::getDescriptionId(int iData /*= -1*/)
{
	if(iData < 0 ) iData = 0;
	return StoneSlabTile::SLAB_NAMES[iData];
}

int StoneSlabTile::getAuxName(int auxValue) 
{
	if (auxValue < 0 || auxValue >= SLAB_NAMES_LENGTH) 
	{
		auxValue = 0;
	}
	return SLAB_NAMES[auxValue];//super.getDescriptionId() + "." + SLAB_NAMES[auxValue];
}

shared_ptr<ItemInstance> StoneSlabTile::getSilkTouchItemInstance(int data)
{
	return shared_ptr<ItemInstance>(new ItemInstance(Tile::stoneSlabHalf_Id, 2, data & TYPE_MASK));
}