summaryrefslogtreecommitdiffstats
path: root/source/BlockEntities/HopperEntity.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-16 22:24:07 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-16 22:24:07 +0200
commit97eda34a9437abe732cf6b60711828bbe4f0cb2e (patch)
treef06f2a5bb2ad7efd0d09d9cba0b2f8fe586a53e0 /source/BlockEntities/HopperEntity.cpp
parentCore: fixed a warning message when using the /item command (diff)
downloadcuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar
cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.gz
cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.bz2
cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.lz
cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.xz
cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.tar.zst
cuberite-97eda34a9437abe732cf6b60711828bbe4f0cb2e.zip
Diffstat (limited to '')
-rw-r--r--source/BlockEntities/HopperEntity.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/source/BlockEntities/HopperEntity.cpp b/source/BlockEntities/HopperEntity.cpp
index fb2e36aa3..1ed0dbbb8 100644
--- a/source/BlockEntities/HopperEntity.cpp
+++ b/source/BlockEntities/HopperEntity.cpp
@@ -9,6 +9,7 @@
#include "../Player.h"
#include "ChestEntity.h"
#include "DropSpenserEntity.h"
+#include "FurnaceEntity.h"
@@ -229,7 +230,28 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
/// Moves items from a furnace above the hopper into this hopper. Returns true if contents have changed.
bool cHopperEntity::MoveItemsFromFurnace(cChunk & a_Chunk)
{
- // TODO
+ cFurnaceEntity * Furnace = (cFurnaceEntity *)a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ);
+ ASSERT(Furnace != NULL);
+
+ // Try move from the output slot:
+ if (MoveItemsFromSlot(Furnace->GetOutputSlot(), true))
+ {
+ cItem NewOutput(Furnace->GetOutputSlot());
+ Furnace->SetOutputSlot(NewOutput.AddCount(-1));
+ return true;
+ }
+
+ // No output moved, check if we can move an empty bucket out of the fuel slot:
+ if (Furnace->GetFuelSlot().m_ItemType == E_ITEM_BUCKET)
+ {
+ if (MoveItemsFromSlot(Furnace->GetFuelSlot(), true))
+ {
+ Furnace->SetFuelSlot(cItem());
+ return true;
+ }
+ }
+
+ // Nothing can be moved
return false;
}