diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-05-22 22:27:55 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2017-05-22 22:27:55 +0200 |
commit | 8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e (patch) | |
tree | d29525d02edb691c25e930b0d795d0dba160a34c /src/WorldStorage | |
parent | Spawn eggs works again (diff) | |
download | cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.gz cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.bz2 cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.lz cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.xz cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.zst cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.zip |
Diffstat (limited to 'src/WorldStorage')
-rwxr-xr-x | src/WorldStorage/WSSAnvil.cpp | 9 | ||||
-rwxr-xr-x | src/WorldStorage/WSSAnvil.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 971c6d88c..47f08e9cf 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -417,7 +417,7 @@ bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, const cParsedNBT // Load the entities from NBT: cEntityList Entities; - cBlockEntityList BlockEntities; + cBlockEntities BlockEntities; LoadEntitiesFromNBT (Entities, a_NBT, a_NBT.FindChildByName(Level, "Entities")); LoadBlockEntitiesFromNBT(BlockEntities, a_NBT, a_NBT.FindChildByName(Level, "TileEntities"), BlockTypes, MetaData); @@ -639,7 +639,7 @@ void cWSSAnvil::LoadEntitiesFromNBT(cEntityList & a_Entities, const cParsedNBT & -void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas) +void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntities & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas) { if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List)) { @@ -673,7 +673,10 @@ void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, con } // Add the BlockEntity to the loaded data: - a_BlockEntities.push_back(be.release()); + auto Idx = cChunkDef::MakeIndex(be->GetRelX(), be->GetPosY(), be->GetRelZ()); + a_BlockEntities.insert({ Idx, be.get() }); + // Release after inserting in case it throws. + be.release(); } // for Child - tag children } diff --git a/src/WorldStorage/WSSAnvil.h b/src/WorldStorage/WSSAnvil.h index a4527bfcd..86fdc8189 100755 --- a/src/WorldStorage/WSSAnvil.h +++ b/src/WorldStorage/WSSAnvil.h @@ -131,7 +131,7 @@ protected: void LoadEntitiesFromNBT(cEntityList & a_Entitites, const cParsedNBT & a_NBT, int a_Tag); /** Loads the chunk's BlockEntities from NBT data (a_Tag is the Level\\TileEntities list tag; may be -1) */ - void LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntitites, const cParsedNBT & a_NBT, int a_Tag, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas); + void LoadBlockEntitiesFromNBT(cBlockEntities & a_BlockEntitites, const cParsedNBT & a_NBT, int a_Tag, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas); /** Loads the data for a block entity from the specified NBT tag. Returns the loaded block entity, or nullptr upon failure. */ |