diff options
| author | qwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com> | 2026-03-05 17:17:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-05 17:17:45 -0600 |
| commit | 0666959d312dc74903f55d1071488a90239330f1 (patch) | |
| tree | 5c6886f7ec65a7828bc6e34a469514e418bcf78b /Minecraft.World/ChestTile.cpp | |
| parent | 9370cbc7d878df1615d8ce76bc459e8b414d0f19 (diff) | |
| parent | eed770b121aa4ce38f002db042d0137c24c6d344 (diff) | |
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.World/ChestTile.cpp')
| -rw-r--r-- | Minecraft.World/ChestTile.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Minecraft.World/ChestTile.cpp b/Minecraft.World/ChestTile.cpp index a4894c86..11178b8a 100644 --- a/Minecraft.World/ChestTile.cpp +++ b/Minecraft.World/ChestTile.cpp @@ -337,16 +337,19 @@ int ChestTile::getDirectSignal(LevelSource *level, int x, int y, int z, int dir) bool ChestTile::isCatSittingOnChest(Level *level, int x, int y, int z) { vector<shared_ptr<Entity> > *entities = level->getEntitiesOfClass(typeid(Ocelot), AABB::newTemp(x, y + 1, z, x + 1, y + 2, z + 1)); - for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) + if ( entities ) { - shared_ptr<Ocelot> ocelot = dynamic_pointer_cast<Ocelot>(*it); - if(ocelot->isSitting()) + for (auto& it : *entities) { - delete entities; - return true; + shared_ptr<Ocelot> ocelot = dynamic_pointer_cast<Ocelot>(it); + if ( ocelot && ocelot->isSitting()) + { + delete entities; + return true; + } } + delete entities; } - delete entities; return false; } |
