From 05d71675f69e13d8ab590a33b38ee6d0f8a77b6f Mon Sep 17 00:00:00 2001 From: "luksor111@gmail.com" Date: Wed, 19 Dec 2012 21:19:36 +0000 Subject: Added dispensers (they can't dispense items yet) Fixed crash when digging snow Moved BlockPlace hook check, so Core plugin will no longer block item usage Player chat messages are now visible in the console git-svn-id: http://mc-server.googlecode.com/svn/trunk@1081 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/WorldStorage/WSSCompact.cpp | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'source/WorldStorage/WSSCompact.cpp') diff --git a/source/WorldStorage/WSSCompact.cpp b/source/WorldStorage/WSSCompact.cpp index 22e25eb6f..87cf1d930 100644 --- a/source/WorldStorage/WSSCompact.cpp +++ b/source/WorldStorage/WSSCompact.cpp @@ -11,6 +11,7 @@ #include "../StringCompression.h" #include "../ChestEntity.h" #include "../SignEntity.h" +#include "../DispenserEntity.h" #include "../FurnaceEntity.h" #include "../NoteEntity.h" #include "../JukeboxEntity.h" @@ -71,12 +72,13 @@ 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_JUKEBOX: SaveInto = "Jukeboxes"; break; + case E_BLOCK_CHEST: SaveInto = "Chests"; break; + case E_BLOCK_DISPENSER: SaveInto = "Dispensers"; 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: { @@ -281,6 +283,26 @@ void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_En } // for itr - AllChests[] } + // Load dispensers + Json::Value AllDispensers = a_Value.get("Dispensers", Json::nullValue); + if( !AllDispensers.empty() ) + { + for( Json::Value::iterator itr = AllDispensers.begin(); itr != AllDispensers.end(); ++itr ) + { + Json::Value & Dispenser = *itr; + cDispenserEntity * DispenserEntity = new cDispenserEntity(0,0,0, a_World); + if( !DispenserEntity->LoadFromJson( Dispenser ) ) + { + LOGERROR("ERROR READING DISPENSER FROM JSON!" ); + delete DispenserEntity; + } + else + { + a_BlockEntities.push_back( DispenserEntity ); + } + } // for itr - AllDispensers[] + } + // Load furnaces Json::Value AllFurnaces = a_Value.get("Furnaces", Json::nullValue); if( !AllFurnaces.empty() ) -- cgit v1.2.3