summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/DropSpenserEntity.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2023-03-22 11:20:16 +0100
committerGitHub <noreply@github.com>2023-03-22 11:20:16 +0100
commitc747b4911ed4b1833d7f400d62d1835aba704278 (patch)
tree55431c188c73055f0e0b0db8fdbb032675cf4431 /src/BlockEntities/DropSpenserEntity.cpp
parentAdded small embedded devices to README (diff)
downloadcuberite-c747b4911ed4b1833d7f400d62d1835aba704278.tar
cuberite-c747b4911ed4b1833d7f400d62d1835aba704278.tar.gz
cuberite-c747b4911ed4b1833d7f400d62d1835aba704278.tar.bz2
cuberite-c747b4911ed4b1833d7f400d62d1835aba704278.tar.lz
cuberite-c747b4911ed4b1833d7f400d62d1835aba704278.tar.xz
cuberite-c747b4911ed4b1833d7f400d62d1835aba704278.tar.zst
cuberite-c747b4911ed4b1833d7f400d62d1835aba704278.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/DropSpenserEntity.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp
index b067e1081..6c0df0606 100644
--- a/src/BlockEntities/DropSpenserEntity.cpp
+++ b/src/BlockEntities/DropSpenserEntity.cpp
@@ -47,8 +47,8 @@ void cDropSpenserEntity::AddDropSpenserDir(Vector3i & a_RelCoord, NIBBLETYPE a_D
void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
{
// Pick one of the occupied slots:
- int OccupiedSlots[9];
- int SlotsCnt = 0;
+ std::array<int, 9> OccupiedSlots;
+ size_t SlotsCnt = 0;
for (int i = m_Contents.GetNumSlots() - 1; i >= 0; i--)
{
if (!m_Contents.GetSlot(i).IsEmpty())
@@ -65,7 +65,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
return;
}
- const int RandomSlot = m_World->GetTickRandomNumber(SlotsCnt - 1);
+ const size_t RandomSlot = GetRandomProvider().RandInt(SlotsCnt - 1);
const int SpenseSlot = OccupiedSlots[RandomSlot];
if (cPluginManager::Get()->CallHookDropSpense(*m_World, *this, SpenseSlot))