diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-04-30 15:23:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-30 15:23:46 +0200 |
commit | 9b97d63f8f939dbc431cc2dcd9eddf959f86603a (patch) | |
tree | 98aada7aa4e7fc57e0fb0bf9a1bc84e996f483b1 /src/BlockEntities/BlockEntity.h | |
parent | Fix: GetPhysicalRamUsage on FreeBSD (UNIX) - webadmin display (#5213) (diff) | |
download | cuberite-9b97d63f8f939dbc431cc2dcd9eddf959f86603a.tar cuberite-9b97d63f8f939dbc431cc2dcd9eddf959f86603a.tar.gz cuberite-9b97d63f8f939dbc431cc2dcd9eddf959f86603a.tar.bz2 cuberite-9b97d63f8f939dbc431cc2dcd9eddf959f86603a.tar.lz cuberite-9b97d63f8f939dbc431cc2dcd9eddf959f86603a.tar.xz cuberite-9b97d63f8f939dbc431cc2dcd9eddf959f86603a.tar.zst cuberite-9b97d63f8f939dbc431cc2dcd9eddf959f86603a.zip |
Diffstat (limited to 'src/BlockEntities/BlockEntity.h')
-rw-r--r-- | src/BlockEntities/BlockEntity.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h index 3e9cf38e7..e13600e8c 100644 --- a/src/BlockEntities/BlockEntity.h +++ b/src/BlockEntities/BlockEntity.h @@ -51,12 +51,19 @@ public: Returns nullptr for unknown block types. */ static OwnedBlockEntity CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World = nullptr); + /** Called when this block entity's associated block is destroyed. + It is guaranteed that this function is called before OnRemoveFromWorld. */ virtual void Destroy(); /** Returns true if the specified blocktype is supposed to have an associated block entity. */ static bool IsBlockEntityBlockType(BLOCKTYPE a_BlockType); - /** Called when the block entity is removed from a world. */ + /** Called when the block entity object is added to a world. */ + virtual void OnAddToWorld(cWorld & a_World, cChunk & a_Chunk); + + /** Called when the block entity object is removed from a world. + This occurs when the chunk it resides in is unloaded, or when the associated block is destroyed. + If it is the latter, Destroy() is guaranteed to be called first. */ virtual void OnRemoveFromWorld(); /** Sends the packet defining the block entity to the client specified. |