4 #include "../../Blocks/BlockButton.h"
5 #include "../../Blocks/BlockLever.h"
22 case 0x7:
return { 0, 1, 0 };
23 case 0x1:
return { -1, 0, 0 };
24 case 0x2:
return { 1, 0, 0 };
25 case 0x3:
return { 0, 0, -1 };
26 case 0x4:
return { 0, 0, 1 };
28 case 0x6:
return { 0, -1, 0 };
31 ASSERT(!
"Unhandled lever metadata!");
41 case 0x0:
return { 0, 1, 0 };
42 case 0x1:
return { -1, 0, 0 };
43 case 0x2:
return { 1, 0, 0 };
44 case 0x3:
return { 0, 0, -1 };
45 case 0x4:
return { 0, 0, 1 };
46 case 0x5:
return { 0, -1, 0 };
49 ASSERT(!
"Unhandled button metadata!");
56 ASSERT(!
"Unexpected block passed to button/lever handler");
71 ASSERT(!
"Unexpected block passed to button/lever handler");
81 const auto Meta = a_Chunk.
GetMeta(a_Position);
82 const auto QueryOffset = a_QueryPosition - a_Position;
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
unsigned char Power(const BlockState Block)
static Vector3i GetOffsetAttachedTo(Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta)
static PowerLevel GetPowerDeliveredToPosition(const cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked)
static unsigned char GetPowerLevel(BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta)
static void Update(cChunk &a_Chunk, cChunk &CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, const PowerLevel Power)
static void ForValidSourcePositions(const cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, ForEachSourceCallback &Callback)
static bool IsButtonOn(NIBBLETYPE a_Meta)
Extracts the ON bit from metadata and returns if true if it is set.
static bool IsLeverOn(NIBBLETYPE a_BlockMeta)
Extracts the ON bit from metadata and returns if true if it is set.
NIBBLETYPE GetMeta(int a_RelX, int a_RelY, int a_RelZ) const