diff options
author | Mattes D <github@xoft.cz> | 2014-01-23 14:06:05 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-01-23 14:06:05 +0100 |
commit | 0526ed327c9679919486e49f36ba4d051390a73e (patch) | |
tree | 7a75ff77e167214dd3dc63c31df4fc41ad8d6530 /src/WorldStorage/WSSCompact.cpp | |
parent | Authenticator: Reduced logging levels. (diff) | |
parent | Command block fixes 2 (diff) | |
download | cuberite-0526ed327c9679919486e49f36ba4d051390a73e.tar cuberite-0526ed327c9679919486e49f36ba4d051390a73e.tar.gz cuberite-0526ed327c9679919486e49f36ba4d051390a73e.tar.bz2 cuberite-0526ed327c9679919486e49f36ba4d051390a73e.tar.lz cuberite-0526ed327c9679919486e49f36ba4d051390a73e.tar.xz cuberite-0526ed327c9679919486e49f36ba4d051390a73e.tar.zst cuberite-0526ed327c9679919486e49f36ba4d051390a73e.zip |
Diffstat (limited to 'src/WorldStorage/WSSCompact.cpp')
-rw-r--r-- | src/WorldStorage/WSSCompact.cpp | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/src/WorldStorage/WSSCompact.cpp b/src/WorldStorage/WSSCompact.cpp index ea17a8ec1..d020b73cc 100644 --- a/src/WorldStorage/WSSCompact.cpp +++ b/src/WorldStorage/WSSCompact.cpp @@ -10,6 +10,7 @@ #include "json/json.h" #include "../StringCompression.h" #include "../BlockEntities/ChestEntity.h" +#include "../BlockEntities/CommandBlockEntity.h" #include "../BlockEntities/DispenserEntity.h" #include "../BlockEntities/FurnaceEntity.h" #include "../BlockEntities/JukeboxEntity.h" @@ -71,14 +72,15 @@ void cJsonChunkSerializer::BlockEntity(cBlockEntity * a_BlockEntity) const char * SaveInto = NULL; switch (a_BlockEntity->GetBlockType()) { - case E_BLOCK_CHEST: SaveInto = "Chests"; break; - case E_BLOCK_DISPENSER: SaveInto = "Dispensers"; break; - case E_BLOCK_DROPPER: SaveInto = "Droppers"; break; - case E_BLOCK_FURNACE: SaveInto = "Furnaces"; break; - case E_BLOCK_SIGN_POST: SaveInto = "Signs"; break; - case E_BLOCK_WALLSIGN: SaveInto = "Signs"; break; - case E_BLOCK_NOTE_BLOCK: SaveInto = "Notes"; break; - case E_BLOCK_JUKEBOX: SaveInto = "Jukeboxes"; break; + case E_BLOCK_CHEST: SaveInto = "Chests"; break; + case E_BLOCK_DISPENSER: SaveInto = "Dispensers"; break; + case E_BLOCK_DROPPER: SaveInto = "Droppers"; break; + case E_BLOCK_FURNACE: SaveInto = "Furnaces"; break; + case E_BLOCK_SIGN_POST: SaveInto = "Signs"; break; + case E_BLOCK_WALLSIGN: SaveInto = "Signs"; break; + case E_BLOCK_NOTE_BLOCK: SaveInto = "Notes"; break; + case E_BLOCK_JUKEBOX: SaveInto = "Jukeboxes"; break; + case E_BLOCK_COMMAND_BLOCK: SaveInto = "CommandBlocks"; break; default: { @@ -383,6 +385,26 @@ void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_En } } // for itr - AllJukeboxes[] } + + // Load command blocks + Json::Value AllCommandBlocks = a_Value.get("CommandBlocks", Json::nullValue); + if( !AllCommandBlocks.empty() ) + { + for( Json::Value::iterator itr = AllCommandBlocks.begin(); itr != AllCommandBlocks.end(); ++itr ) + { + Json::Value & CommandBlock = *itr; + cCommandBlockEntity * CommandBlockEntity = new cCommandBlockEntity(0, 0, 0, a_World); + if ( !CommandBlockEntity->LoadFromJson( CommandBlock ) ) + { + LOGERROR("ERROR READING COMMAND BLOCK FROM JSON!" ); + delete CommandBlockEntity; + } + else + { + a_BlockEntities.push_back( CommandBlockEntity ); + } + } // for itr - AllCommandBlocks[] + } } |