summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
authorr.ramazanov <r.ramazanov@servplus.ru>2014-04-23 16:15:28 +0200
committerr.ramazanov <r.ramazanov@servplus.ru>2014-04-23 16:15:28 +0200
commit103c867f1f42c38df3d2bfba2ffbc4c8e7ac2932 (patch)
treeb17cb676477be05abac7084bc0e1e49f651c2456 /src/BlockEntities
parentMobs shouldn't burn when it's Raining #906 (diff)
parentMerge pull request #925 from archshift/master (diff)
downloadcuberite-103c867f1f42c38df3d2bfba2ffbc4c8e7ac2932.tar
cuberite-103c867f1f42c38df3d2bfba2ffbc4c8e7ac2932.tar.gz
cuberite-103c867f1f42c38df3d2bfba2ffbc4c8e7ac2932.tar.bz2
cuberite-103c867f1f42c38df3d2bfba2ffbc4c8e7ac2932.tar.lz
cuberite-103c867f1f42c38df3d2bfba2ffbc4c8e7ac2932.tar.xz
cuberite-103c867f1f42c38df3d2bfba2ffbc4c8e7ac2932.tar.zst
cuberite-103c867f1f42c38df3d2bfba2ffbc4c8e7ac2932.zip
Diffstat (limited to 'src/BlockEntities')
-rw-r--r--src/BlockEntities/DispenserEntity.cpp9
-rw-r--r--src/BlockEntities/FurnaceEntity.cpp7
-rw-r--r--src/BlockEntities/HopperEntity.cpp11
3 files changed, 16 insertions, 11 deletions
diff --git a/src/BlockEntities/DispenserEntity.cpp b/src/BlockEntities/DispenserEntity.cpp
index e03bf776d..2a32f69d9 100644
--- a/src/BlockEntities/DispenserEntity.cpp
+++ b/src/BlockEntities/DispenserEntity.cpp
@@ -128,10 +128,11 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
if (DispChunk->GetBlock(DispX, DispY, DispZ) == E_BLOCK_AIR)
{
DispChunk->SetBlock(DispX, DispY, DispZ, E_BLOCK_FIRE, 0);
- m_Contents.SetSlot(a_SlotNum, m_Contents.GetSlot(a_SlotNum).m_ItemType, m_Contents.GetSlot(a_SlotNum).m_ItemCount, m_Contents.GetSlot(a_SlotNum).m_ItemDamage + 1);
- // If the durability has run out destroy the item.
- if (m_Contents.GetSlot(a_SlotNum).m_ItemDamage > 64)
- {
+
+ bool ItemBroke = m_Contents.DamageItem(a_SlotNum, 1);
+
+ if (ItemBroke)
+ {
m_Contents.ChangeSlotCount(a_SlotNum, -1);
}
}
diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp
index 7d6d1f89e..1b1741713 100644
--- a/src/BlockEntities/FurnaceEntity.cpp
+++ b/src/BlockEntities/FurnaceEntity.cpp
@@ -413,19 +413,20 @@ bool cFurnaceEntity::CanCookInputToOutput(void) const
return false;
}
- if (m_Contents.GetSlot(fsOutput).IsEmpty())
+ const cItem & Slot = m_Contents.GetSlot(fsOutput);
+ if (Slot.IsEmpty())
{
// The output is empty, can cook
return true;
}
- if (!m_Contents.GetSlot(fsOutput).IsEqual(*m_CurrentRecipe->Out))
+ if (!Slot.IsEqual(*m_CurrentRecipe->Out))
{
// The output slot is blocked with something that cannot be stacked with the recipe's output
return false;
}
- if (m_Contents.GetSlot(fsOutput).IsFullStack())
+ if (Slot.IsFullStack())
{
// Cannot add any more items to the output slot
return false;
diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp
index 41fb9f811..7f001c739 100644
--- a/src/BlockEntities/HopperEntity.cpp
+++ b/src/BlockEntities/HopperEntity.cpp
@@ -234,24 +234,27 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
bool TrySuckPickupIn(cPickup * a_Pickup)
{
+ cItem & Item = a_Pickup->GetItem();
+
for (int i = 0; i < ContentsWidth * ContentsHeight; i++)
{
if (m_Contents.IsSlotEmpty(i))
{
m_bFoundPickupsAbove = true;
- m_Contents.SetSlot(i, a_Pickup->GetItem());
+ m_Contents.SetSlot(i, Item);
a_Pickup->Destroy(); // Kill pickup
return true;
}
- else if (m_Contents.GetSlot(i).IsEqual(a_Pickup->GetItem()) && !m_Contents.GetSlot(i).IsFullStack())
+ else if (m_Contents.GetSlot(i).IsEqual(Item) && !m_Contents.GetSlot(i).IsFullStack())
{
m_bFoundPickupsAbove = true;
int PreviousCount = m_Contents.GetSlot(i).m_ItemCount;
- a_Pickup->GetItem().m_ItemCount -= m_Contents.ChangeSlotCount(i, a_Pickup->GetItem().m_ItemCount) - PreviousCount; // Set count to however many items were added
- if (a_Pickup->GetItem().IsEmpty())
+ Item.m_ItemCount -= m_Contents.ChangeSlotCount(i, Item.m_ItemCount) - PreviousCount; // Set count to however many items were added
+
+ if (Item.IsEmpty())
{
a_Pickup->Destroy(); // Kill pickup if all items were added
}