diff options
| author | void_17 <heroerror3@gmail.com> | 2026-03-02 15:58:20 +0700 |
|---|---|---|
| committer | void_17 <heroerror3@gmail.com> | 2026-03-02 15:58:20 +0700 |
| commit | 7074f35e4ba831e358117842b99ee35b87f85ae5 (patch) | |
| tree | 7d440d23473196af3056bf2ff4c59d9e740a06f5 /Minecraft.World/MonsterPlacerItem.cpp | |
| parent | d63f79325f85e014361eb8cf1e41eaebedb1ae71 (diff) | |
shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
Diffstat (limited to 'Minecraft.World/MonsterPlacerItem.cpp')
| -rw-r--r-- | Minecraft.World/MonsterPlacerItem.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Minecraft.World/MonsterPlacerItem.cpp b/Minecraft.World/MonsterPlacerItem.cpp index a2970033..3c7809fe 100644 --- a/Minecraft.World/MonsterPlacerItem.cpp +++ b/Minecraft.World/MonsterPlacerItem.cpp @@ -18,7 +18,7 @@ MonsterPlacerItem::MonsterPlacerItem(int id) : Item(id) overlay = NULL; } -wstring MonsterPlacerItem::getHoverName(shared_ptr<ItemInstance> itemInstance) +wstring MonsterPlacerItem::getHoverName(std::shared_ptr<ItemInstance> itemInstance) { wstring elementName = getDescription(); @@ -29,14 +29,14 @@ wstring MonsterPlacerItem::getHoverName(shared_ptr<ItemInstance> itemInstance) //elementName += " " + I18n.get("entity." + encodeId + ".name"); } else - { + { elementName = replaceAll(elementName,L"{*CREATURE*}",L""); } return elementName; } -int MonsterPlacerItem::getColor(shared_ptr<ItemInstance> item, int spriteLayer) +int MonsterPlacerItem::getColor(std::shared_ptr<ItemInstance> item, int spriteLayer) { AUTO_VAR(it, EntityIO::idsSpawnableInCreative.find(item->getAuxValue())); if (it != EntityIO::idsSpawnableInCreative.end()) @@ -65,9 +65,9 @@ Icon *MonsterPlacerItem::getLayerIcon(int auxValue, int spriteLayer) } // 4J-PB - added for dispenser -shared_ptr<Entity> MonsterPlacerItem::canSpawn(int iAuxVal, Level *level, int *piResult) +std::shared_ptr<Entity> MonsterPlacerItem::canSpawn(int iAuxVal, Level *level, int *piResult) { - shared_ptr<Entity> newEntity = EntityIO::newById(iAuxVal, level); + std::shared_ptr<Entity> newEntity = EntityIO::newById(iAuxVal, level); if (newEntity != NULL) { bool canSpawn = false; @@ -166,7 +166,7 @@ shared_ptr<Entity> MonsterPlacerItem::canSpawn(int iAuxVal, Level *level, int *p return nullptr; } -bool MonsterPlacerItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) +bool MonsterPlacerItem::useOn(std::shared_ptr<ItemInstance> itemInstance, std::shared_ptr<Player> player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { if (level->isClientSide) { @@ -181,7 +181,7 @@ bool MonsterPlacerItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr< // 4J Stu - Force adding this as a tile update level->setTile(x,y,z,0); level->setTile(x,y,z,Tile::mobSpawner_Id); - shared_ptr<MobSpawnerTileEntity> mste = dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x,y,z) ); + std::shared_ptr<MobSpawnerTileEntity> mste = dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x,y,z) ); if(mste != NULL) { mste->setEntityId( EntityIO::getEncodeId(itemInstance->getAuxValue()) ); @@ -193,7 +193,7 @@ bool MonsterPlacerItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr< x += Facing::STEP_X[face]; y += Facing::STEP_Y[face]; z += Facing::STEP_Z[face]; - + double yOff = 0; // 4J-PB - missing parentheses added if (face == Facing::UP && (tile == Tile::fence_Id || tile == Tile::netherFence_Id)) @@ -211,11 +211,11 @@ bool MonsterPlacerItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr< } if (spawned) - { + { if (!player->abilities.instabuild) { itemInstance->count--; - } + } } else { @@ -254,20 +254,20 @@ bool MonsterPlacerItem::useOn(shared_ptr<ItemInstance> itemInstance, shared_ptr< return true; } -shared_ptr<Entity> MonsterPlacerItem::spawnMobAt(Level *level, int mobId, double x, double y, double z, int *piResult) +std::shared_ptr<Entity> MonsterPlacerItem::spawnMobAt(Level *level, int mobId, double x, double y, double z, int *piResult) { if (EntityIO::idsSpawnableInCreative.find(mobId) == EntityIO::idsSpawnableInCreative.end()) { return nullptr; } - shared_ptr<Entity> newEntity = nullptr; + std::shared_ptr<Entity> newEntity = nullptr; for (int i = 0; i < SPAWN_COUNT; i++) { newEntity = canSpawn(mobId, level, piResult); - shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(newEntity); + std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(newEntity); if (mob) { newEntity->moveTo(x, y, z, Mth::wrapDegrees(level->random->nextFloat() * 360), 0); |
