aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/FishingHook.cpp
diff options
context:
space:
mode:
authorvoid_17 <heroerror3@gmail.com>2026-03-02 15:58:20 +0700
committervoid_17 <heroerror3@gmail.com>2026-03-02 15:58:20 +0700
commit7074f35e4ba831e358117842b99ee35b87f85ae5 (patch)
tree7d440d23473196af3056bf2ff4c59d9e740a06f5 /Minecraft.World/FishingHook.cpp
parentd63f79325f85e014361eb8cf1e41eaebedb1ae71 (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/FishingHook.cpp')
-rw-r--r--Minecraft.World/FishingHook.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/Minecraft.World/FishingHook.cpp b/Minecraft.World/FishingHook.cpp
index efa2dbc6..d1fd5bb6 100644
--- a/Minecraft.World/FishingHook.cpp
+++ b/Minecraft.World/FishingHook.cpp
@@ -38,7 +38,7 @@ void FishingHook::_init()
lyr = 0.0;
lxr = 0.0;
lxd = 0.0;
- lyd = 0.0;
+ lyd = 0.0;
lzd = 0.0;
owner = nullptr;
life = 0;
@@ -52,7 +52,7 @@ FishingHook::FishingHook(Level *level) : Entity( level )
_init();
}
-FishingHook::FishingHook(Level *level, double x, double y, double z, shared_ptr<Player> owner) : Entity( level )
+FishingHook::FishingHook(Level *level, double x, double y, double z, std::shared_ptr<Player> owner) : Entity( level )
{
_init();
@@ -63,7 +63,7 @@ FishingHook::FishingHook(Level *level, double x, double y, double z, shared_ptr<
setPos(x, y, z);
}
-FishingHook::FishingHook(Level *level, shared_ptr<Player> mob) : Entity( level )
+FishingHook::FishingHook(Level *level, std::shared_ptr<Player> mob) : Entity( level )
{
_init();
@@ -172,7 +172,7 @@ void FishingHook::tick()
if (!level->isClientSide)
{
- shared_ptr<ItemInstance> selectedItem = owner->getSelectedItem();
+ std::shared_ptr<ItemInstance> selectedItem = owner->getSelectedItem();
if (owner->removed || !owner->isAlive() || selectedItem == NULL || selectedItem->getItem() != Item::fishingRod || this->distanceToSqr(owner) > 32 * 32)
{
remove();
@@ -195,7 +195,7 @@ void FishingHook::tick()
if (shakeTime > 0) shakeTime--;
- if (inGround)
+ if (inGround)
{
int tile = level->getTile(xTile, yTile, zTile);
if (tile != lastTile)
@@ -226,17 +226,17 @@ void FishingHook::tick()
from = Vec3::newTemp(x, y, z);
to = Vec3::newTemp(x + xd, y + yd, z + zd);
- if (res != NULL)
+ if (res != NULL)
{
to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z);
}
- shared_ptr<Entity> hitEntity = nullptr;
- vector<shared_ptr<Entity> > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1));
+ std::shared_ptr<Entity> hitEntity = nullptr;
+ vector<std::shared_ptr<Entity> > *objects = level->getEntities(shared_from_this(), this->bb->expand(xd, yd, zd)->grow(1, 1, 1));
double nearest = 0;
AUTO_VAR(itEnd, objects->end());
for (AUTO_VAR(it, objects->begin()); it != itEnd; it++)
{
- shared_ptr<Entity> e = *it; // objects->at(i);
+ std::shared_ptr<Entity> e = *it; // objects->at(i);
if (!e->isPickable() || (e == owner && flightTime < 5)) continue;
float rr = 0.3f;
@@ -262,7 +262,7 @@ void FishingHook::tick()
if (res != NULL)
{
- if (res->entity != NULL)
+ if (res->entity != NULL)
{
// 4J Stu Move fix for : fix for #48587 - CRASH: Code: Gameplay: Hitting another player with the fishing bobber crashes the game. [Fishing pole, line]
// Incorrect dynamic_pointer_cast used around the shared_from_this()
@@ -327,7 +327,7 @@ void FishingHook::tick()
if (nibble > 0)
{
nibble--;
- }
+ }
else
{
int nibbleOdds = 500;
@@ -356,7 +356,7 @@ void FishingHook::tick()
}
- if (nibble > 0)
+ if (nibble > 0)
{
yd -= random->nextFloat() * random->nextFloat() * random->nextFloat() * 0.2;
}
@@ -421,7 +421,7 @@ int FishingHook::retrieve()
}
else if (nibble > 0)
{
- shared_ptr<ItemEntity> ie = shared_ptr<ItemEntity>( new ItemEntity(this->Entity::level, x, y, z, shared_ptr<ItemInstance>( new ItemInstance(Item::fish_raw) ) ) );
+ std::shared_ptr<ItemEntity> ie = std::shared_ptr<ItemEntity>( new ItemEntity(this->Entity::level, x, y, z, std::shared_ptr<ItemInstance>( new ItemInstance(Item::fish_raw) ) ) );
double xa = owner->x - x;
double ya = owner->y - y;
double za = owner->z - z;
@@ -432,7 +432,7 @@ int FishingHook::retrieve()
ie->Entity::yd = ya * speed + sqrt(dist) * 0.08;
ie->Entity::zd = za * speed;
level->addEntity(ie);
- owner->level->addEntity( shared_ptr<ExperienceOrb>( new ExperienceOrb(owner->level, owner->x, owner->y + 0.5f, owner->z + 0.5f, random->nextInt(3) + 1) ) ); // 4J Stu brought forward from 1.4
+ owner->level->addEntity( std::shared_ptr<ExperienceOrb>( new ExperienceOrb(owner->level, owner->x, owner->y + 0.5f, owner->z + 0.5f, random->nextInt(3) + 1) ) ); // 4J Stu brought forward from 1.4
dmg = 1;
}
if (inGround) dmg = 2;