summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbibo38 <bibo38@github.com>2015-11-05 21:57:30 +0100
committerbibo38 <bibo38@github.com>2015-11-07 17:23:02 +0100
commit0447af8bcba4394387c339945f020fb023b6eb5e (patch)
tree2c61d282b5c7dfecbe409af9cd872ea60d2ba244
parentCommented the GetDirectionVec method (diff)
downloadcuberite-0447af8bcba4394387c339945f020fb023b6eb5e.tar
cuberite-0447af8bcba4394387c339945f020fb023b6eb5e.tar.gz
cuberite-0447af8bcba4394387c339945f020fb023b6eb5e.tar.bz2
cuberite-0447af8bcba4394387c339945f020fb023b6eb5e.tar.lz
cuberite-0447af8bcba4394387c339945f020fb023b6eb5e.tar.xz
cuberite-0447af8bcba4394387c339945f020fb023b6eb5e.tar.zst
cuberite-0447af8bcba4394387c339945f020fb023b6eb5e.zip
-rw-r--r--src/Blocks/BlockPiston.cpp10
-rw-r--r--src/Blocks/BlockPiston.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp
index baf3b3e9c..25fb0edee 100644
--- a/src/Blocks/BlockPiston.cpp
+++ b/src/Blocks/BlockPiston.cpp
@@ -32,7 +32,7 @@ void cBlockPistonHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorld
{
NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
- const Vector3i pushDir = GetDirectionVec(OldMeta);
+ const Vector3i pushDir = VectorFromMetaData(OldMeta);
int newX = a_BlockX + pushDir.x;
int newY = a_BlockY + pushDir.y;
int newZ = a_BlockZ + pushDir.z;
@@ -73,7 +73,7 @@ bool cBlockPistonHandler::GetPlacementBlockTypeMeta(
-Vector3i cBlockPistonHandler::GetDirectionVec(int a_PistonMeta)
+Vector3i cBlockPistonHandler::VectorFromMetaData(int a_PistonMeta)
{
switch (a_PistonMeta & 0x07)
{
@@ -214,7 +214,7 @@ void cBlockPistonHandler::ExtendPiston(int a_BlockX, int a_BlockY, int a_BlockZ,
return;
}
- Vector3i pushDir = GetDirectionVec(pistonMeta);
+ Vector3i pushDir = VectorFromMetaData(pistonMeta);
std::unordered_set<Vector3i, VectorHasher<int>> blocksPushed;
if (!CanPushBlock(a_BlockX + pushDir.x, a_BlockY + pushDir.y, a_BlockZ + pushDir.z,
@@ -253,7 +253,7 @@ void cBlockPistonHandler::RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ
return;
}
- Vector3i pushDir = GetDirectionVec(pistonMeta);
+ Vector3i pushDir = VectorFromMetaData(pistonMeta);
// Check the extension:
if (a_World->GetBlock(a_BlockX + pushDir.x, a_BlockY + pushDir.y, a_BlockZ + pushDir.z) != E_BLOCK_PISTON_EXTENSION)
@@ -312,7 +312,7 @@ void cBlockPistonHeadHandler::OnDestroyedByPlayer(cChunkInterface & a_ChunkInter
{
NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
- Vector3i pushDir = cBlockPistonHandler::GetDirectionVec(OldMeta);
+ Vector3i pushDir = cBlockPistonHandler::VectorFromMetaData(OldMeta);
int newX = a_BlockX - pushDir.x;
int newY = a_BlockY - pushDir.y;
int newZ = a_BlockZ - pushDir.z;
diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h
index 0001a5787..418af6d27 100644
--- a/src/Blocks/BlockPiston.h
+++ b/src/Blocks/BlockPiston.h
@@ -84,7 +84,7 @@ public:
/** This method converts the magic piston metadata into a direction vector.
This vector has a length of 1 and points into the direction, in which the piston will extend.
*/
- static Vector3i GetDirectionVec(int a_PistonMeta);
+ static Vector3i VectorFromMetaData(int a_PistonMeta);
static void ExtendPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
static void RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);