summaryrefslogtreecommitdiffstats
path: root/src/BlockArea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/BlockArea.cpp')
-rw-r--r--src/BlockArea.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index 417325c8a..4a07db39b 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -14,6 +14,7 @@
#include "Blocks/BlockHandler.h"
#include "ChunkData.h"
#include "BlockEntities/BlockEntity.h"
+#include "Item.h"
@@ -2215,6 +2216,21 @@ 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)
@@ -2710,6 +2726,20 @@ void cBlockArea::RemoveNonMatchingBlockEntities(void)
+cBlockEntity * cBlockArea::GetBlockEntityRel(Vector3i a_RelPos)
+{
+ if (!HasBlockEntities())
+ {
+ return nullptr;
+ }
+ auto itr = m_BlockEntities->find(MakeIndex(a_RelPos));
+ return (itr == m_BlockEntities->end()) ? nullptr : itr->second;
+}
+
+
+
+
+
////////////////////////////////////////////////////////////////////////////////
// cBlockArea::sBlockEntityDeleter: