summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockPlanks.h
blob: 158b9451da8794e226b540e571ca74634eeffb04 (plain) (blame)
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

#pragma once

#include "BlockHandler.h"





class cBlockPlanksHandler:
	public cBlockHandler
{
	using Super = cBlockHandler;

public:

	using Super::Super;

private:

	virtual bool GetPlacementBlockTypeMeta(
		cChunkInterface & a_ChunkInterface,
		cPlayer & a_Player,
		const Vector3i a_PlacedBlockPos,
		eBlockFace a_ClickedBlockFace,
		const Vector3i a_CursorPos,
		BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
	) const override
	{
		a_BlockType = m_BlockType;
		a_BlockMeta = static_cast<NIBBLETYPE>(a_Player.GetEquippedItem().m_ItemDamage);
		return true;
	}





	virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
	{
		switch (a_Meta)
		{
			case E_META_PLANKS_BIRCH: return 2;
			case E_META_PLANKS_JUNGLE: return 10;
			case E_META_PLANKS_OAK: return 13;
			case E_META_PLANKS_ACACIA: return 15;
			case E_META_PLANKS_DARK_OAK: return 26;
			case E_META_PLANKS_SPRUCE: return 34;
			default:
			{
				ASSERT(!"Unhandled meta in planks handler!");
				return 0;
			}
		}
	}
} ;