diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-31 01:52:20 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-31 01:52:20 +0100 |
commit | e2f1cf51c759f0c70bc1dc9f1db3a8575e1db10f (patch) | |
tree | 2519b9736038f7d5374719122b4ba7937d2e309c /source/cFurnaceEntity.cpp | |
parent | put the timer and quicksort functions into their own files. Made a few changes to the converter. Converter doesn't understand Entity tags and some chunks cause it to segfault for a currently unknown reason. (diff) | |
download | cuberite-e2f1cf51c759f0c70bc1dc9f1db3a8575e1db10f.tar cuberite-e2f1cf51c759f0c70bc1dc9f1db3a8575e1db10f.tar.gz cuberite-e2f1cf51c759f0c70bc1dc9f1db3a8575e1db10f.tar.bz2 cuberite-e2f1cf51c759f0c70bc1dc9f1db3a8575e1db10f.tar.lz cuberite-e2f1cf51c759f0c70bc1dc9f1db3a8575e1db10f.tar.xz cuberite-e2f1cf51c759f0c70bc1dc9f1db3a8575e1db10f.tar.zst cuberite-e2f1cf51c759f0c70bc1dc9f1db3a8575e1db10f.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cFurnaceEntity.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/source/cFurnaceEntity.cpp b/source/cFurnaceEntity.cpp index 1bca35aca..95f5f566c 100644 --- a/source/cFurnaceEntity.cpp +++ b/source/cFurnaceEntity.cpp @@ -17,8 +17,8 @@ #include <json/json.h>
-cFurnaceEntity::cFurnaceEntity(int a_X, int a_Y, int a_Z)
- : cBlockEntity( E_BLOCK_FURNACE, a_X, a_Y, a_Z )
+cFurnaceEntity::cFurnaceEntity(int a_X, int a_Y, int a_Z, cChunk* a_Chunk)
+ : cBlockEntity( E_BLOCK_FURNACE, a_X, a_Y, a_Z, a_Chunk )
, m_Items( new cItem[3] )
, m_CookingItem( 0 )
, m_CookTime( 0 )
@@ -51,15 +51,13 @@ void cFurnaceEntity::Destroy() if( !m_Items[i].IsEmpty() )
{
cPickup* Pickup = new cPickup( m_PosX*32 + 16, m_PosY*32 + 16, m_PosZ*32 + 16, m_Items[i], 0, 1.f, 0 );
- Pickup->Initialize();
+ Pickup->Initialize( m_Chunk->GetWorld() );
m_Items[i].Empty();
}
}
// Remove from tick list
- cWorld* World = cRoot::Get()->GetWorld();
- cChunk* Chunk = World->GetChunkOfBlock( m_PosX, m_PosY, m_PosZ );
- Chunk->RemoveTickBlockEntity( this );
+ GetChunk()->RemoveTickBlockEntity( this );
}
void cFurnaceEntity::UsedBy( cPlayer & a_Player )
@@ -200,9 +198,7 @@ bool cFurnaceEntity::StartCooking() m_TimeCooked = 0.f;
m_CookTime = R->CookTime;
}
- cWorld* World = cRoot::Get()->GetWorld();
- cChunk* Chunk = World->GetChunkOfBlock( m_PosX, m_PosY, m_PosZ );
- Chunk->AddTickBlockEntity( this );
+ GetChunk()->AddTickBlockEntity( this );
return true;
}
}
@@ -317,9 +313,7 @@ bool cFurnaceEntity::LoadFromJson( const Json::Value& a_Value ) if( !Item.IsEmpty() )
{
m_CookingItem = new cItem( Item );
-
- cChunk* Chunk = cRoot::Get()->GetWorld()->GetChunkOfBlock( m_PosX, m_PosY, m_PosZ );
- Chunk->AddTickBlockEntity( this );
+ GetChunk()->AddTickBlockEntity( this );
}
}
|