summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/HopperEntity.cpp
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2020-03-27 13:03:28 +0100
committerGitHub <noreply@github.com>2020-03-27 13:03:28 +0100
commitea386eaab12206e585e01720808dc37585569535 (patch)
tree7f26c0241b45cd2551b5d2ab5fc28d920130b0b7 /src/BlockEntities/HopperEntity.cpp
parentMerge #4552 (diff)
downloadcuberite-ea386eaab12206e585e01720808dc37585569535.tar
cuberite-ea386eaab12206e585e01720808dc37585569535.tar.gz
cuberite-ea386eaab12206e585e01720808dc37585569535.tar.bz2
cuberite-ea386eaab12206e585e01720808dc37585569535.tar.lz
cuberite-ea386eaab12206e585e01720808dc37585569535.tar.xz
cuberite-ea386eaab12206e585e01720808dc37585569535.tar.zst
cuberite-ea386eaab12206e585e01720808dc37585569535.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/HopperEntity.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp
index e85cfb952..aadca8311 100644
--- a/src/BlockEntities/HopperEntity.cpp
+++ b/src/BlockEntities/HopperEntity.cpp
@@ -20,7 +20,8 @@
cHopperEntity::cHopperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World):
super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World),
m_LastMoveItemsInTick(0),
- m_LastMoveItemsOutTick(0)
+ m_LastMoveItemsOutTick(0),
+ m_Locked(false)
{
ASSERT(a_BlockType == E_BLOCK_HOPPER);
}
@@ -29,6 +30,15 @@ cHopperEntity::cHopperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vect
+void cHopperEntity::SetLocked(bool a_Value)
+{
+ m_Locked = a_Value;
+}
+
+
+
+
+
std::pair<bool, Vector3i> cHopperEntity::GetOutputBlockPos(NIBBLETYPE a_BlockMeta)
{
auto pos = GetPos();
@@ -69,9 +79,12 @@ bool cHopperEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
Int64 CurrentTick = a_Chunk.GetWorld()->GetWorldAge();
bool isDirty = false;
- isDirty = MoveItemsIn (a_Chunk, CurrentTick) || isDirty;
- isDirty = MovePickupsIn(a_Chunk, CurrentTick) || isDirty;
- isDirty = MoveItemsOut (a_Chunk, CurrentTick) || isDirty;
+ if (!m_Locked)
+ {
+ isDirty = MoveItemsIn (a_Chunk, CurrentTick) || isDirty;
+ isDirty = MovePickupsIn(a_Chunk, CurrentTick) || isDirty;
+ isDirty = MoveItemsOut (a_Chunk, CurrentTick) || isDirty;
+ }
return isDirty;
}