From 6ad8553a3a9095bd5a8c25085fa0bb209d411048 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 26 Aug 2012 17:50:42 +0000 Subject: 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 --- source/WSSCompact.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'source/WSSCompact.cpp') diff --git a/source/WSSCompact.cpp b/source/WSSCompact.cpp index 406b55d38..a47c62dcb 100644 --- a/source/WSSCompact.cpp +++ b/source/WSSCompact.cpp @@ -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[] + } } -- cgit v1.2.3