diff options
| author | void_17 <61356189+void2012@users.noreply.github.com> | 2026-03-06 02:11:18 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-06 02:11:18 +0700 |
| commit | 55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b (patch) | |
| tree | 953c537a5c66e328e9f4ab29626cf738112d53c0 /Minecraft.World/FallingTile.cpp | |
| parent | 7d6658fe5b3095f35093701b5ab669ffc291e875 (diff) | |
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.World/FallingTile.cpp')
| -rw-r--r-- | Minecraft.World/FallingTile.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Minecraft.World/FallingTile.cpp b/Minecraft.World/FallingTile.cpp index 28248014..c0eb7d22 100644 --- a/Minecraft.World/FallingTile.cpp +++ b/Minecraft.World/FallingTile.cpp @@ -145,13 +145,15 @@ void FallingTile::tick() CompoundTag *swap = new CompoundTag(); tileEntity->save(swap); vector<Tag *> *allTags = tileData->getAllTags(); - for(AUTO_VAR(it, allTags->begin()); it != allTags->end(); ++it) + if ( allTags ) { - Tag *tag = *it; - if (tag->getName().compare(L"x") == 0 || tag->getName().compare(L"y") == 0 || tag->getName().compare(L"z") == 0) continue; - swap->put(tag->getName(), tag->copy()); + for ( Tag* tag : *allTags ) + { + if (tag->getName().compare(L"x") == 0 || tag->getName().compare(L"y") == 0 || tag->getName().compare(L"z") == 0) continue; + swap->put(tag->getName(), tag->copy()); + } + delete allTags; } - delete allTags; tileEntity->load(swap); tileEntity->setChanged(); } @@ -181,12 +183,14 @@ void FallingTile::causeFallDamage(float distance) // 4J: Copy vector since it might be modified when we hurt the entities (invalidating our iterator) vector<shared_ptr<Entity> > *entities = new vector<shared_ptr<Entity> >(*level->getEntities(shared_from_this(), bb)); DamageSource *source = tile == Tile::anvil_Id ? DamageSource::anvil : DamageSource::fallingBlock; - //for (Entity entity : entities) - for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) + if ( source ) { - (*it)->hurt(source, min(Mth::floor(dmg * fallDamageAmount), fallDamageMax)); + for (auto& it : *entities) + { + it->hurt(source, static_cast<float>(std::min<int>(Mth::floor(dmg * fallDamageAmount), fallDamageMax))); + } + delete entities; } - delete entities; if (tile == Tile::anvil_Id && random->nextFloat() < 0.05f + (dmg * 0.05)) { |
