summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/BlockEntity.h
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2020-04-03 23:23:38 +0200
committerGitHub <noreply@github.com>2020-04-03 23:23:38 +0200
commitaac592f98598aae327d07b2a1bb155e33c6d51b1 (patch)
tree24f90211d753a7ec87585e919ef7c7acdfa49909 /src/BlockEntities/BlockEntity.h
parentNew hotfix to prevent calling OnBroken (#4600) (diff)
downloadcuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.gz
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.bz2
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.lz
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.xz
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.zst
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.zip
Diffstat (limited to 'src/BlockEntities/BlockEntity.h')
-rw-r--r--src/BlockEntities/BlockEntity.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h
index cb377422e..2617edfb6 100644
--- a/src/BlockEntities/BlockEntity.h
+++ b/src/BlockEntities/BlockEntity.h
@@ -1,6 +1,7 @@
#pragma once
+#include <unordered_map>
@@ -31,6 +32,10 @@
class cChunk;
class cPlayer;
class cWorld;
+class cBlockEntity;
+
+using OwnedBlockEntity = std::unique_ptr<cBlockEntity>;
+using cBlockEntities = std::unordered_map<size_t, OwnedBlockEntity>;
@@ -73,11 +78,11 @@ public:
/** Creates a new block entity for the specified block type at the specified absolute pos.
If a_World is valid, then the entity is created bound to that world
Returns nullptr for unknown block types. */
- static cBlockEntity * CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World = nullptr);
+ static OwnedBlockEntity CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World = nullptr);
/** Makes an exact copy of this block entity, except for its m_World (set to nullptr), and at a new position.
Uses CopyFrom() to copy the properties. */
- cBlockEntity * Clone(Vector3i a_Pos);
+ OwnedBlockEntity Clone(Vector3i a_Pos);
/** Copies all properties of a_Src into this entity, except for its m_World and location.
Each non-abstract descendant should override to copy its specific properties, and call