1
0

Refactored more of Entities and BlockEntities to use Vector3. (#4403)

This commit is contained in:
Mattes D
2019-09-29 14:59:24 +02:00
committed by GitHub
parent ba664340f3
commit 365cbc6e1c
122 changed files with 1271 additions and 861 deletions

View File

@@ -22,8 +22,8 @@ enum
cFurnaceEntity::cFurnaceEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World):
Super(a_BlockType, a_BlockMeta, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World),
cFurnaceEntity::cFurnaceEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World),
m_CurrentRecipe(nullptr),
m_IsDestroyed(false),
m_IsCooking(a_BlockType == E_BLOCK_LIT_FURNACE),
@@ -58,7 +58,7 @@ cFurnaceEntity::~cFurnaceEntity()
void cFurnaceEntity::Destroy()
{
m_IsDestroyed = true;
Super::Destroy();
super::Destroy();
}
@@ -67,7 +67,7 @@ void cFurnaceEntity::Destroy()
void cFurnaceEntity::CopyFrom(const cBlockEntity & a_Src)
{
Super::CopyFrom(a_Src);
super::CopyFrom(a_Src);
auto & src = static_cast<const cFurnaceEntity &>(a_Src);
m_Contents.CopyFrom(src.m_Contents);
m_CurrentRecipe = src.m_CurrentRecipe;
@@ -106,7 +106,7 @@ bool cFurnaceEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
// Reset progressbars, block type, and bail out
m_BlockType = E_BLOCK_FURNACE;
a_Chunk.FastSetBlock(GetRelX(), m_PosY, GetRelZ(), E_BLOCK_FURNACE, m_BlockMeta);
a_Chunk.FastSetBlock(GetRelPos(), E_BLOCK_FURNACE, m_BlockMeta);
UpdateProgressBars();
return false;
}
@@ -142,7 +142,7 @@ bool cFurnaceEntity::UsedBy(cPlayer * a_Player)
cWindow * Window = GetWindow();
if (Window == nullptr)
{
OpenWindow(new cFurnaceWindow(m_PosX, m_PosY, m_PosZ, this));
OpenWindow(new cFurnaceWindow(this));
Window = GetWindow();
}
@@ -255,7 +255,7 @@ void cFurnaceEntity::BurnNewFuel(void)
void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
{
Super::OnSlotChanged(a_ItemGrid, a_SlotNum);
super::OnSlotChanged(a_ItemGrid, a_SlotNum);
if (m_IsDestroyed)
{
@@ -433,6 +433,6 @@ void cFurnaceEntity::SetIsCooking(bool a_IsCooking)
if (m_IsCooking)
{
m_BlockType = E_BLOCK_LIT_FURNACE;
m_World->FastSetBlock(m_PosX, m_PosY, m_PosZ, E_BLOCK_LIT_FURNACE, m_BlockMeta);
m_World->FastSetBlock(m_Pos, E_BLOCK_LIT_FURNACE, m_BlockMeta);
}
}