summaryrefslogtreecommitdiffstats
path: root/source/cFurnaceEntity.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-31 22:30:14 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-31 22:30:14 +0100
commitc2b43f33da1461939df43657752ffd3651933b6e (patch)
tree7dd0f79d11496bd04bcebe6d2af83e77b6dbcfa4 /source/cFurnaceEntity.cpp
parentdenotch map converter can now successfully converter an mcr to a vaild pak file. Takes about 20 seconds per region file. (diff)
downloadcuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar
cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.gz
cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.bz2
cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.lz
cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.xz
cuberite-c2b43f33da1461939df43657752ffd3651933b6e.tar.zst
cuberite-c2b43f33da1461939df43657752ffd3651933b6e.zip
Diffstat (limited to '')
-rw-r--r--source/cFurnaceEntity.cpp31
1 files changed, 4 insertions, 27 deletions
diff --git a/source/cFurnaceEntity.cpp b/source/cFurnaceEntity.cpp
index 95f5f566c..36524e3b7 100644
--- a/source/cFurnaceEntity.cpp
+++ b/source/cFurnaceEntity.cpp
@@ -288,14 +288,7 @@ bool cFurnaceEntity::LoadFromJson( const Json::Value& a_Value )
int SlotIdx = 0;
for( Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr )
{
- Json::Value & Slot = *itr;
- cItem & Item = m_Items[ SlotIdx ];
- Item.m_ItemID = (ENUM_ITEM_ID)Slot.get("ID", -1 ).asInt();
- if( Item.m_ItemID > 0 )
- {
- Item.m_ItemCount = (char)Slot.get("Count", -1 ).asInt();
- Item.m_ItemHealth = (short)Slot.get("Health", -1 ).asInt();
- }
+ m_Items[ SlotIdx ].FromJson( *itr );
SlotIdx++;
}
@@ -304,12 +297,7 @@ bool cFurnaceEntity::LoadFromJson( const Json::Value& a_Value )
if( !JsonItem.empty() )
{
cItem Item;
- Item.m_ItemID = (ENUM_ITEM_ID)JsonItem.get("ID", -1).asInt();
- if( Item.m_ItemID > 0 )
- {
- Item.m_ItemCount = (char)JsonItem.get("Count", -1).asInt();
- Item.m_ItemHealth = (short)JsonItem.get("Health", -1).asInt();
- }
+ Item.FromJson( JsonItem );
if( !Item.IsEmpty() )
{
m_CookingItem = new cItem( Item );
@@ -335,13 +323,7 @@ void cFurnaceEntity::SaveToJson( Json::Value& a_Value )
for(unsigned int i = 0; i < 3; i++)
{
Json::Value Slot;
- cItem & Item = m_Items[ i ];
- Slot["ID"] = Item.m_ItemID;
- if( Item.m_ItemID > 0 )
- {
- Slot["Count"] = Item.m_ItemCount;
- Slot["Health"] = Item.m_ItemHealth;
- }
+ m_Items[ i ].GetJson( Slot );
AllSlots.append( Slot );
}
a_Value["Slots"] = AllSlots;
@@ -350,12 +332,7 @@ void cFurnaceEntity::SaveToJson( Json::Value& a_Value )
if( m_CookingItem )
{
Json::Value JsonItem;
- JsonItem["ID"] = m_CookingItem->m_ItemID;
- if( m_CookingItem->m_ItemID > 0 )
- {
- JsonItem["Count"] = m_CookingItem->m_ItemCount;
- JsonItem["Health"] = m_CookingItem->m_ItemHealth;
- }
+ m_CookingItem->GetJson( JsonItem );
a_Value["Cooking"] = JsonItem;
}