diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-21 09:46:28 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-21 09:46:28 +0200 |
commit | 3f9e876d70851ed0333a3fdc57d883f040e92d8b (patch) | |
tree | 789155746561aed3b04818ed4221f40fa42e77fd /source/WorldStorage/WSSCompact.cpp | |
parent | Double chests are now working, and with sound. (FS #69) (diff) | |
download | cuberite-3f9e876d70851ed0333a3fdc57d883f040e92d8b.tar cuberite-3f9e876d70851ed0333a3fdc57d883f040e92d8b.tar.gz cuberite-3f9e876d70851ed0333a3fdc57d883f040e92d8b.tar.bz2 cuberite-3f9e876d70851ed0333a3fdc57d883f040e92d8b.tar.lz cuberite-3f9e876d70851ed0333a3fdc57d883f040e92d8b.tar.xz cuberite-3f9e876d70851ed0333a3fdc57d883f040e92d8b.tar.zst cuberite-3f9e876d70851ed0333a3fdc57d883f040e92d8b.zip |
Diffstat (limited to 'source/WorldStorage/WSSCompact.cpp')
-rw-r--r-- | source/WorldStorage/WSSCompact.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/source/WorldStorage/WSSCompact.cpp b/source/WorldStorage/WSSCompact.cpp index addb2a1cd..22e25eb6f 100644 --- a/source/WorldStorage/WSSCompact.cpp +++ b/source/WorldStorage/WSSCompact.cpp @@ -13,6 +13,7 @@ #include "../SignEntity.h" #include "../FurnaceEntity.h" #include "../NoteEntity.h" +#include "../JukeboxEntity.h" #include "../BlockID.h" @@ -70,11 +71,12 @@ void cJsonChunkSerializer::BlockEntity(cBlockEntity * a_BlockEntity) const char * SaveInto = NULL; switch (a_BlockEntity->GetBlockType()) { - case E_BLOCK_CHEST: SaveInto = "Chests"; 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_CHEST: SaveInto = "Chests"; 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; default: { @@ -338,6 +340,26 @@ void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_En } } // for itr - AllNotes[] } + + // Load jukeboxes + Json::Value AllJukeboxes = a_Value.get("Jukeboxes", Json::nullValue); + if( !AllJukeboxes.empty() ) + { + for( Json::Value::iterator itr = AllJukeboxes.begin(); itr != AllJukeboxes.end(); ++itr ) + { + Json::Value & Jukebox = *itr; + cJukeboxEntity * JukeboxEntity = new cJukeboxEntity(0, 0, 0, a_World); + if ( !JukeboxEntity->LoadFromJson( Jukebox ) ) + { + LOGERROR("ERROR READING JUKEBOX FROM JSON!" ); + delete JukeboxEntity; + } + else + { + a_BlockEntities.push_back( JukeboxEntity ); + } + } // for itr - AllJukeboxes[] + } } |