1
0

Added jukeboxes (patch contributed by Luksor)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@994 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-10-21 07:46:28 +00:00
parent e30bec4fd6
commit 3f9e876d70
22 changed files with 598 additions and 250 deletions

View File

@@ -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[]
}
}