BlockHandler initialisation is a constant expression (#4891)
* BlockHandler initialisation is a constant expression If we can't make it all namespaces, this is the next best I guess. + Tag handlers constexpr, const as needed + Inherit constructors * Privatise handler functions * More constexpr Co-authored-by: Alexander Harkness <me@bearbin.net>
This commit is contained in:
@@ -7,16 +7,7 @@
|
||||
|
||||
|
||||
|
||||
cBlockDoorHandler::cBlockDoorHandler(BLOCKTYPE a_BlockType):
|
||||
Super(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cBlockDoorHandler::OnBroken(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta)
|
||||
void cBlockDoorHandler::OnBroken(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta) const
|
||||
{
|
||||
// A part of the multiblock door was broken; the relevant half will drop any pickups as required.
|
||||
// All that is left to do is to delete the other half of the multiblock.
|
||||
@@ -52,7 +43,7 @@ bool cBlockDoorHandler::OnUse(
|
||||
const Vector3i a_BlockPos,
|
||||
eBlockFace a_BlockFace,
|
||||
const Vector3i a_CursorPos
|
||||
)
|
||||
) const
|
||||
{
|
||||
UNUSED(a_WorldInterface);
|
||||
UNUSED(a_BlockFace);
|
||||
@@ -98,7 +89,7 @@ void cBlockDoorHandler::OnCancelRightClick(
|
||||
cPlayer & a_Player,
|
||||
const Vector3i a_BlockPos,
|
||||
eBlockFace a_BlockFace
|
||||
)
|
||||
) const
|
||||
{
|
||||
UNUSED(a_ChunkInterface);
|
||||
UNUSED(a_BlockFace);
|
||||
@@ -122,7 +113,7 @@ void cBlockDoorHandler::OnCancelRightClick(
|
||||
|
||||
|
||||
|
||||
cBoundingBox cBlockDoorHandler::GetPlacementCollisionBox(BLOCKTYPE a_XM, BLOCKTYPE a_XP, BLOCKTYPE a_YM, BLOCKTYPE a_YP, BLOCKTYPE a_ZM, BLOCKTYPE a_ZP)
|
||||
cBoundingBox cBlockDoorHandler::GetPlacementCollisionBox(BLOCKTYPE a_XM, BLOCKTYPE a_XP, BLOCKTYPE a_YM, BLOCKTYPE a_YP, BLOCKTYPE a_ZM, BLOCKTYPE a_ZP) const
|
||||
{
|
||||
// Doors can be placed inside the player
|
||||
return cBoundingBox(0, 0, 0, 0, 0, 0);
|
||||
@@ -132,7 +123,7 @@ cBoundingBox cBlockDoorHandler::GetPlacementCollisionBox(BLOCKTYPE a_XM, BLOCKTY
|
||||
|
||||
|
||||
|
||||
NIBBLETYPE cBlockDoorHandler::MetaRotateCCW(NIBBLETYPE a_Meta)
|
||||
NIBBLETYPE cBlockDoorHandler::MetaRotateCCW(NIBBLETYPE a_Meta) const
|
||||
{
|
||||
if (a_Meta & 0x08)
|
||||
{
|
||||
@@ -150,7 +141,7 @@ NIBBLETYPE cBlockDoorHandler::MetaRotateCCW(NIBBLETYPE a_Meta)
|
||||
|
||||
|
||||
|
||||
NIBBLETYPE cBlockDoorHandler::MetaRotateCW(NIBBLETYPE a_Meta)
|
||||
NIBBLETYPE cBlockDoorHandler::MetaRotateCW(NIBBLETYPE a_Meta) const
|
||||
{
|
||||
if (a_Meta & 0x08)
|
||||
{
|
||||
@@ -168,7 +159,7 @@ NIBBLETYPE cBlockDoorHandler::MetaRotateCW(NIBBLETYPE a_Meta)
|
||||
|
||||
|
||||
|
||||
NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta)
|
||||
NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta) const
|
||||
{
|
||||
/*
|
||||
Top bit (0x08) contains door block position (Top / Bottom). Only Bottom blocks contain position data
|
||||
@@ -202,7 +193,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta)
|
||||
|
||||
|
||||
|
||||
NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta)
|
||||
NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta) const
|
||||
{
|
||||
// Top bit (0x08) contains door panel type (Top / Bottom panel) Only Bottom panels contain position data
|
||||
// Return a_Meta if panel is a top panel (0x08 bit is set to 1)
|
||||
|
||||
Reference in New Issue
Block a user