summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSCompact.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-01-23 13:57:04 +0100
committerandrew <xdotftw@gmail.com>2014-01-23 13:57:04 +0100
commit4ef61d8bf6d815b164a32bdab6a18744cbf0abd2 (patch)
treefc0c615aba88114ce209b99e7e8c8c5d925117bb /src/WorldStorage/WSSCompact.cpp
parentMerge pull request #566 from xdot/master (diff)
downloadcuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.gz
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.bz2
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.lz
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.xz
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.zst
cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/WSSCompact.cpp38
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[]
+ }
}