1
0

Added basic noteblocks, finished sign storage in Anvil (patch contributed by l0udPL)

http://forum.mc-server.org/showthread.php?tid=528

git-svn-id: http://mc-server.googlecode.com/svn/trunk@793 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-08-26 17:50:42 +00:00
parent c00db32b78
commit 6ad8553a3a
12 changed files with 343 additions and 7 deletions

View File

@@ -12,6 +12,7 @@
#include "cChestEntity.h"
#include "cSignEntity.h"
#include "cFurnaceEntity.h"
#include "cNoteEntity.h"
#include "BlockID.h"
@@ -73,7 +74,8 @@ void cJsonChunkSerializer::BlockEntity(cBlockEntity * a_BlockEntity)
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;
default:
{
ASSERT(!"Unhandled blocktype in BlockEntities list while saving to JSON");
@@ -316,6 +318,26 @@ void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_En
}
} // for itr - AllSigns[]
}
// Load note blocks
Json::Value AllNotes = a_Value.get("Notes", Json::nullValue);
if( !AllNotes.empty() )
{
for( Json::Value::iterator itr = AllNotes.begin(); itr != AllNotes.end(); ++itr )
{
Json::Value & Note = *itr;
cNoteEntity * NoteEntity = new cNoteEntity(0, 0, 0, a_World);
if ( !NoteEntity->LoadFromJson( Note ) )
{
LOGERROR("ERROR READING NOTE BLOCK FROM JSON!" );
delete NoteEntity;
}
else
{
a_BlockEntities.push_back( NoteEntity );
}
} // for itr - AllNotes[]
}
}