summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/DropSpenserEntity.cpp
diff options
context:
space:
mode:
authorSteven Riehl <sriehl@gmail.com>2014-10-12 04:39:55 +0200
committerSteven Riehl <sriehl@gmail.com>2014-10-12 04:39:55 +0200
commit856764dee8f0c66397669e8c7c013c758f1d2c81 (patch)
tree4d8e3f0a63410b99728929ef1ce220c5392d5bf5 /src/BlockEntities/DropSpenserEntity.cpp
parentUpdate README.md (diff)
downloadcuberite-856764dee8f0c66397669e8c7c013c758f1d2c81.tar
cuberite-856764dee8f0c66397669e8c7c013c758f1d2c81.tar.gz
cuberite-856764dee8f0c66397669e8c7c013c758f1d2c81.tar.bz2
cuberite-856764dee8f0c66397669e8c7c013c758f1d2c81.tar.lz
cuberite-856764dee8f0c66397669e8c7c013c758f1d2c81.tar.xz
cuberite-856764dee8f0c66397669e8c7c013c758f1d2c81.tar.zst
cuberite-856764dee8f0c66397669e8c7c013c758f1d2c81.zip
Diffstat (limited to 'src/BlockEntities/DropSpenserEntity.cpp')
-rw-r--r--src/BlockEntities/DropSpenserEntity.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp
index dac951b27..2cbc947dc 100644
--- a/src/BlockEntities/DropSpenserEntity.cpp
+++ b/src/BlockEntities/DropSpenserEntity.cpp
@@ -61,7 +61,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
{
// Pick one of the occupied slots:
int OccupiedSlots[9];
- int SlotsCnt = 0;
+ uint SlotsCnt = 0;
for (int i = m_Contents.GetNumSlots() - 1; i >= 0; i--)
{
if (!m_Contents.GetSlot(i).IsEmpty())
@@ -70,19 +70,19 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
SlotsCnt++;
}
} // for i - m_Contents[]
-
+
if (SlotsCnt == 0)
{
// Nothing in the dropspenser, play the click sound
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.2f);
return;
}
-
+
int RandomSlot = m_World->GetTickRandomNumber(SlotsCnt - 1);
-
+
// DropSpense the item, using the specialized behavior in the subclasses:
DropSpenseFromSlot(a_Chunk, OccupiedSlots[RandomSlot]);
-
+
// Broadcast a smoke and click effects:
NIBBLETYPE Meta = a_Chunk.GetMeta(m_RelX, m_PosY, m_RelZ);
int SmokeDir = 0;
@@ -132,7 +132,7 @@ bool cDropSpenserEntity::Tick(float a_Dt, cChunk & a_Chunk)
{
return false;
}
-
+
m_ShouldDropSpense = false;
DropSpense(a_Chunk);
return true;
@@ -160,7 +160,7 @@ void cDropSpenserEntity::UsedBy(cPlayer * a_Player)
OpenWindow(new cDropSpenserWindow(m_PosX, m_PosY, m_PosZ, this));
Window = GetWindow();
}
-
+
if (Window != NULL)
{
if (a_Player->GetWindow() != Window)
@@ -205,7 +205,3 @@ void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum)
m_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ, PickupSpeedX, PickupSpeedY, PickupSpeedZ);
}
-
-
-
-