summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarvin Kopf <marvinkopf@posteo.de>2016-12-06 10:40:34 +0100
committerMarvin Kopf <marvinkopf@posteo.de>2016-12-06 19:40:00 +0100
commitd394042694b3461efd771f0586c5c95b0c56f79d (patch)
tree34f7304f225f501df8028e09110416992470d895 /src
parentAPIDesc: Fixed wrong cBlockArea parameter descriptions. (diff)
downloadcuberite-d394042694b3461efd771f0586c5c95b0c56f79d.tar
cuberite-d394042694b3461efd771f0586c5c95b0c56f79d.tar.gz
cuberite-d394042694b3461efd771f0586c5c95b0c56f79d.tar.bz2
cuberite-d394042694b3461efd771f0586c5c95b0c56f79d.tar.lz
cuberite-d394042694b3461efd771f0586c5c95b0c56f79d.tar.xz
cuberite-d394042694b3461efd771f0586c5c95b0c56f79d.tar.zst
cuberite-d394042694b3461efd771f0586c5c95b0c56f79d.zip
Diffstat (limited to '')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
index debfd6330..34af3ccbc 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
@@ -54,7 +54,14 @@ public:
virtual bool Item(cBlockEntity * a_BlockEntity) override
{
- auto & Contents = static_cast<cBlockEntityWithItems *>(a_BlockEntity)->GetContents();
+ // Skip BlockEntities that don't have slots
+ auto BlockEntityWithItems = dynamic_cast<cBlockEntityWithItems *>(a_BlockEntity);
+ if (BlockEntityWithItems == nullptr)
+ {
+ return false;
+ }
+
+ auto & Contents = BlockEntityWithItems->GetContents();
float Fullness = 0; // Is a floating-point type to allow later calculation to produce a non-truncated value
for (int Slot = 0; Slot != Contents.GetNumSlots(); ++Slot)