summaryrefslogtreecommitdiffstats
path: root/src/BlockArea.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-10-16 10:06:34 +0200
committerGitHub <noreply@github.com>2019-10-16 10:06:34 +0200
commit221cc4ec5cb6301743e947eaabed3fecedba796f (patch)
tree4e44c8bb7523e5d1d04468fc906ae24674c10abc /src/BlockArea.cpp
parentFixed crash in hopper while pulling items from blockentity above itself (#4412) (diff)
downloadcuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.gz
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.bz2
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.lz
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.xz
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.zst
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.zip
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: