aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Mob.cpp
diff options
context:
space:
mode:
authorvoid_17 <heroerror3@gmail.com>2026-03-02 17:10:34 +0700
committervoid_17 <heroerror3@gmail.com>2026-03-02 17:10:34 +0700
commit07ad68bc156b3ab70401723bb074a29588ad3cb7 (patch)
treefcd5c35bb393920e46af6c9b643d0544e78b5ab8 /Minecraft.World/Mob.cpp
parent7bee4770df1540c2daf3121c0790332fb41e72dd (diff)
dynamic_pointer_cast -> std::dynamic_pointer_cast
Diffstat (limited to 'Minecraft.World/Mob.cpp')
-rw-r--r--Minecraft.World/Mob.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/Minecraft.World/Mob.cpp b/Minecraft.World/Mob.cpp
index 23f8639e..74fb7c19 100644
--- a/Minecraft.World/Mob.cpp
+++ b/Minecraft.World/Mob.cpp
@@ -205,7 +205,7 @@ std::shared_ptr<Mob> Mob::getLastHurtMob()
void Mob::setLastHurtMob(std::shared_ptr<Entity> target)
{
- std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(target);
+ std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(target);
if (mob != NULL) lastHurtMob = mob;
}
@@ -661,7 +661,7 @@ bool Mob::hurt(DamageSource *source, int dmg)
if ( source->isFire() && hasEffect(MobEffect::fireResistance) )
{
// 4J-JEV, for new achievement Stayin'Frosty, TODO merge with Java version.
- std::shared_ptr<Player> plr = dynamic_pointer_cast<Player>(shared_from_this());
+ std::shared_ptr<Player> plr = std::dynamic_pointer_cast<Player>(shared_from_this());
if ( plr != NULL && source == DamageSource::lava ) // Only award when in lava (not any fire).
{
plr->awardStat(GenericStats::stayinFrosty(),GenericStats::param_stayinFrosty());
@@ -693,18 +693,18 @@ bool Mob::hurt(DamageSource *source, int dmg)
std::shared_ptr<Entity> sourceEntity = source->getEntity();
if (sourceEntity != NULL)
{
- if (dynamic_pointer_cast<Mob>(sourceEntity) != NULL) {
- setLastHurtByMob(dynamic_pointer_cast<Mob>(sourceEntity));
+ if (std::dynamic_pointer_cast<Mob>(sourceEntity) != NULL) {
+ setLastHurtByMob(std::dynamic_pointer_cast<Mob>(sourceEntity));
}
- if (dynamic_pointer_cast<Player>(sourceEntity) != NULL)
+ if (std::dynamic_pointer_cast<Player>(sourceEntity) != NULL)
{
lastHurtByPlayerTime = PLAYER_HURT_EXPERIENCE_TIME;
- lastHurtByPlayer = dynamic_pointer_cast<Player>(sourceEntity);
+ lastHurtByPlayer = std::dynamic_pointer_cast<Player>(sourceEntity);
}
- else if (dynamic_pointer_cast<Wolf>(sourceEntity))
+ else if (std::dynamic_pointer_cast<Wolf>(sourceEntity))
{
- std::shared_ptr<Wolf> w = dynamic_pointer_cast<Wolf>(sourceEntity);
+ std::shared_ptr<Wolf> w = std::dynamic_pointer_cast<Wolf>(sourceEntity);
if (w->isTame())
{
lastHurtByPlayerTime = PLAYER_HURT_EXPERIENCE_TIME;
@@ -856,14 +856,14 @@ void Mob::die(DamageSource *source)
std::shared_ptr<Entity> sourceEntity = source->getEntity();
if (deathScore >= 0 && sourceEntity != NULL) sourceEntity->awardKillScore(shared_from_this(), deathScore);
- if (sourceEntity != NULL) sourceEntity->killed( dynamic_pointer_cast<Mob>( shared_from_this() ) );
+ if (sourceEntity != NULL) sourceEntity->killed( std::dynamic_pointer_cast<Mob>( shared_from_this() ) );
dead = true;
if (!level->isClientSide)
{
int playerBonus = 0;
- std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(sourceEntity);
+ std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(sourceEntity);
if (player != NULL)
{
playerBonus = EnchantmentHelper::getKillingLootBonus(player->inventory);
@@ -884,7 +884,7 @@ void Mob::die(DamageSource *source)
// 4J-JEV, hook for Durango mobKill event.
if (player != NULL)
{
- player->awardStat(GenericStats::killMob(),GenericStats::param_mobKill(player, dynamic_pointer_cast<Mob>(shared_from_this()), source));
+ player->awardStat(GenericStats::killMob(),GenericStats::param_mobKill(player, std::dynamic_pointer_cast<Mob>(shared_from_this()), source));
}
}
@@ -953,14 +953,14 @@ void Mob::causeFallDamage(float distance)
void Mob::travel(float xa, float ya)
{
#ifdef __PSVITA__
- // AP - dynamic_pointer_cast is a non-trivial call
+ // AP - std::dynamic_pointer_cast is a non-trivial call
Player *thisPlayer = NULL;
if( (GetType() & eTYPE_PLAYER) == eTYPE_PLAYER )
{
thisPlayer = (Player*) this;
}
#else
- std::shared_ptr<Player> thisPlayer = dynamic_pointer_cast<Player>(shared_from_this());
+ std::shared_ptr<Player> thisPlayer = std::dynamic_pointer_cast<Player>(shared_from_this());
#endif
if (isInWater() && !(thisPlayer && thisPlayer->abilities.flying) )
{
@@ -1038,7 +1038,7 @@ void Mob::travel(float xa, float ya)
if (zd > max) zd = max;
this->fallDistance = 0;
if (yd < -0.15) yd = -0.15;
- bool playerSneaking = isSneaking() && dynamic_pointer_cast<Player>(shared_from_this()) != NULL;
+ bool playerSneaking = isSneaking() && std::dynamic_pointer_cast<Player>(shared_from_this()) != NULL;
if (playerSneaking && yd < 0) yd = 0;
}
@@ -1455,7 +1455,7 @@ void Mob::lookAt(std::shared_ptr<Entity> e, float yMax, float xMax)
double yd;
double zd = e->z - z;
- std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(e);
+ std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(e);
if(mob != NULL)
{
yd = (y + getHeadHeight()) - (mob->y + mob->getHeadHeight());
@@ -1657,7 +1657,7 @@ void Mob::tickEffects()
{
MobEffectInstance *effect = it->second;
removed = false;
- if (!effect->tick(dynamic_pointer_cast<Mob>(shared_from_this())))
+ if (!effect->tick(std::dynamic_pointer_cast<Mob>(shared_from_this())))
{
if (!level->isClientSide)
{