summaryrefslogtreecommitdiffstats
path: root/src/BlockArea.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-09-20 15:50:52 +0200
committerGitHub <noreply@github.com>2020-09-20 15:50:52 +0200
commit68cced73afe546328cf94ed07c57deee47bfadec (patch)
tree88be88e3fd4a208b9849e526f1877caa44058ab5 /src/BlockArea.cpp
parentAdded armor and shulker box cleaning (#4875) (diff)
downloadcuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.gz
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.bz2
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.lz
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.xz
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.zst
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.zip
Diffstat (limited to '')
-rw-r--r--src/BlockArea.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index 4aa5175f2..1e70fc9ba 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -1067,7 +1067,7 @@ void cBlockArea::RotateCCW(void)
auto NewIdx = MakeIndexForSize({ NewX, y, NewZ }, { m_Size.z, m_Size.y, m_Size.x });
auto OldIdx = MakeIndex(x, y, z);
NewTypes[NewIdx] = m_BlockTypes[OldIdx];
- NewMetas[NewIdx] = BlockHandler(m_BlockTypes[OldIdx])->MetaRotateCCW(m_BlockMetas[OldIdx]);
+ NewMetas[NewIdx] = cBlockHandler::For(m_BlockTypes[OldIdx]).MetaRotateCCW(m_BlockMetas[OldIdx]);
} // for y
} // for z
} // for x
@@ -1127,7 +1127,7 @@ void cBlockArea::RotateCW(void)
auto NewIdx = MakeIndexForSize({ NewX, y, NewZ }, { m_Size.z, m_Size.y, m_Size.x });
auto OldIdx = MakeIndex(x, y, z);
NewTypes[NewIdx] = m_BlockTypes[OldIdx];
- NewMetas[NewIdx] = BlockHandler(m_BlockTypes[OldIdx])->MetaRotateCW(m_BlockMetas[OldIdx]);
+ NewMetas[NewIdx] = cBlockHandler::For(m_BlockTypes[OldIdx]).MetaRotateCW(m_BlockMetas[OldIdx]);
} // for y
} // for z
} // for x
@@ -1185,8 +1185,8 @@ void cBlockArea::MirrorXY(void)
auto Idx1 = MakeIndex(x, y, z);
auto Idx2 = MakeIndex(x, y, MaxZ - z);
std::swap(m_BlockTypes[Idx1], m_BlockTypes[Idx2]);
- NIBBLETYPE Meta1 = BlockHandler(m_BlockTypes[Idx2])->MetaMirrorXY(m_BlockMetas[Idx1]);
- NIBBLETYPE Meta2 = BlockHandler(m_BlockTypes[Idx1])->MetaMirrorXY(m_BlockMetas[Idx2]);
+ NIBBLETYPE Meta1 = cBlockHandler::For(m_BlockTypes[Idx2]).MetaMirrorXY(m_BlockMetas[Idx1]);
+ NIBBLETYPE Meta2 = cBlockHandler::For(m_BlockTypes[Idx1]).MetaMirrorXY(m_BlockMetas[Idx2]);
m_BlockMetas[Idx1] = Meta2;
m_BlockMetas[Idx2] = Meta1;
} // for x
@@ -1242,8 +1242,8 @@ void cBlockArea::MirrorXZ(void)
auto Idx1 = MakeIndex(x, y, z);
auto Idx2 = MakeIndex(x, MaxY - y, z);
std::swap(m_BlockTypes[Idx1], m_BlockTypes[Idx2]);
- NIBBLETYPE Meta1 = BlockHandler(m_BlockTypes[Idx2])->MetaMirrorXZ(m_BlockMetas[Idx1]);
- NIBBLETYPE Meta2 = BlockHandler(m_BlockTypes[Idx1])->MetaMirrorXZ(m_BlockMetas[Idx2]);
+ NIBBLETYPE Meta1 = cBlockHandler::For(m_BlockTypes[Idx2]).MetaMirrorXZ(m_BlockMetas[Idx1]);
+ NIBBLETYPE Meta2 = cBlockHandler::For(m_BlockTypes[Idx1]).MetaMirrorXZ(m_BlockMetas[Idx2]);
m_BlockMetas[Idx1] = Meta2;
m_BlockMetas[Idx2] = Meta1;
} // for x
@@ -1299,8 +1299,8 @@ void cBlockArea::MirrorYZ(void)
auto Idx1 = MakeIndex(x, y, z);
auto Idx2 = MakeIndex(MaxX - x, y, z);
std::swap(m_BlockTypes[Idx1], m_BlockTypes[Idx2]);
- NIBBLETYPE Meta1 = BlockHandler(m_BlockTypes[Idx2])->MetaMirrorYZ(m_BlockMetas[Idx1]);
- NIBBLETYPE Meta2 = BlockHandler(m_BlockTypes[Idx1])->MetaMirrorYZ(m_BlockMetas[Idx2]);
+ NIBBLETYPE Meta1 = cBlockHandler::For(m_BlockTypes[Idx2]).MetaMirrorYZ(m_BlockMetas[Idx1]);
+ NIBBLETYPE Meta2 = cBlockHandler::For(m_BlockTypes[Idx1]).MetaMirrorYZ(m_BlockMetas[Idx2]);
m_BlockMetas[Idx1] = Meta2;
m_BlockMetas[Idx2] = Meta1;
} // for x
@@ -2204,21 +2204,6 @@ bool cBlockArea::ForEachBlockEntity(cBlockEntityCallback a_Callback)
-cItems cBlockArea::PickupsFromBlock(Vector3i a_AbsPos, const cEntity * a_Digger, const cItem * a_Tool)
-{
- auto relPos = a_AbsPos - m_Origin;
- BLOCKTYPE blockType;
- NIBBLETYPE blockMeta;
- GetRelBlockTypeMeta(relPos.x, relPos.y, relPos.z, blockType, blockMeta);
- auto blockEntity = GetBlockEntityRel(relPos);
- auto handler = BlockHandler(blockType);
- return handler->ConvertToPickups(blockMeta, blockEntity, a_Digger, a_Tool);
-}
-
-
-
-
-
void cBlockArea::SetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Value, NIBBLETYPE * a_Array)
{
if (a_Array == nullptr)