dynamic_pointer_cast -> std::dynamic_pointer_cast

This commit is contained in:
void_17
2026-03-02 17:10:34 +07:00
parent 7bee4770df
commit 07ad68bc15
207 changed files with 623 additions and 623 deletions

View File

@@ -26,7 +26,7 @@ AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr<Entity> e)
x = Mth::floor(e->x * 32);
y = Mth::floor(e->y * 32);
z = Mth::floor(e->z * 32);
if (dynamic_pointer_cast<LightningBolt>(e) != NULL)
if (std::dynamic_pointer_cast<LightningBolt>(e) != NULL)
{
this->type = LIGHTNING;
}

View File

@@ -24,7 +24,7 @@ bool AgableMob::interact(std::shared_ptr<Player> player)
eINSTANCEOF classToSpawn = EntityIO::getClass(item->getAuxValue());
if (classToSpawn != eTYPE_NOTSET && (classToSpawn & eTYPE_AGABLE_MOB) == eTYPE_AGABLE_MOB && classToSpawn == GetType() ) // 4J Added GetType() check to only spawn same type
{
std::shared_ptr<AgableMob> offspring = getBreedOffspring(dynamic_pointer_cast<AgableMob>(shared_from_this()));
std::shared_ptr<AgableMob> offspring = getBreedOffspring(std::dynamic_pointer_cast<AgableMob>(shared_from_this()));
if (offspring != NULL)
{
offspring->setAge(-20 * 60 * 20);

View File

@@ -64,7 +64,7 @@ void Animal::aiStep()
void Animal::checkHurtTarget(std::shared_ptr<Entity> target, float d)
{
if (dynamic_pointer_cast<Player>(target) != NULL)
if (std::dynamic_pointer_cast<Player>(target) != NULL)
{
if (d < 3)
{
@@ -75,7 +75,7 @@ void Animal::checkHurtTarget(std::shared_ptr<Entity> target, float d)
holdGround = true;
}
std::shared_ptr<Player> p = dynamic_pointer_cast<Player>(target);
std::shared_ptr<Player> p = std::dynamic_pointer_cast<Player>(target);
if (p->getSelectedItem() != NULL && this->isFood(p->getSelectedItem()))
{
}
@@ -85,9 +85,9 @@ void Animal::checkHurtTarget(std::shared_ptr<Entity> target, float d)
}
}
else if (dynamic_pointer_cast<Animal>(target) != NULL)
else if (std::dynamic_pointer_cast<Animal>(target) != NULL)
{
std::shared_ptr<Animal> a = dynamic_pointer_cast<Animal>(target);
std::shared_ptr<Animal> a = std::dynamic_pointer_cast<Animal>(target);
if (getAge() > 0 && a->getAge() < 0)
{
if (d < 2.5)
@@ -172,15 +172,15 @@ bool Animal::hurt(DamageSource *dmgSource, int dmg)
{
std::shared_ptr<Entity> source = dmgSource->getDirectEntity();
if (dynamic_pointer_cast<Player>(source) != NULL && !dynamic_pointer_cast<Player>(source)->isAllowedToAttackAnimals() )
if (std::dynamic_pointer_cast<Player>(source) != NULL && !std::dynamic_pointer_cast<Player>(source)->isAllowedToAttackAnimals() )
{
return false;
}
if (source != NULL && source->GetType() == eTYPE_ARROW)
{
std::shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(source);
if (dynamic_pointer_cast<Player>(arrow->owner) != NULL && ! dynamic_pointer_cast<Player>(arrow->owner)->isAllowedToAttackAnimals() )
std::shared_ptr<Arrow> arrow = std::dynamic_pointer_cast<Arrow>(source);
if (std::dynamic_pointer_cast<Player>(arrow->owner) != NULL && ! std::dynamic_pointer_cast<Player>(arrow->owner)->isAllowedToAttackAnimals() )
{
return false;
}
@@ -218,7 +218,7 @@ std::shared_ptr<Entity> Animal::findAttackTarget()
//for (int i = 0; i < others->size(); i++)
for(AUTO_VAR(it, others->begin()); it != others->end(); ++it)
{
std::shared_ptr<Animal> p = dynamic_pointer_cast<Animal>(*it);
std::shared_ptr<Animal> p = std::dynamic_pointer_cast<Animal>(*it);
if (p != shared_from_this() && p->getInLoveValue() > 0)
{
delete others;
@@ -237,7 +237,7 @@ std::shared_ptr<Entity> Animal::findAttackTarget()
{
setDespawnProtected();
std::shared_ptr<Player> p = dynamic_pointer_cast<Player>(*it);
std::shared_ptr<Player> p = std::dynamic_pointer_cast<Player>(*it);
if (p->getSelectedItem() != NULL && this->isFood(p->getSelectedItem()))
{
delete players;
@@ -252,7 +252,7 @@ std::shared_ptr<Entity> Animal::findAttackTarget()
//for (int i = 0; i < others.size(); i++)
for(AUTO_VAR(it, others->begin()); it != others->end(); ++it)
{
std::shared_ptr<Animal> p = dynamic_pointer_cast<Animal>(*it);
std::shared_ptr<Animal> p = std::dynamic_pointer_cast<Animal>(*it);
if (p != shared_from_this() && p->getAge() < 0)
{
delete others;

View File

@@ -57,7 +57,7 @@ Arrow::Arrow(Level *level, std::shared_ptr<Mob> mob, std::shared_ptr<Mob> target
_init();
this->owner = mob;
if ( dynamic_pointer_cast<Player>( mob ) != NULL) pickup = PICKUP_ALLOWED;
if ( std::dynamic_pointer_cast<Player>( mob ) != NULL) pickup = PICKUP_ALLOWED;
y = mob->y + mob->getHeadHeight() - 0.1f;
@@ -94,7 +94,7 @@ Arrow::Arrow(Level *level, std::shared_ptr<Mob> mob, float power) : Entity( leve
_init();
this->owner = mob;
if ( dynamic_pointer_cast<Player>( mob ) != NULL) pickup = PICKUP_ALLOWED;
if ( std::dynamic_pointer_cast<Player>( mob ) != NULL) pickup = PICKUP_ALLOWED;
setSize(0.5f, 0.5f);
@@ -281,11 +281,11 @@ void Arrow::tick()
DamageSource *damageSource = NULL;
if (owner == NULL)
{
damageSource = DamageSource::arrow(dynamic_pointer_cast<Arrow>(shared_from_this()), shared_from_this());
damageSource = DamageSource::arrow(std::dynamic_pointer_cast<Arrow>(shared_from_this()), shared_from_this());
}
else
{
damageSource = DamageSource::arrow(dynamic_pointer_cast<Arrow>(shared_from_this()), owner);
damageSource = DamageSource::arrow(std::dynamic_pointer_cast<Arrow>(shared_from_this()), owner);
}
if(res->entity->hurt(damageSource, dmg))
@@ -299,7 +299,7 @@ void Arrow::tick()
res->entity->setOnFire(5);
}
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(res->entity);
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(res->entity);
if (mob != NULL)
{
mob->arrowCount++;
@@ -319,12 +319,12 @@ void Arrow::tick()
}
// 4J : WESTY : For award, need to track if creeper was killed by arrow from the player.
if ( (dynamic_pointer_cast<Player>(owner) != NULL ) && // arrow owner is a player
if ( (std::dynamic_pointer_cast<Player>(owner) != NULL ) && // arrow owner is a player
( res->entity->isAlive() == false ) && // target is now dead
( dynamic_pointer_cast<Creeper>( res->entity ) != NULL ) ) // target is a creeper
( std::dynamic_pointer_cast<Creeper>( res->entity ) != NULL ) ) // target is a creeper
{
dynamic_pointer_cast<Player>(owner)->awardStat(
std::dynamic_pointer_cast<Player>(owner)->awardStat(
GenericStats::arrowKillCreeper(),
GenericStats::param_arrowKillCreeper()
);

View File

@@ -72,13 +72,13 @@ void ArrowAttackGoal::fireAtTarget()
std::shared_ptr<Mob> tar = target.lock();
if (projectileType == ArrowType)
{
std::shared_ptr<Arrow> arrow = std::shared_ptr<Arrow>( new Arrow(level, dynamic_pointer_cast<Mob>(mob->shared_from_this()), tar, 1.60f, 12) );
std::shared_ptr<Arrow> arrow = std::shared_ptr<Arrow>( new Arrow(level, std::dynamic_pointer_cast<Mob>(mob->shared_from_this()), tar, 1.60f, 12) );
level->playSound(mob->shared_from_this(), eSoundType_RANDOM_BOW, 1.0f, 1 / (mob->getRandom()->nextFloat() * 0.4f + 0.8f));
level->addEntity(arrow);
}
else if (projectileType == SnowballType)
{
std::shared_ptr<Snowball> snowball = std::shared_ptr<Snowball>( new Snowball(level, dynamic_pointer_cast<Mob>(mob->shared_from_this())) );
std::shared_ptr<Snowball> snowball = std::shared_ptr<Snowball>( new Snowball(level, std::dynamic_pointer_cast<Mob>(mob->shared_from_this())) );
double xd = tar->x - mob->x;
double yd = (tar->y + tar->getHeadHeight() - 1.1f) - snowball->y;
double zd = tar->z - mob->z;

View File

@@ -33,7 +33,7 @@ bool AvoidPlayerGoal::canUse()
{
if (avoidType == typeid(Player))
{
std::shared_ptr<TamableAnimal> tamableAnimal = dynamic_pointer_cast<TamableAnimal>(mob->shared_from_this());
std::shared_ptr<TamableAnimal> tamableAnimal = std::dynamic_pointer_cast<TamableAnimal>(mob->shared_from_this());
if (tamableAnimal != NULL && tamableAnimal->isTame()) return false;
toAvoid = weak_ptr<Entity>(mob->level->getNearestPlayer(mob->shared_from_this(), maxDist));
if (toAvoid.lock() == NULL) return false;
@@ -52,7 +52,7 @@ bool AvoidPlayerGoal::canUse()
if (!mob->getSensing()->canSee(toAvoid.lock())) return false;
Vec3 *pos = RandomPos::getPosAvoid(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 7, Vec3::newTemp(toAvoid.lock()->x, toAvoid.lock()->y, toAvoid.lock()->z));
Vec3 *pos = RandomPos::getPosAvoid(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 7, Vec3::newTemp(toAvoid.lock()->x, toAvoid.lock()->y, toAvoid.lock()->z));
if (pos == NULL) return false;
if (toAvoid.lock()->distanceToSqr(pos->x, pos->y, pos->z) < toAvoid.lock()->distanceToSqr(mob->shared_from_this())) return false;
delete path;

View File

@@ -154,7 +154,7 @@ void Blaze::checkHurtTarget(std::shared_ptr<Entity> target, float d)
level->levelEvent(nullptr, LevelEvent::SOUND_BLAZE_FIREBALL, (int) x, (int) y, (int) z, 0);
// level.playSound(this, "mob.ghast.fireball", getSoundVolume(), (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
for (int i = 0; i < 1; i++) {
std::shared_ptr<SmallFireball> ie = std::shared_ptr<SmallFireball>( new SmallFireball(level, dynamic_pointer_cast<Mob>( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) );
std::shared_ptr<SmallFireball> ie = std::shared_ptr<SmallFireball>( new SmallFireball(level, std::dynamic_pointer_cast<Mob>( shared_from_this() ), xd + random->nextGaussian() * sqd, yd, zd + random->nextGaussian() * sqd) );
// Vec3 v = getViewVector(1);
// ie.x = x + v.x * 1.5;
ie->y = y + bbHeight / 2 + 0.5f;

View File

@@ -100,8 +100,8 @@ bool Boat::hurt(DamageSource *source, int hurtDamage)
{
std::shared_ptr<Entity> attacker = source->getDirectEntity();
if (dynamic_pointer_cast<Player>(attacker) != NULL &&
!dynamic_pointer_cast<Player>(attacker)->isAllowedToHurtEntity( shared_from_this() ))
if (std::dynamic_pointer_cast<Player>(attacker) != NULL &&
!std::dynamic_pointer_cast<Player>(attacker)->isAllowedToHurtEntity( shared_from_this() ))
return false;
}
@@ -117,7 +117,7 @@ bool Boat::hurt(DamageSource *source, int hurtDamage)
markHurt();
// 4J Stu - Brought froward from 12w36 to fix #46611 - TU5: Gameplay: Minecarts and boat requires more hits than one to be destroyed in creative mode
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(source->getEntity());
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(source->getEntity());
if (player != NULL && player->abilities.instabuild) setDamage(100);
if (getDamage() > 20 * 2)
@@ -469,7 +469,7 @@ wstring Boat::getName()
bool Boat::interact(std::shared_ptr<Player> player)
{
if (rider.lock() != NULL && dynamic_pointer_cast<Player>(rider.lock())!=NULL && rider.lock() != player) return true;
if (rider.lock() != NULL && std::dynamic_pointer_cast<Player>(rider.lock())!=NULL && rider.lock() != player) return true;
if (!level->isClientSide)
{
// 4J HEG - Fixed issue with player not being able to dismount boat (issue #4446)

View File

@@ -58,7 +58,7 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z,
if (force || ( level->isEmptyTile(x2, y2, z2) && level->isTopSolidBlocking(x2, y2 - 1, z2)))
{
level->setTile(x2, y2, z2, Tile::chest_Id);
std::shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x2, y2, z2));
std::shared_ptr<ChestTileEntity> chest = std::dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x2, y2, z2));
if (chest != NULL)
{
WeighedTreasure::addChestItems(random, treasureList, chest, numRolls);

View File

@@ -34,7 +34,7 @@ bool BossMobPart::isPickable()
bool BossMobPart::hurt(DamageSource *source, int damage)
{
return bossMob->hurt( dynamic_pointer_cast<BossMobPart>( shared_from_this() ), source, damage);
return bossMob->hurt( std::dynamic_pointer_cast<BossMobPart>( shared_from_this() ), source, damage);
}
bool BossMobPart::is(std::shared_ptr<Entity> other)

View File

@@ -52,7 +52,7 @@ std::shared_ptr<Animal> BreedGoal::getFreePartner()
vector<std::shared_ptr<Entity> > *others = level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(r, r, r));
for(AUTO_VAR(it, others->begin()); it != others->end(); ++it)
{
std::shared_ptr<Animal> p = dynamic_pointer_cast<Animal>(*it);
std::shared_ptr<Animal> p = std::dynamic_pointer_cast<Animal>(*it);
if (animal->canMate(p))
{
delete others;

View File

@@ -12,9 +12,9 @@ BrewingStandMenu::BrewingStandMenu(std::shared_ptr<Inventory> inventory, std::sh
this->brewingStand = brewingStand;
addSlot(new PotionSlot(dynamic_pointer_cast<Player>( inventory->player->shared_from_this() ), brewingStand, 0, 56, 46));
addSlot(new PotionSlot(dynamic_pointer_cast<Player>( inventory->player->shared_from_this() ), brewingStand, 1, 79, 53));
addSlot(new PotionSlot(dynamic_pointer_cast<Player>( inventory->player->shared_from_this() ), brewingStand, 2, 102, 46));
addSlot(new PotionSlot(std::dynamic_pointer_cast<Player>( inventory->player->shared_from_this() ), brewingStand, 0, 56, 46));
addSlot(new PotionSlot(std::dynamic_pointer_cast<Player>( inventory->player->shared_from_this() ), brewingStand, 1, 79, 53));
addSlot(new PotionSlot(std::dynamic_pointer_cast<Player>( inventory->player->shared_from_this() ), brewingStand, 2, 102, 46));
ingredientSlot = addSlot(new IngredientsSlot(brewingStand, 3, 79, 17));
for (int y = 0; y < 3; y++)
@@ -190,7 +190,7 @@ int BrewingStandMenu::PotionSlot::getMaxStackSize()
void BrewingStandMenu::PotionSlot::onTake(std::shared_ptr<Player> player, std::shared_ptr<ItemInstance> carried)
{
carried->onCraftedBy(this->player->level, dynamic_pointer_cast<Player>( this->player->shared_from_this() ), 1);
carried->onCraftedBy(this->player->level, std::dynamic_pointer_cast<Player>( this->player->shared_from_this() ), 1);
if (carried->id == Item::potion_Id && carried->getAuxValue() > 0)
this->player->awardStat(GenericStats::potion(),GenericStats::param_potion());
Slot::onTake(player, carried);

View File

@@ -60,7 +60,7 @@ bool BrewingStandTile::use(Level *level, int x, int y, int z, std::shared_ptr<Pl
{
return true;
}
std::shared_ptr<BrewingStandTileEntity> brewingStand = dynamic_pointer_cast<BrewingStandTileEntity>(level->getTileEntity(x, y, z));
std::shared_ptr<BrewingStandTileEntity> brewingStand = std::dynamic_pointer_cast<BrewingStandTileEntity>(level->getTileEntity(x, y, z));
if (brewingStand != NULL) player->openBrewingStand(brewingStand);
return true;
@@ -79,9 +79,9 @@ void BrewingStandTile::animateTick(Level *level, int xt, int yt, int zt, Random
void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int data)
{
std::shared_ptr<TileEntity> tileEntity = level->getTileEntity(x, y, z);
if (tileEntity != NULL && ( dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity) != NULL) )
if (tileEntity != NULL && ( std::dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity) != NULL) )
{
std::shared_ptr<BrewingStandTileEntity> container = dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity);
std::shared_ptr<BrewingStandTileEntity> container = std::dynamic_pointer_cast<BrewingStandTileEntity>(tileEntity);
for (int i = 0; i < container->getContainerSize(); i++)
{
std::shared_ptr<ItemInstance> item = container->getItem(i);

View File

@@ -120,7 +120,7 @@ std::shared_ptr<ItemInstance> BucketItem::use(std::shared_ptr<ItemInstance> item
if (!level->mayInteract(player, xt, yt, zt,content))
{
app.DebugPrintf("!!!!!!!!!!! Can't place that here\n");
std::shared_ptr<ServerPlayer> servPlayer = dynamic_pointer_cast<ServerPlayer>(player);
std::shared_ptr<ServerPlayer> servPlayer = std::dynamic_pointer_cast<ServerPlayer>(player);
if( servPlayer != NULL )
{
app.DebugPrintf("Sending ChatPacket::e_ChatCannotPlaceLava to player\n");

View File

@@ -25,7 +25,7 @@ std::shared_ptr<ItemInstance> CarrotOnAStickItem::use(std::shared_ptr<ItemInstan
{
if (player->isRiding())
{
std::shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(player->riding);
std::shared_ptr<Pig> pig = std::dynamic_pointer_cast<Pig>(player->riding);
if(pig)
{
if (pig->getControlGoal()->canBoost() && itemInstance->getMaxDamage() - itemInstance->getAuxValue() >= 7)

View File

@@ -123,9 +123,9 @@ bool CauldronTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player
level->addEntity(std::shared_ptr<ItemEntity>(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion)));
}
// 4J Stu - Brought forward change to update inventory when filling bottles with water
else if (dynamic_pointer_cast<ServerPlayer>( player ) != NULL)
else if (std::dynamic_pointer_cast<ServerPlayer>( player ) != NULL)
{
dynamic_pointer_cast<ServerPlayer>( player )->refreshContainer(player->inventoryMenu);
std::dynamic_pointer_cast<ServerPlayer>( player )->refreshContainer(player->inventoryMenu);
}
// 4J-PB - don't lose the water in creative mode
if (player->abilities.instabuild==false)

View File

@@ -32,7 +32,7 @@ bool CaveSpider::doHurtTarget(std::shared_ptr<Entity> target)
{
if (Spider::doHurtTarget(target))
{
if ( dynamic_pointer_cast<Mob>(target) != NULL)
if ( std::dynamic_pointer_cast<Mob>(target) != NULL)
{
int poisonTime = 0;
if (level->difficulty <= Difficulty::EASY)
@@ -49,7 +49,7 @@ bool CaveSpider::doHurtTarget(std::shared_ptr<Entity> target)
}
if (poisonTime > 0) {
dynamic_pointer_cast<Mob>(target)->addEffect(new MobEffectInstance(MobEffect::poison->id, poisonTime * SharedConstants::TICKS_PER_SECOND, 0));
std::dynamic_pointer_cast<Mob>(target)->addEffect(new MobEffectInstance(MobEffect::poison->id, poisonTime * SharedConstants::TICKS_PER_SECOND, 0));
}
}

View File

@@ -200,13 +200,13 @@ bool ChestTile::isFullChest(Level *level, int x, int y, int z)
void ChestTile::neighborChanged(Level *level, int x, int y, int z, int type)
{
EntityTile::neighborChanged(level, x, y, z, type);
std::shared_ptr<ChestTileEntity>(cte) = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z));
std::shared_ptr<ChestTileEntity>(cte) = std::dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z));
if (cte != NULL) cte->clearCache();
}
void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data)
{
std::shared_ptr<Container> container = dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<Container> container = std::dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
if (container != NULL )
{
for (unsigned int i = 0; i < container->getContainerSize(); i++)
@@ -263,7 +263,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> p
return true;
}
std::shared_ptr<Container> container = dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<Container> container = std::dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z) );
if (container == NULL) return true;
if (level->isSolidBlockingTile(x, y + 1, z)) return true;
@@ -274,10 +274,10 @@ bool ChestTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> p
if (level->getTile(x, y, z - 1) == id && (level->isSolidBlockingTile(x, y + 1, z - 1) || isCatSittingOnChest(level, x, y, z - 1))) return true;
if (level->getTile(x, y, z + 1) == id && (level->isSolidBlockingTile(x, y + 1, z + 1) || isCatSittingOnChest(level, x, y, z + 1))) return true;
if (level->getTile(x - 1, y, z) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x - 1, y, z) ), container) );
if (level->getTile(x + 1, y, z) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x + 1, y, z) )) );
if (level->getTile(x, y, z - 1) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z - 1) ), container) );
if (level->getTile(x, y, z + 1) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z + 1) )) );
if (level->getTile(x - 1, y, z) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, std::dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x - 1, y, z) ), container) );
if (level->getTile(x + 1, y, z) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, std::dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x + 1, y, z) )) );
if (level->getTile(x, y, z - 1) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, std::dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z - 1) ), container) );
if (level->getTile(x, y, z + 1) == id) container = std::shared_ptr<Container>( new CompoundContainer(IDS_CHEST_LARGE, container, std::dynamic_pointer_cast<ChestTileEntity>( level->getTileEntity(x, y, z + 1) )) );
player->openContainer(container);
@@ -290,7 +290,7 @@ bool ChestTile::isCatSittingOnChest(Level *level, int x, int y, int z)
vector<std::shared_ptr<Entity> > *entities = level->getEntitiesOfClass(typeid(Ozelot), AABB::newTemp(x, y + 1, z, x + 1, y + 2, z + 1));
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
{
std::shared_ptr<Ozelot> ocelot = dynamic_pointer_cast<Ozelot>(*it);
std::shared_ptr<Ozelot> ocelot = std::dynamic_pointer_cast<Ozelot>(*it);
if(ocelot->isSitting())
{
return true;

View File

@@ -165,19 +165,19 @@ void ChestTileEntity::checkNeighbors()
if (level->getTile(x - 1, y, z) == Tile::chest_Id)
{
w = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x - 1, y, z));
w = std::dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x - 1, y, z));
}
if (level->getTile(x + 1, y, z) == Tile::chest_Id)
{
e = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x + 1, y, z));
e = std::dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x + 1, y, z));
}
if (level->getTile(x, y, z - 1) == Tile::chest_Id)
{
n = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z - 1));
n = std::dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z - 1));
}
if (level->getTile(x, y, z + 1) == Tile::chest_Id)
{
s = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z + 1));
s = std::dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z + 1));
}
if (n.lock() != NULL) n.lock()->clearCache();

View File

@@ -24,7 +24,7 @@ void ClientCommandPacket::write(DataOutputStream *dos)
void ClientCommandPacket::handle(PacketListener *listener)
{
listener->handleClientCommand(dynamic_pointer_cast<ClientCommandPacket>(shared_from_this()));
listener->handleClientCommand(std::dynamic_pointer_cast<ClientCommandPacket>(shared_from_this()));
}
int ClientCommandPacket::getEstimatedSize()

View File

@@ -90,7 +90,7 @@ std::shared_ptr<ItemInstance> ContainerMenu::clicked(int slotIndex, int buttonNu
std::shared_ptr<ItemInstance> out = AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player);
#ifdef _EXTENDED_ACHIEVEMENTS
std::shared_ptr<LocalPlayer> localPlayer = dynamic_pointer_cast<LocalPlayer>(player);
std::shared_ptr<LocalPlayer> localPlayer = std::dynamic_pointer_cast<LocalPlayer>(player);
if (localPlayer != NULL) // 4J-JEV: For "Chestful o'Cobblestone" achievement.
{

View File

@@ -36,13 +36,13 @@ void ControlledByPlayerGoal::stop()
bool ControlledByPlayerGoal::canUse()
{
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>( mob->rider.lock() );
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>( mob->rider.lock() );
return mob->isAlive() && player && (boosting || mob->canBeControlledByRider());
}
void ControlledByPlayerGoal::tick()
{
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob->rider.lock());
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(mob->rider.lock());
PathfinderMob *pig = (PathfinderMob *)mob;
float yrd = Mth::wrapDegrees(player->yRot - mob->yRot) * 0.5f;

View File

@@ -120,13 +120,13 @@ void Creeper::die(DamageSource *source)
{
Monster::die(source);
if ( dynamic_pointer_cast<Skeleton>(source->getEntity()) != NULL )
if ( std::dynamic_pointer_cast<Skeleton>(source->getEntity()) != NULL )
{
spawnAtLocation(Item::record_01_Id + random->nextInt(12), 1);
}
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(source->getEntity());
if ( (dynamic_pointer_cast<Arrow>(source->getDirectEntity()) != NULL) && (player != NULL) )
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(source->getEntity());
if ( (std::dynamic_pointer_cast<Arrow>(source->getDirectEntity()) != NULL) && (player != NULL) )
{
player->awardStat(GenericStats::archer(), GenericStats::param_archer());
}

View File

@@ -13,7 +13,7 @@ bool DefendVillageTargetGoal::canUse()
{
std::shared_ptr<Village> village = golem->getVillage();
if (village == NULL) return false;
potentialTarget = weak_ptr<Mob>(village->getClosestAggressor(dynamic_pointer_cast<Mob>(golem->shared_from_this())));
potentialTarget = weak_ptr<Mob>(village->getClosestAggressor(std::dynamic_pointer_cast<Mob>(golem->shared_from_this())));
return canAttack(potentialTarget.lock(), false);
}

View File

@@ -107,7 +107,7 @@ bool DispenserTile::use(Level *level, int x, int y, int z, std::shared_ptr<Playe
return true;
}
std::shared_ptr<DispenserTileEntity> trap = dynamic_pointer_cast<DispenserTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<DispenserTileEntity> trap = std::dynamic_pointer_cast<DispenserTileEntity>( level->getTileEntity(x, y, z) );
player->openTrap(trap);
return true;
@@ -138,7 +138,7 @@ void DispenserTile::fireArrow(Level *level, int x, int y, int z, Random *random)
xd = -1;
}
std::shared_ptr<DispenserTileEntity> trap = dynamic_pointer_cast<DispenserTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<DispenserTileEntity> trap = std::dynamic_pointer_cast<DispenserTileEntity>( level->getTileEntity(x, y, z) );
if(trap != NULL)
{
int slot=trap->getRandomSlot();
@@ -207,7 +207,7 @@ void DispenserTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_p
void DispenserTile::onRemove(Level *level, int x, int y, int z, int id, int data)
{
std::shared_ptr<Container> container = dynamic_pointer_cast<DispenserTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<Container> container = std::dynamic_pointer_cast<DispenserTileEntity>( level->getTileEntity(x, y, z) );
if (container != NULL )
{
for (unsigned int i = 0; i < container->getContainerSize(); i++)
@@ -422,7 +422,7 @@ int DispenserTile::dispenseItem(std::shared_ptr<DispenserTileEntity> trap, Level
//MonsterPlacerItem *spawnEgg = (MonsterPlacerItem *)item->getItem();
std::shared_ptr<Entity> newEntity = MonsterPlacerItem::canSpawn(item->getAuxValue(), level,&iResult);
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(newEntity);
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(newEntity);
if (mob != NULL)
{
// 4J-PB - Changed the line below slightly since mobs were sticking to the dispenser rather than dropping down when fired

View File

@@ -40,7 +40,7 @@ void DragonFireball::onHit(HitResult *res)
for( AUTO_VAR(it, entitiesOfClass->begin()); it != entitiesOfClass->end(); ++it)
{
//std::shared_ptr<Entity> e = *it;
std::shared_ptr<Mob> e = dynamic_pointer_cast<Mob>( *it );
std::shared_ptr<Mob> e = std::dynamic_pointer_cast<Mob>( *it );
double dist = distanceToSqr(e);
if (dist < SPLASH_RANGE_SQ)
{

View File

@@ -291,9 +291,9 @@ mainloop: continue;
bool DyePowderItem::interactEnemy(std::shared_ptr<ItemInstance> itemInstance, std::shared_ptr<Mob> mob)
{
if (dynamic_pointer_cast<Sheep>( mob ) != NULL)
if (std::dynamic_pointer_cast<Sheep>( mob ) != NULL)
{
std::shared_ptr<Sheep> sheep = dynamic_pointer_cast<Sheep>(mob);
std::shared_ptr<Sheep> sheep = std::dynamic_pointer_cast<Sheep>(mob);
// convert to tile-based color value (0 is white instead of black)
int newColor = ClothTile::getTileDataForItemAuxValue(itemInstance->getAuxValue());
if (!sheep->isSheared() && sheep->getColor() != newColor)

View File

@@ -25,7 +25,7 @@ std::shared_ptr<ItemInstance> EggItem::use(std::shared_ptr<ItemInstance> instanc
{
instance->count--;
}
level->playSound( dynamic_pointer_cast<Entity>(player), eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f));
if (!level->isClientSide) level->addEntity( std::shared_ptr<ThrownEgg>( new ThrownEgg(level, dynamic_pointer_cast<Mob>( player )) ));
level->playSound( std::dynamic_pointer_cast<Entity>(player), eSoundType_RANDOM_BOW, 0.5f, 0.4f / (random->nextFloat() * 0.4f + 0.8f));
if (!level->isClientSide) level->addEntity( std::shared_ptr<ThrownEgg>( new ThrownEgg(level, std::dynamic_pointer_cast<Mob>( player )) ));
return instance;
}

View File

@@ -64,7 +64,7 @@ void EnderChestTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_
bool EnderChestTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly)
{
std::shared_ptr<PlayerEnderChestContainer> container = player->getEnderChestInventory();
std::shared_ptr<EnderChestTileEntity> enderChest = dynamic_pointer_cast<EnderChestTileEntity>(level->getTileEntity(x, y, z));
std::shared_ptr<EnderChestTileEntity> enderChest = std::dynamic_pointer_cast<EnderChestTileEntity>(level->getTileEntity(x, y, z));
if (container == NULL || enderChest == NULL) return true;
if (level->isSolidBlockingTile(x, y + 1, z)) return true;

View File

@@ -91,7 +91,7 @@ bool EnderCrystal::isPickable()
bool EnderCrystal::hurt(DamageSource *source, int damage)
{
// 4J-PB - if the owner of the source is the enderdragon, then ignore it (where the dragon's fireball hits an endercrystal)
std::shared_ptr<EnderDragon> sourceIsDragon = dynamic_pointer_cast<EnderDragon>(source->getEntity());
std::shared_ptr<EnderDragon> sourceIsDragon = std::dynamic_pointer_cast<EnderDragon>(source->getEntity());
if(sourceIsDragon!=NULL)
{
@@ -114,7 +114,7 @@ bool EnderCrystal::hurt(DamageSource *source, int damage)
for (AUTO_VAR(it, entities.begin()); it != itEnd; it++)
{
std::shared_ptr<Entity> e = *it; //entities->at(i);
dragon = dynamic_pointer_cast<EnderDragon>(e);
dragon = std::dynamic_pointer_cast<EnderDragon>(e);
if(dragon != NULL)
{
dragon->handleCrystalDestroyed(source);

View File

@@ -444,7 +444,7 @@ void EnderDragon::aiStep()
for( AUTO_VAR(it, targets->begin() ); it != targets->end(); ++it)
{
std::shared_ptr<Mob> e = dynamic_pointer_cast<Mob>( *it );
std::shared_ptr<Mob> e = std::dynamic_pointer_cast<Mob>( *it );
if (e != NULL)
{
//app.DebugPrintf("Attacking entity with acid\n");
@@ -734,7 +734,7 @@ void EnderDragon::aiStep()
double zdd = attackTarget->z - startingZ;
level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, (int) x, (int) y, (int) z, 0);
std::shared_ptr<DragonFireball> ie = std::shared_ptr<DragonFireball>( new DragonFireball(level, dynamic_pointer_cast<Mob>( shared_from_this() ), xdd, ydd, zdd) );
std::shared_ptr<DragonFireball> ie = std::shared_ptr<DragonFireball>( new DragonFireball(level, std::dynamic_pointer_cast<Mob>( shared_from_this() ), xdd, ydd, zdd) );
ie->x = startingX;
ie->y = startingY;
ie->z = startingZ;
@@ -800,7 +800,7 @@ void EnderDragon::checkCrystals()
//for (Entity ec : crystals)
for(AUTO_VAR(it, crystals->begin()); it != crystals->end(); ++it)
{
std::shared_ptr<EnderCrystal> ec = dynamic_pointer_cast<EnderCrystal>( *it );
std::shared_ptr<EnderCrystal> ec = std::dynamic_pointer_cast<EnderCrystal>( *it );
double dist = ec->distanceToSqr(shared_from_this() );
if (dist < nearest)
{
@@ -840,7 +840,7 @@ void EnderDragon::knockBack(vector<std::shared_ptr<Entity> > *entities)
//for (Entity e : entities)
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
{
std::shared_ptr<Mob> e = dynamic_pointer_cast<Mob>( *it );
std::shared_ptr<Mob> e = std::dynamic_pointer_cast<Mob>( *it );
if (e != NULL)//(e instanceof Mob)
{
double xd = e->x - xm;
@@ -856,10 +856,10 @@ void EnderDragon::hurt(vector<std::shared_ptr<Entity> > *entities)
//for (int i = 0; i < entities->size(); i++)
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
{
std::shared_ptr<Mob> e = dynamic_pointer_cast<Mob>( *it );//entities.get(i);
std::shared_ptr<Mob> e = std::dynamic_pointer_cast<Mob>( *it );//entities.get(i);
if (e != NULL) //(e instanceof Mob)
{
DamageSource *damageSource = DamageSource::mobAttack( dynamic_pointer_cast<Mob>( shared_from_this() ));
DamageSource *damageSource = DamageSource::mobAttack( std::dynamic_pointer_cast<Mob>( shared_from_this() ));
e->hurt(damageSource, 10);
delete damageSource;
}
@@ -1116,7 +1116,7 @@ bool EnderDragon::hurt(std::shared_ptr<BossMobPart> bossMobPart, DamageSource *s
//zTarget = z - cc1 * 5 + (random->nextFloat() - 0.5f) * 2;
//attackTarget = NULL;
if (source == DamageSource::explosion || (dynamic_pointer_cast<Player>(source->getEntity()) != NULL))
if (source == DamageSource::explosion || (std::dynamic_pointer_cast<Player>(source->getEntity()) != NULL))
{
int healthBefore = health;
reallyHurt(source, damage);
@@ -1461,11 +1461,11 @@ void EnderDragon::handleCrystalDestroyed(DamageSource *source)
#endif
}
}
else if(dynamic_pointer_cast<Player>(source->getEntity()) != NULL)
else if(std::dynamic_pointer_cast<Player>(source->getEntity()) != NULL)
{
if(setSynchedAction(e_EnderdragonAction_StrafePlayer))
{
attackTarget = dynamic_pointer_cast<Player>(source->getEntity());
attackTarget = std::dynamic_pointer_cast<Player>(source->getEntity());
#if PRINT_DRAGON_STATE_CHANGE_MESSAGES
app.DebugPrintf("Dragon action is now: StrafePlayer\n");
#endif

View File

@@ -211,7 +211,7 @@ void EnderMan::aiStep()
{
if (attackTarget != NULL)
{
if ( dynamic_pointer_cast<Player>(attackTarget) != NULL && isLookingAtMe(dynamic_pointer_cast<Player>(attackTarget)))
if ( std::dynamic_pointer_cast<Player>(attackTarget) != NULL && isLookingAtMe(std::dynamic_pointer_cast<Player>(attackTarget)))
{
xxa = yya = 0;
runSpeed = 0;

View File

@@ -670,7 +670,7 @@ void Entity::move(double xa, double ya, double za, bool noEntityCubes) // 4J -
AABB *bbOrg = bb->copy();
bool isPlayerSneaking = onGround && isSneaking() && dynamic_pointer_cast<Player>(shared_from_this()) != NULL;
bool isPlayerSneaking = onGround && isSneaking() && std::dynamic_pointer_cast<Player>(shared_from_this()) != NULL;
if (isPlayerSneaking)
{
@@ -1001,7 +1001,7 @@ void Entity::checkFallDamage(double ya, bool onGround)
{
if (fallDistance > 0)
{
if (dynamic_pointer_cast<Mob>(shared_from_this()) != NULL)
if (std::dynamic_pointer_cast<Mob>(shared_from_this()) != NULL)
{
int xt = Mth::floor(x);
int yt = Mth::floor(y - 0.2f - this->heightOffset);
@@ -1534,7 +1534,7 @@ void Entity::positionRider()
std::shared_ptr<Entity> lockedRider = rider.lock();
if( lockedRider )
{
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(lockedRider);
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(lockedRider);
if (!(player && player->isLocalPlayer()))
{
lockedRider->xOld = xOld;

View File

@@ -26,7 +26,7 @@ std::shared_ptr<ChatPacket> EntityDamageSource::getDeathMessagePacket(std::share
wstring additional = L"";
if(entity->GetType() == eTYPE_SERVERPLAYER)
{
std::shared_ptr<Player> sourcePlayer = dynamic_pointer_cast<Player>(entity);
std::shared_ptr<Player> sourcePlayer = std::dynamic_pointer_cast<Player>(entity);
if(sourcePlayer != NULL) additional = sourcePlayer->name;
}
return std::shared_ptr<ChatPacket>( new ChatPacket(player->name, m_msgId, entity->GetType(), additional ) );
@@ -34,5 +34,5 @@ std::shared_ptr<ChatPacket> EntityDamageSource::getDeathMessagePacket(std::share
bool EntityDamageSource::scalesWithDifficulty()
{
return entity != NULL && dynamic_pointer_cast<Mob>(entity) && !(dynamic_pointer_cast<Player>(entity));
return entity != NULL && std::dynamic_pointer_cast<Mob>(entity) && !(std::dynamic_pointer_cast<Player>(entity));
}

View File

@@ -149,7 +149,7 @@ void Explosion::explode()
e->yd += ya * push;
e->zd += za * push;
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
if (player != NULL)
{
//app.DebugPrintf("Adding player knockback (%f,%f,%f)\n", xa * pow, ya * pow, za * pow);

View File

@@ -81,7 +81,7 @@ void FarmTile::fallOn(Level *level, int x, int y, int z, std::shared_ptr<Entity>
if (!level->isClientSide && level->random->nextFloat() < (fallDistance - .5f))
{
// Fix for #60547 - TU7: Content: Gameplay: Players joining a game can destroy crops even with Trust Players option disabled.
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(entity);
if(player == NULL || player->isAllowedToMine()) level->setTile(x, y, z, Tile::dirt_Id);
}
}

View File

@@ -298,7 +298,7 @@ void Fireball::onHit(HitResult *res)
{
if (res->entity != NULL)
{
DamageSource *damageSource = DamageSource::fireball(dynamic_pointer_cast<Fireball>( shared_from_this() ), owner);
DamageSource *damageSource = DamageSource::fireball(std::dynamic_pointer_cast<Fireball>( shared_from_this() ), owner);
if (res->entity->hurt(damageSource, 6))
{
}
@@ -374,7 +374,7 @@ bool Fireball::hurt(DamageSource *source, int damage)
yPower = yd * 0.1;
zPower = zd * 0.1;
}
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>( source->getEntity() );
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>( source->getEntity() );
if (mob != NULL)
{
owner = mob;

View File

@@ -58,7 +58,7 @@ FishingHook::FishingHook(Level *level, double x, double y, double z, std::shared
this->owner = owner;
// 4J Stu - Moved this outside the ctor
//owner->fishing = dynamic_pointer_cast<FishingHook>( shared_from_this() );
//owner->fishing = std::dynamic_pointer_cast<FishingHook>( shared_from_this() );
setPos(x, y, z);
}
@@ -69,7 +69,7 @@ FishingHook::FishingHook(Level *level, std::shared_ptr<Player> mob) : Entity( le
this->owner = mob;
// 4J Stu - Moved this outside the ctor
//owner->fishing = dynamic_pointer_cast<FishingHook>( shared_from_this() );
//owner->fishing = std::dynamic_pointer_cast<FishingHook>( shared_from_this() );
this->moveTo(mob->x, mob->y + 1.62 - mob->heightOffset, mob->z, mob->yRot, mob->xRot);
@@ -265,7 +265,7 @@ void FishingHook::tick()
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()
// Incorrect std::dynamic_pointer_cast used around the shared_from_this()
DamageSource *damageSource = DamageSource::thrown(shared_from_this(), owner);
if (res->entity->hurt(damageSource, 0))
{

View File

@@ -24,7 +24,7 @@ bool FollowParentGoal::canUse()
double closestDistSqr = Double::MAX_VALUE;
for(AUTO_VAR(it, parents->begin()); it != parents->end(); ++it)
{
std::shared_ptr<Animal> parent = dynamic_pointer_cast<Animal>(*it);
std::shared_ptr<Animal> parent = std::dynamic_pointer_cast<Animal>(*it);
if (parent->getAge() < 0) continue;
double distSqr = animal->distanceToSqr(parent);
if (distSqr > closestDistSqr) continue;

View File

@@ -18,7 +18,7 @@ FurnaceMenu::FurnaceMenu(std::shared_ptr<Inventory> inventory, std::shared_ptr<F
addSlot(new Slot(furnace, 0, 52 + 4, 13 + 4));
addSlot(new Slot(furnace, 1, 52 + 4, 49 + 4));
addSlot(new FurnaceResultSlot( dynamic_pointer_cast<Player>( inventory->player->shared_from_this() ), furnace, 2, 112 + 4, 31 + 4));
addSlot(new FurnaceResultSlot( std::dynamic_pointer_cast<Player>( inventory->player->shared_from_this() ), furnace, 2, 112 + 4, 31 + 4));
for (int y = 0; y < 3; y++)
{

View File

@@ -112,7 +112,7 @@ bool FurnaceTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player>
{
return true;
}
std::shared_ptr<FurnaceTileEntity> furnace = dynamic_pointer_cast<FurnaceTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<FurnaceTileEntity> furnace = std::dynamic_pointer_cast<FurnaceTileEntity>( level->getTileEntity(x, y, z) );
if (furnace != NULL ) player->openFurnace(furnace);
return true;
}
@@ -154,7 +154,7 @@ void FurnaceTile::onRemove(Level *level, int x, int y, int z, int id, int data)
{
if (!noDrop)
{
std::shared_ptr<Container> container = dynamic_pointer_cast<FurnaceTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<Container> container = std::dynamic_pointer_cast<FurnaceTileEntity>( level->getTileEntity(x, y, z) );
if( container != NULL )
{
for (unsigned int i = 0; i < container->getContainerSize(); i++)

View File

@@ -49,7 +49,7 @@ bool Ghast::hurt(DamageSource *source, int dmg)
{
if (source->getMsgId() == ChatPacket::e_ChatDeathFireball)
{
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>( source->getEntity() );
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>( source->getEntity() );
if (player != NULL)
{
// reflected fireball, kill the ghast
@@ -151,7 +151,7 @@ void Ghast::serverAiStep()
{
// 4J - change brought forward from 1.2.3
level->levelEvent(nullptr, LevelEvent::SOUND_GHAST_FIREBALL, (int) x, (int) y, (int) z, 0);
std::shared_ptr<Fireball> ie = std::shared_ptr<Fireball>( new Fireball(level, dynamic_pointer_cast<Mob>( shared_from_this() ), xdd, ydd, zdd) );
std::shared_ptr<Fireball> ie = std::shared_ptr<Fireball>( new Fireball(level, std::dynamic_pointer_cast<Mob>( shared_from_this() ), xdd, ydd, zdd) );
double d = 4;
Vec3 *v = getViewVector(1);
ie->x = x + v->x * d;

View File

@@ -156,7 +156,7 @@ bool HangingEntity::survives()
for (AUTO_VAR(it, entities->begin()); it != itEnd; it++)
{
std::shared_ptr<Entity> e = (*it);
if(dynamic_pointer_cast<HangingEntity>(e) != NULL)
if(std::dynamic_pointer_cast<HangingEntity>(e) != NULL)
{
return false;
}
@@ -176,7 +176,7 @@ bool HangingEntity::skipAttackInteraction(std::shared_ptr<Entity> source)
{
if(source->GetType()==eTYPE_PLAYER)
{
return hurt(DamageSource::playerAttack(dynamic_pointer_cast<Player>( source)), 0);
return hurt(DamageSource::playerAttack(std::dynamic_pointer_cast<Player>( source)), 0);
}
return false;
}
@@ -189,7 +189,7 @@ bool HangingEntity::hurt(DamageSource *source, int damage)
{
std::shared_ptr<Entity> sourceEntity = source->getDirectEntity();
if (dynamic_pointer_cast<Player>(sourceEntity) != NULL && !dynamic_pointer_cast<Player>(sourceEntity)->isAllowedToHurtEntity(shared_from_this()) )
if (std::dynamic_pointer_cast<Player>(sourceEntity) != NULL && !std::dynamic_pointer_cast<Player>(sourceEntity)->isAllowedToHurtEntity(shared_from_this()) )
{
return false;
}
@@ -202,7 +202,7 @@ bool HangingEntity::hurt(DamageSource *source, int damage)
std::shared_ptr<Entity> e = source->getEntity();
if (e!=NULL && ((e->GetType() & eTYPE_PLAYER)!=0) ) // check if it's serverplayer or player
{
player = dynamic_pointer_cast<Player>( e );
player = std::dynamic_pointer_cast<Player>( e );
}
if (player != NULL && player->abilities.instabuild)

View File

@@ -72,13 +72,13 @@ std::shared_ptr<HangingEntity> HangingEntityItem::createEntity(Level *level, int
std::shared_ptr<Painting> painting = std::shared_ptr<Painting>(new Painting(level, x, y, z, dir));
painting->PaintingPostConstructor(dir);
return dynamic_pointer_cast<HangingEntity> (painting);
return std::dynamic_pointer_cast<HangingEntity> (painting);
}
else if (eType == eTYPE_ITEM_FRAME)
{
std::shared_ptr<ItemFrame> itemFrame = std::shared_ptr<ItemFrame>(new ItemFrame(level, x, y, z, dir));
return dynamic_pointer_cast<HangingEntity> (itemFrame);
return std::dynamic_pointer_cast<HangingEntity> (itemFrame);
}
else
{

View File

@@ -25,7 +25,7 @@ void HurtByTargetGoal::start()
vector<std::shared_ptr<Entity> > *nearby = mob->level->getEntitiesOfClass(typeid(*mob), AABB::newTemp(mob->x, mob->y, mob->z, mob->x + 1, mob->y + 1, mob->z + 1)->grow(within, 4, within));
for(AUTO_VAR(it, nearby->begin()); it != nearby->end(); ++it)
{
std::shared_ptr<Mob> other = dynamic_pointer_cast<Mob>(*it);
std::shared_ptr<Mob> other = std::dynamic_pointer_cast<Mob>(*it);
if (this->mob->shared_from_this() == other) continue;
if (other->getTarget() != NULL) continue;
other->setTarget(mob->getLastHurtByMob());

View File

@@ -36,7 +36,7 @@ std::shared_ptr<ChatPacket> IndirectEntityDamageSource::getDeathMessagePacket(st
type = owner->GetType();
if(type == eTYPE_SERVERPLAYER)
{
std::shared_ptr<Player> sourcePlayer = dynamic_pointer_cast<Player>(owner);
std::shared_ptr<Player> sourcePlayer = std::dynamic_pointer_cast<Player>(owner);
if(sourcePlayer != NULL) additional = sourcePlayer->name;
}
}

View File

@@ -606,7 +606,7 @@ void Inventory::hurtArmor(int dmg)
{
if (armor[i] != NULL && dynamic_cast<ArmorItem *>( armor[i]->getItem() ) != NULL )
{
armor[i]->hurt(dmg, dynamic_pointer_cast<Mob>( player->shared_from_this() ) );
armor[i]->hurt(dmg, std::dynamic_pointer_cast<Mob>( player->shared_from_this() ) );
if (armor[i]->count == 0)
{
armor[i] = nullptr;

View File

@@ -137,7 +137,7 @@ void ItemEntity::mergeWithNeighbours()
vector<std::shared_ptr<Entity> > *neighbours = level->getEntitiesOfClass(typeid(*this), bb->grow(0.5, 0, 0.5));
for(AUTO_VAR(it, neighbours->begin()); it != neighbours->end(); ++it)
{
std::shared_ptr<ItemEntity> entity = dynamic_pointer_cast<ItemEntity>(*it);
std::shared_ptr<ItemEntity> entity = std::dynamic_pointer_cast<ItemEntity>(*it);
merge(entity);
}
delete neighbours;
@@ -154,7 +154,7 @@ bool ItemEntity::merge(std::shared_ptr<ItemEntity> target)
if (targetItem->hasTag() ^ myItem->hasTag()) return false;
if (targetItem->hasTag() && !targetItem->getTag()->equals(myItem->getTag())) return false;
if (targetItem->getItem()->isStackedByData() && targetItem->getAuxValue() != myItem->getAuxValue()) return false;
if (targetItem->count < myItem->count) return target->merge(dynamic_pointer_cast<ItemEntity>(shared_from_this()));
if (targetItem->count < myItem->count) return target->merge(std::dynamic_pointer_cast<ItemEntity>(shared_from_this()));
if (targetItem->count + myItem->count > targetItem->getMaxStackSize()) return false;
targetItem->count += myItem->count;

View File

@@ -66,7 +66,7 @@ void ItemFrame::setItem(std::shared_ptr<ItemInstance> item)
item = item->copy();
item->count = 1;
item->setFramed(dynamic_pointer_cast<ItemFrame>( shared_from_this() ));
item->setFramed(std::dynamic_pointer_cast<ItemFrame>( shared_from_this() ));
}
getEntityData()->set(DATA_ITEM, item);
getEntityData()->markDirty(DATA_ITEM);

View File

@@ -216,7 +216,7 @@ void ItemInstance::hurt(int i, std::shared_ptr<Mob> owner)
return;
}
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(owner);
if (i > 0 && player != NULL)
{
int enchanted = EnchantmentHelper::getDigDurability(player->inventory);

View File

@@ -11,7 +11,7 @@ EGameCommand KillCommand::getId()
void KillCommand::execute(std::shared_ptr<CommandSender> source, byteArray commandData)
{
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(source);
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(source);
player->hurt(DamageSource::outOfWorld, 1000);

View File

@@ -568,7 +568,7 @@ Level::Level(std::shared_ptr<LevelStorage> levelStorage, const wstring& name, Di
if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels
this->savedDataStorage = new SavedDataStorage(levelStorage.get());
std::shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
std::shared_ptr<Villages> savedVillages = std::dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
if (savedVillages == NULL)
{
villages = std::shared_ptr<Villages>(new Villages(this));
@@ -597,7 +597,7 @@ Level::Level(Level *level, Dimension *dimension)
if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels
this->savedDataStorage = new SavedDataStorage( levelStorage.get() );
std::shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
std::shared_ptr<Villages> savedVillages = std::dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
if (savedVillages == NULL)
{
villages = std::shared_ptr<Villages>(new Villages(this));
@@ -636,7 +636,7 @@ void Level::_init(std::shared_ptr<LevelStorage>levelStorage, const wstring& leve
this->levelStorage = levelStorage;//std::shared_ptr<LevelStorage>(levelStorage);
this->savedDataStorage = new SavedDataStorage(levelStorage.get());
std::shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
std::shared_ptr<Villages> savedVillages = std::dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
if (savedVillages == NULL)
{
villages = std::shared_ptr<Villages>(new Villages(this));
@@ -1667,16 +1667,16 @@ bool Level::addEntity(std::shared_ptr<Entity> e)
}
bool forced = false;
if (dynamic_pointer_cast<Player>( e ) != NULL)
if (std::dynamic_pointer_cast<Player>( e ) != NULL)
{
forced = true;
}
if (forced || hasChunk(xc, zc))
{
if (dynamic_pointer_cast<Player>( e ) != NULL)
if (std::dynamic_pointer_cast<Player>( e ) != NULL)
{
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(e);
// 4J Stu - Added so we don't continually add the player to the players list while they are dead
if( find( players.begin(), players.end(), e ) == players.end() )
@@ -1744,11 +1744,11 @@ void Level::removeEntity(std::shared_ptr<Entity> e)
e->ride(nullptr);
}
e->remove();
if (dynamic_pointer_cast<Player>( e ) != NULL)
if (std::dynamic_pointer_cast<Player>( e ) != NULL)
{
vector<std::shared_ptr<Player> >::iterator it = players.begin();
vector<std::shared_ptr<Player> >::iterator itEnd = players.end();
while( it != itEnd && *it != dynamic_pointer_cast<Player>(e) )
while( it != itEnd && *it != std::dynamic_pointer_cast<Player>(e) )
it++;
if( it != itEnd )
@@ -1766,11 +1766,11 @@ void Level::removeEntityImmediately(std::shared_ptr<Entity> e)
{
e->remove();
if (dynamic_pointer_cast<Player>( e ) != NULL)
if (std::dynamic_pointer_cast<Player>( e ) != NULL)
{
vector<std::shared_ptr<Player> >::iterator it = players.begin();
vector<std::shared_ptr<Player> >::iterator itEnd = players.end();
while( it != itEnd && *it != dynamic_pointer_cast<Player>(e) )
while( it != itEnd && *it != std::dynamic_pointer_cast<Player>(e) )
it++;
if( it != itEnd )
@@ -2286,7 +2286,7 @@ void Level::tickEntities()
if (!e->removed)
{
#ifndef _FINAL_BUILD
if(!( app.DebugSettingsOn() && app.GetMobsDontTickEnabled() && (dynamic_pointer_cast<Mob>(e) != NULL) && (dynamic_pointer_cast<Player>(e) == NULL)))
if(!( app.DebugSettingsOn() && app.GetMobsDontTickEnabled() && (std::dynamic_pointer_cast<Mob>(e) != NULL) && (std::dynamic_pointer_cast<Player>(e) == NULL)))
#endif
{
tick(e);

View File

@@ -1639,10 +1639,10 @@ void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vector<std::s
bool isAssignableFrom = false;
// Some special cases where the base class is a general type that our class may be derived from, otherwise do a direct comparison of type_info
if( ec == typeid(Player) ) { if( dynamic_pointer_cast<Player>(e) != NULL ) isAssignableFrom = true; }
else if ( ec == typeid(Mob) ) { if( dynamic_pointer_cast<Mob>(e) != NULL ) isAssignableFrom = true; }
else if ( ec == typeid(Monster) ) { if( dynamic_pointer_cast<Monster>(e) != NULL ) isAssignableFrom = true; }
else if ( ec == typeid(Zombie) ) { if( dynamic_pointer_cast<Zombie>(e) != NULL ) isAssignableFrom = true; }
if( ec == typeid(Player) ) { if( std::dynamic_pointer_cast<Player>(e) != NULL ) isAssignableFrom = true; }
else if ( ec == typeid(Mob) ) { if( std::dynamic_pointer_cast<Mob>(e) != NULL ) isAssignableFrom = true; }
else if ( ec == typeid(Monster) ) { if( std::dynamic_pointer_cast<Monster>(e) != NULL ) isAssignableFrom = true; }
else if ( ec == typeid(Zombie) ) { if( std::dynamic_pointer_cast<Zombie>(e) != NULL ) isAssignableFrom = true; }
else if(e != NULL && ec == typeid(*(e.get())) ) isAssignableFrom = true;
if (isAssignableFrom && e->bb->intersects(bb)) es.push_back(e);
// 4J - note needs to be equivalent to baseClass.isAssignableFrom(e.getClass())

View File

@@ -12,7 +12,7 @@ bool LookAtTradingPlayerGoal::canUse()
{
if (villager->isTrading())
{
lookAt = weak_ptr<Entity>(dynamic_pointer_cast<Entity>(villager->getTradingPlayer()));
lookAt = weak_ptr<Entity>(std::dynamic_pointer_cast<Entity>(villager->getTradingPlayer()));
return true;
}
return false;

View File

@@ -16,7 +16,7 @@ LookControl::LookControl(Mob *mob)
void LookControl::setLookAt(std::shared_ptr<Entity> target, float yMax, float xMax)
{
this->wantedX = target->x;
std::shared_ptr<Mob> targetMob = dynamic_pointer_cast<Mob>(target);
std::shared_ptr<Mob> targetMob = std::dynamic_pointer_cast<Mob>(target);
if (targetMob != NULL) this->wantedY = target->y + targetMob->getHeadHeight();
else this->wantedY = (target->bb->y0 + target->bb->y1) / 2;
this->wantedZ = target->z;

View File

@@ -32,7 +32,7 @@ bool MakeLoveGoal::canUse()
std::shared_ptr<Entity> mate = level->getClosestEntityOfClass(typeid(Villager), villager->bb->grow(8, 3, 8), villager->shared_from_this());
if (mate == NULL) return false;
partner = weak_ptr<Villager>(dynamic_pointer_cast<Villager>(mate));
partner = weak_ptr<Villager>(std::dynamic_pointer_cast<Villager>(mate));
if (partner.lock()->getAge() != 0) return false;
return true;

View File

@@ -22,7 +22,7 @@ MapItem::MapItem(int id) : ComplexItem(id)
std::shared_ptr<MapItemSavedData> MapItem::getSavedData(short idNum, Level *level)
{
std::wstring id = wstring( L"map_" ) + _toString(idNum);
std::shared_ptr<MapItemSavedData> mapItemSavedData = dynamic_pointer_cast<MapItemSavedData>(level->getSavedData(typeid(MapItemSavedData), id));
std::shared_ptr<MapItemSavedData> mapItemSavedData = std::dynamic_pointer_cast<MapItemSavedData>(level->getSavedData(typeid(MapItemSavedData), id));
if (mapItemSavedData == NULL)
{
@@ -45,7 +45,7 @@ std::shared_ptr<MapItemSavedData> MapItem::getSavedData(std::shared_ptr<ItemInst
MemSect(31);
std::wstring id = wstring( L"map_" ) + _toString(itemInstance->getAuxValue() );
MemSect(0);
std::shared_ptr<MapItemSavedData> mapItemSavedData = dynamic_pointer_cast<MapItemSavedData>( level->getSavedData(typeid(MapItemSavedData), id ) );
std::shared_ptr<MapItemSavedData> mapItemSavedData = std::dynamic_pointer_cast<MapItemSavedData>( level->getSavedData(typeid(MapItemSavedData), id ) );
bool newData = false;
if (mapItemSavedData == NULL)
@@ -264,9 +264,9 @@ void MapItem::inventoryTick(std::shared_ptr<ItemInstance> itemInstance, Level *l
if (level->isClientSide) return;
std::shared_ptr<MapItemSavedData> data = getSavedData(itemInstance, level);
if (dynamic_pointer_cast<Player>(owner) != NULL)
if (std::dynamic_pointer_cast<Player>(owner) != NULL)
{
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(owner);
// 4J Stu - If the player has a map that belongs to another player, then merge the data over and change this map id to the owners id
int ownersAuxValue = level->getAuxValueForMap(player->getXuid(), data->dimension, data->x, data->z, data->scale);

View File

@@ -125,7 +125,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(std::shared_ptr<Item
}
delete data.data;
}
std::shared_ptr<ServerPlayer> servPlayer = dynamic_pointer_cast<ServerPlayer>(player);
std::shared_ptr<ServerPlayer> servPlayer = std::dynamic_pointer_cast<ServerPlayer>(player);
for (int d = 0; d < 10; d++)
{
int column = (tick * 11) % (MapItem::IMAGE_WIDTH);

View File

@@ -10,7 +10,7 @@ MerchantMenu::MerchantMenu(std::shared_ptr<Inventory> inventory, std::shared_ptr
trader = merchant;
this->level = level;
tradeContainer = std::shared_ptr<MerchantContainer>( new MerchantContainer(dynamic_pointer_cast<Player>(inventory->player->shared_from_this()), merchant) );
tradeContainer = std::shared_ptr<MerchantContainer>( new MerchantContainer(std::dynamic_pointer_cast<Player>(inventory->player->shared_from_this()), merchant) );
addSlot(new Slot(tradeContainer, PAYMENT1_SLOT, SELLSLOT1_X, ROW2_Y));
addSlot(new Slot(tradeContainer, PAYMENT2_SLOT, SELLSLOT2_X, ROW2_Y));
addSlot(new MerchantResultSlot(inventory->player, merchant, tradeContainer, RESULT_SLOT, BUYSLOT_X, ROW2_Y));

View File

@@ -33,7 +33,7 @@ void MerchantResultSlot::onQuickCraft(std::shared_ptr<ItemInstance> picked, int
void MerchantResultSlot::checkTakeAchievements(std::shared_ptr<ItemInstance> carried)
{
carried->onCraftedBy(player->level, dynamic_pointer_cast<Player>(player->shared_from_this()), removeCount);
carried->onCraftedBy(player->level, std::dynamic_pointer_cast<Player>(player->shared_from_this()), removeCount);
removeCount = 0;
}

View File

@@ -440,7 +440,7 @@ bool MineShaftPieces::MineShaftCorridor::postProcess(Level *level, Random *rando
{
hasPlacedSpider = true;
level->setTile(x, y, newZ, Tile::mobSpawner_Id);
std::shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x, y, newZ) );
std::shared_ptr<MobSpawnerTileEntity> entity = std::dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x, y, newZ) );
if (entity != NULL) entity->setEntityId(L"CaveSpider");
}
}

View File

@@ -187,8 +187,8 @@ bool Minecart::hurt(DamageSource *source, int hurtDamage)
{
std::shared_ptr<Entity> attacker = source->getDirectEntity();
if (dynamic_pointer_cast<Player>(attacker) != NULL &&
!dynamic_pointer_cast<Player>(attacker)->isAllowedToHurtEntity( shared_from_this() ))
if (std::dynamic_pointer_cast<Player>(attacker) != NULL &&
!std::dynamic_pointer_cast<Player>(attacker)->isAllowedToHurtEntity( shared_from_this() ))
return false;
}
@@ -202,7 +202,7 @@ bool Minecart::hurt(DamageSource *source, int hurtDamage)
if( rider.lock() != NULL && rider.lock() == source->getEntity() ) hurtDamage += 1;
// 4J Stu - Brought froward from 12w36 to fix #46611 - TU5: Gameplay: Minecarts and boat requires more hits than one to be destroyed in creative mode
std::shared_ptr<Player> player = dynamic_pointer_cast<Player>(source->getEntity());
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(source->getEntity());
if (player != NULL && player->abilities.instabuild) this->setDamage(100);
this->setDamage(getDamage() + (hurtDamage * 10));
@@ -215,7 +215,7 @@ bool Minecart::hurt(DamageSource *source, int hurtDamage)
spawnAtLocation(Item::minecart->id, 1, 0);
if (type == Minecart::CHEST)
{
std::shared_ptr<Container> container = dynamic_pointer_cast<Container>( shared_from_this() );
std::shared_ptr<Container> container = std::dynamic_pointer_cast<Container>( shared_from_this() );
for (unsigned int i = 0; i < container->getContainerSize(); i++)
{
std::shared_ptr<ItemInstance> item = container->getItem(i);
@@ -678,7 +678,7 @@ void Minecart::tick()
std::shared_ptr<Entity> e = (*it); //entities->at(i);
if (e != rider.lock() && e->isPushable() && e->GetType() == eTYPE_MINECART)
{
std::shared_ptr<Minecart> cart = dynamic_pointer_cast<Minecart>(e);
std::shared_ptr<Minecart> cart = std::dynamic_pointer_cast<Minecart>(e);
cart->m_bHasPushedCartThisTick = false;
cart->push(shared_from_this());
@@ -905,7 +905,7 @@ void Minecart::push(std::shared_ptr<Entity> e)
if (level->isClientSide) return;
if (e == rider.lock()) return;
if (( dynamic_pointer_cast<Mob>(e)!=NULL) && dynamic_pointer_cast<Player>(e)==NULL && dynamic_pointer_cast<VillagerGolem>(e) == NULL && type == Minecart::RIDEABLE && xd * xd + zd * zd > 0.01)
if (( std::dynamic_pointer_cast<Mob>(e)!=NULL) && std::dynamic_pointer_cast<Player>(e)==NULL && std::dynamic_pointer_cast<VillagerGolem>(e) == NULL && type == Minecart::RIDEABLE && xd * xd + zd * zd > 0.01)
{
if (rider.lock() == NULL && e->riding == NULL)
{
@@ -954,7 +954,7 @@ void Minecart::push(std::shared_ptr<Entity> e)
double xdd = (e->xd + xd);
double zdd = (e->zd + zd);
std::shared_ptr<Minecart> cart = dynamic_pointer_cast<Minecart>(e);
std::shared_ptr<Minecart> cart = std::dynamic_pointer_cast<Minecart>(e);
if (cart != NULL && cart->type == Minecart::FURNACE && type != Minecart::FURNACE)
{
xd *= 0.2f;
@@ -1077,7 +1077,7 @@ bool Minecart::interact(std::shared_ptr<Player> player)
{
if (type == Minecart::RIDEABLE)
{
if (rider.lock() != NULL && dynamic_pointer_cast<Player>(rider.lock())!=NULL && rider.lock() != player) return true;
if (rider.lock() != NULL && std::dynamic_pointer_cast<Player>(rider.lock())!=NULL && rider.lock() != player) return true;
if (!level->isClientSide)
{
// 4J HEG - Fixed issue with player not being able to dismount minecart (issue #4455)
@@ -1089,7 +1089,7 @@ bool Minecart::interact(std::shared_ptr<Player> player)
if ( player->isAllowedToInteract(shared_from_this()) )
{
if (!level->isClientSide)
player->openContainer( dynamic_pointer_cast<Container>( shared_from_this() ) );
player->openContainer( std::dynamic_pointer_cast<Container>( shared_from_this() ) );
}
else
{

View File

@@ -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)
{

View File

@@ -104,11 +104,11 @@ void MobEffect::applyEffectTick(std::shared_ptr<Mob> mob, int amplification)
mob->hurt(DamageSource::magic, 1);
}
}
else if (id == hunger->id && dynamic_pointer_cast<Player>(mob) != NULL)
else if (id == hunger->id && std::dynamic_pointer_cast<Player>(mob) != NULL)
{
// every tick, cause the same amount of exhaustion as when removing
// a block, times amplification
dynamic_pointer_cast<Player>(mob)->causeFoodExhaustion(FoodConstants::EXHAUSTION_MINE * (amplification + 1));
std::dynamic_pointer_cast<Player>(mob)->causeFoodExhaustion(FoodConstants::EXHAUSTION_MINE * (amplification + 1));
}
else if ((id == heal->id && !mob->isInvertedHealAndHarm()) || (id == harm->id && mob->isInvertedHealAndHarm()))
{

View File

@@ -294,7 +294,7 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie
// {
MemSect(29);
//mob = type.mobClass.getConstructor(Level.class).newInstance(level);
mob = dynamic_pointer_cast<Mob>(EntityIO::newByEnumType(currentMobType->mobClass, level));
mob = std::dynamic_pointer_cast<Mob>(EntityIO::newByEnumType(currentMobType->mobClass, level));
MemSect(0);
// }
// catch (exception e)
@@ -425,18 +425,18 @@ bool MobSpawner::isSpawnPositionOk(MobCategory *category, Level *level, int x, i
void MobSpawner::finalizeMobSettings(std::shared_ptr<Mob> mob, Level *level, float xx, float yy, float zz)
{
if (dynamic_pointer_cast<Spider>( mob ) != NULL && level->random->nextInt(100) == 0)
if (std::dynamic_pointer_cast<Spider>( mob ) != NULL && level->random->nextInt(100) == 0)
{
std::shared_ptr<Skeleton> skeleton = std::shared_ptr<Skeleton>( new Skeleton(level) );
skeleton->moveTo(xx, yy, zz, mob->yRot, 0);
level->addEntity(skeleton);
skeleton->ride(mob);
}
else if (dynamic_pointer_cast<Sheep >( mob ) != NULL)
else if (std::dynamic_pointer_cast<Sheep >( mob ) != NULL)
{
(dynamic_pointer_cast<Sheep>( mob ))->setColor(Sheep::getSheepColor(level->random));
(std::dynamic_pointer_cast<Sheep>( mob ))->setColor(Sheep::getSheepColor(level->random));
}
else if (dynamic_pointer_cast<Ozelot >( mob ) != NULL)
else if (std::dynamic_pointer_cast<Ozelot >( mob ) != NULL)
{
if (level->random->nextInt(7) == 0)
{
@@ -520,7 +520,7 @@ bool MobSpawner::attackSleepingPlayers(Level *level, vector<std::shared_ptr<Play
// {
//mob = classes[type].getConstructor(Level.class).newInstance(level);
// 4J - there was a classes array here which duplicated the bedEnemies array but have removed it
mob = dynamic_pointer_cast<Mob>(EntityIO::newByEnumType(bedEnemies[type], level ));
mob = std::dynamic_pointer_cast<Mob>(EntityIO::newByEnumType(bedEnemies[type], level ));
// }
// catch (exception e)
// {
@@ -621,7 +621,7 @@ void MobSpawner::postProcessSpawnMobs(Level *level, Biome *biome, int xo, int zo
std::shared_ptr<Mob> mob;
//try {
mob = dynamic_pointer_cast<Mob>( EntityIO::newByEnumType(type->mobClass, level ) );
mob = std::dynamic_pointer_cast<Mob>( EntityIO::newByEnumType(type->mobClass, level ) );
//} catch (Exception e) {
// e.printStackTrace();
// continue;

View File

@@ -89,7 +89,7 @@ void MobSpawnerTileEntity::tick()
for (int c = 0; c < spawnCount; c++)
{
std::shared_ptr<Mob> entity = dynamic_pointer_cast<Mob> (EntityIO::newEntity(entityId, level));
std::shared_ptr<Mob> entity = std::dynamic_pointer_cast<Mob> (EntityIO::newEntity(entityId, level));
if (entity == NULL) return;
vector<std::shared_ptr<Entity> > *vecNearby = level->getEntitiesOfClass(typeid(*entity), AABB::newTemp(x, y, z, x + 1, y + 1, z + 1)->grow(8, 4, 8));
@@ -115,7 +115,7 @@ void MobSpawnerTileEntity::tick()
double xp = x + (level->random->nextDouble() - level->random->nextDouble()) * 4;
double yp = y + level->random->nextInt(3) - 1;
double zp = z + (level->random->nextDouble() - level->random->nextDouble()) * 4;
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>( entity );
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>( entity );
entity->moveTo(xp, yp, zp, level->random->nextFloat() * 360, 0);

View File

@@ -95,19 +95,19 @@ bool Monster::doHurtTarget(std::shared_ptr<Entity> target)
dmg -= (2 << getEffect(MobEffect::weakness)->getAmplifier());
}
DamageSource *damageSource = DamageSource::mobAttack(dynamic_pointer_cast<Mob>( shared_from_this() ) );
DamageSource *damageSource = DamageSource::mobAttack(std::dynamic_pointer_cast<Mob>( shared_from_this() ) );
bool didHurt = target->hurt(damageSource, dmg);
delete damageSource;
if (didHurt)
{
int fireAspect = EnchantmentHelper::getFireAspect(dynamic_pointer_cast<Mob>(shared_from_this()));
int fireAspect = EnchantmentHelper::getFireAspect(std::dynamic_pointer_cast<Mob>(shared_from_this()));
if (fireAspect > 0)
{
target->setOnFire(fireAspect * 4);
}
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(target);
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(target);
if (mob != NULL)
{
ThornsEnchantment::doThornsAfterAttack(shared_from_this(), mob, random);

View File

@@ -181,7 +181,7 @@ bool MonsterPlacerItem::useOn(std::shared_ptr<ItemInstance> itemInstance, std::s
// 4J Stu - Force adding this as a tile update
level->setTile(x,y,z,0);
level->setTile(x,y,z,Tile::mobSpawner_Id);
std::shared_ptr<MobSpawnerTileEntity> mste = dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x,y,z) );
std::shared_ptr<MobSpawnerTileEntity> mste = std::dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x,y,z) );
if(mste != NULL)
{
mste->setEntityId( EntityIO::getEncodeId(itemInstance->getAuxValue()) );
@@ -267,7 +267,7 @@ std::shared_ptr<Entity> MonsterPlacerItem::spawnMobAt(Level *level, int mobId, d
{
newEntity = canSpawn(mobId, level, piResult);
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(newEntity);
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(newEntity);
if (mob)
{
newEntity->moveTo(x, y, z, Mth::wrapDegrees(level->random->nextFloat() * 360), 0);

View File

@@ -84,7 +84,7 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z
if (count != 1) continue;
level->setTile(xc, yc, zc, Tile::chest_Id);
std::shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity >( level->getTileEntity(xc, yc, zc) );
std::shared_ptr<ChestTileEntity> chest = std::dynamic_pointer_cast<ChestTileEntity >( level->getTileEntity(xc, yc, zc) );
if (chest != NULL )
{
for (int j = 0; j < 8; j++)
@@ -100,7 +100,7 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z
level->setTile(x, y, z, Tile::mobSpawner_Id);
std::shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<MobSpawnerTileEntity> entity = std::dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x, y, z) );
if( entity != NULL )
{
entity->setEntityId(randomEntityId(random));

View File

@@ -60,7 +60,7 @@ bool MoveEntityPacket::canBeInvalidated()
bool MoveEntityPacket::isInvalidatedBy(std::shared_ptr<Packet> packet)
{
std::shared_ptr<MoveEntityPacket> target = dynamic_pointer_cast<MoveEntityPacket>(packet);
std::shared_ptr<MoveEntityPacket> target = std::dynamic_pointer_cast<MoveEntityPacket>(packet);
return target != NULL && target->id == id;
}

View File

@@ -67,7 +67,7 @@ bool MoveEntityPacketSmall::canBeInvalidated()
bool MoveEntityPacketSmall::isInvalidatedBy(std::shared_ptr<Packet> packet)
{
std::shared_ptr<MoveEntityPacketSmall> target = dynamic_pointer_cast<MoveEntityPacketSmall>(packet);
std::shared_ptr<MoveEntityPacketSmall> target = std::dynamic_pointer_cast<MoveEntityPacketSmall>(packet);
return target != NULL && target->id == id;
}

View File

@@ -44,7 +44,7 @@ void MoveIndoorsGoal::start()
}
if (mob->distanceToSqr(_doorInfo->getIndoorX(), _doorInfo->y, _doorInfo->getIndoorZ()) > 16 * 16)
{
Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 14, 3, Vec3::newTemp(_doorInfo->getIndoorX() + 0.5, _doorInfo->getIndoorY(), _doorInfo->getIndoorZ() + 0.5));
Vec3 *pos = RandomPos::getPosTowards(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 14, 3, Vec3::newTemp(_doorInfo->getIndoorX() + 0.5, _doorInfo->getIndoorY(), _doorInfo->getIndoorZ() + 0.5));
if (pos != NULL) mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, 0.3f);
}
else mob->getNavigation()->moveTo(_doorInfo->getIndoorX() + 0.5, _doorInfo->getIndoorY(), _doorInfo->getIndoorZ() + 0.5, 0.3f);

View File

@@ -46,7 +46,7 @@ bool MoveThroughVillageGoal::canUse()
mob->getNavigation()->setCanOpenDoors(oldCanOpenDoors);
if (path != NULL) return true;
Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 10, 7, Vec3::newTemp(_doorInfo->x, _doorInfo->y, _doorInfo->z));
Vec3 *pos = RandomPos::getPosTowards(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 10, 7, Vec3::newTemp(_doorInfo->x, _doorInfo->y, _doorInfo->z));
if (pos == NULL) return false;
mob->getNavigation()->setCanOpenDoors(false);
delete path;

View File

@@ -19,7 +19,7 @@ bool MoveTowardsRestrictionGoal::canUse()
{
if (mob->isWithinRestriction()) return false;
Pos *towards = mob->getRestrictCenter();
Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 7, Vec3::newTemp(towards->x, towards->y, towards->z));
Vec3 *pos = RandomPos::getPosTowards(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 7, Vec3::newTemp(towards->x, towards->y, towards->z));
if (pos == NULL) return false;
wantedX = pos->x;
wantedY = pos->y;

View File

@@ -19,7 +19,7 @@ bool MoveTowardsTargetGoal::canUse()
target = weak_ptr<Mob>(mob->getTarget());
if (target.lock() == NULL) return false;
if (target.lock()->distanceToSqr(mob->shared_from_this()) > within * within) return false;
Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 7, Vec3::newTemp(target.lock()->x, target.lock()->y, target.lock()->z));
Vec3 *pos = RandomPos::getPosTowards(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 7, Vec3::newTemp(target.lock()->x, target.lock()->y, target.lock()->z));
if (pos == NULL) return false;
wantedX = pos->x;
wantedY = pos->y;

View File

@@ -12,7 +12,7 @@ void MusicTile::neighborChanged(Level *level, int x, int y, int z, int type)
{
app.DebugPrintf("-------- Neighbour changed type %d\n", type);
bool signal = level->hasNeighborSignal(x, y, z);
std::shared_ptr<MusicTileEntity> mte = dynamic_pointer_cast<MusicTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<MusicTileEntity> mte = std::dynamic_pointer_cast<MusicTileEntity>( level->getTileEntity(x, y, z) );
app.DebugPrintf("-------- Signal is %s, tile is currently %s\n",signal?"TRUE":"FALSE", mte->on?"ON":"OFF");
if (mte != NULL && mte->on != signal)
{
@@ -34,7 +34,7 @@ bool MusicTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> p
{
if (soundOnly) return false;
if (level->isClientSide) return true;
std::shared_ptr<MusicTileEntity> mte = dynamic_pointer_cast<MusicTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<MusicTileEntity> mte = std::dynamic_pointer_cast<MusicTileEntity>( level->getTileEntity(x, y, z) );
if (mte != NULL )
{
mte->tune();
@@ -46,7 +46,7 @@ bool MusicTile::use(Level *level, int x, int y, int z, std::shared_ptr<Player> p
void MusicTile::attack(Level *level, int x, int y, int z, std::shared_ptr<Player> player)
{
if (level->isClientSide) return;
std::shared_ptr<MusicTileEntity> mte = dynamic_pointer_cast<MusicTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<MusicTileEntity> mte = std::dynamic_pointer_cast<MusicTileEntity>( level->getTileEntity(x, y, z) );
if( mte != NULL ) mte->playNote(level, x, y, z);
}

View File

@@ -52,7 +52,7 @@ bool NearestAttackableTargetGoal::canUse()
std::sort(entities->begin(), entities->end(), *distComp);
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
{
std::shared_ptr<Mob> potTarget = dynamic_pointer_cast<Mob>(*it);
std::shared_ptr<Mob> potTarget = std::dynamic_pointer_cast<Mob>(*it);
if (canAttack(potTarget, false))
{
target = weak_ptr<Mob>(potTarget);

View File

@@ -757,7 +757,7 @@ bool NetherBridgePieces::MonsterThrone::postProcess(Level *level, Random *random
{
hasPlacedMobSpawner = true;
level->setTile(x, y, z, Tile::mobSpawner_Id);
std::shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<MobSpawnerTileEntity> entity = std::dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x, y, z) );
if (entity != NULL) entity->setEntityId(L"Blaze");
}
}

View File

@@ -107,7 +107,7 @@ bool OcelotSitOnTileGoal::isValidTarget(Level *level, int x, int y, int z)
if (tile == Tile::chest_Id)
{
std::shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z));
std::shared_ptr<ChestTileEntity> chest = std::dynamic_pointer_cast<ChestTileEntity>(level->getTileEntity(x, y, z));
if (chest->openCount < 1)
{

View File

@@ -16,7 +16,7 @@ bool OfferFlowerGoal::canUse()
{
if (!golem->level->isDay()) return false;
if (golem->getRandom()->nextInt(8000) != 0) return false;
villager = weak_ptr<Villager>(dynamic_pointer_cast<Villager>( golem->level->getClosestEntityOfClass(typeid(Villager), golem->bb->grow(6, 2, 6), golem->shared_from_this()) ));
villager = weak_ptr<Villager>(std::dynamic_pointer_cast<Villager>( golem->level->getClosestEntityOfClass(typeid(Villager), golem->bb->grow(6, 2, 6), golem->shared_from_this()) ));
return villager.lock() != NULL;
}

View File

@@ -186,7 +186,7 @@ int Ozelot::getDeathLoot()
bool Ozelot::doHurtTarget(std::shared_ptr<Entity> target)
{
return target->hurt(DamageSource::mobAttack(dynamic_pointer_cast<Mob>(shared_from_this())), 3);
return target->hurt(DamageSource::mobAttack(std::dynamic_pointer_cast<Mob>(shared_from_this())), 3);
}
bool Ozelot::hurt(DamageSource *source, int dmg)
@@ -280,7 +280,7 @@ bool Ozelot::canMate(std::shared_ptr<Animal> animal)
if (animal == shared_from_this()) return false;
if (!isTame()) return false;
std::shared_ptr<Ozelot> partner = dynamic_pointer_cast<Ozelot>(animal);
std::shared_ptr<Ozelot> partner = std::dynamic_pointer_cast<Ozelot>(animal);
if (partner == NULL) return false;
if (!partner->isTame()) return false;

View File

@@ -16,7 +16,7 @@ PanicGoal::PanicGoal(PathfinderMob *mob, float speed)
bool PanicGoal::canUse()
{
if (mob->getLastHurtByMob() == NULL) return false;
Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 5, 4);
Vec3 *pos = RandomPos::getPos(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 5, 4);
if (pos == NULL) return false;
posX = pos->x;
posY = pos->y;

View File

@@ -56,7 +56,7 @@ int Pig::getMaxHealth()
bool Pig::canBeControlledByRider()
{
std::shared_ptr<ItemInstance> item = dynamic_pointer_cast<Player>(rider.lock())->getCarriedItem();
std::shared_ptr<ItemInstance> item = std::dynamic_pointer_cast<Player>(rider.lock())->getCarriedItem();
return item != NULL && item->id == Item::carrotOnAStick_Id;
}
@@ -162,9 +162,9 @@ void Pig::thunderHit(const LightningBolt *lightningBolt)
void Pig::causeFallDamage(float distance)
{
Animal::causeFallDamage(distance);
if (distance > 5 && dynamic_pointer_cast<Player>( rider.lock() ) != NULL)
if (distance > 5 && std::dynamic_pointer_cast<Player>( rider.lock() ) != NULL)
{
(dynamic_pointer_cast<Player>(rider.lock()))->awardStat(GenericStats::flyPig(),GenericStats::param_flyPig());
(std::dynamic_pointer_cast<Player>(rider.lock()))->awardStat(GenericStats::flyPig(),GenericStats::param_flyPig());
}
}

View File

@@ -104,16 +104,16 @@ std::shared_ptr<Entity> PigZombie::findAttackTarget()
bool PigZombie::hurt(DamageSource *source, int dmg)
{
std::shared_ptr<Entity> sourceEntity = source->getEntity();
if (dynamic_pointer_cast<Player>(sourceEntity) != NULL)
if (std::dynamic_pointer_cast<Player>(sourceEntity) != NULL)
{
vector<std::shared_ptr<Entity> > *nearby = level->getEntities( shared_from_this(), bb->grow(32, 32, 32));
AUTO_VAR(itEnd, nearby->end());
for (AUTO_VAR(it, nearby->begin()); it != itEnd; it++)
{
std::shared_ptr<Entity> e = *it; //nearby->at(i);
if (dynamic_pointer_cast<PigZombie>(e) != NULL)
if (std::dynamic_pointer_cast<PigZombie>(e) != NULL)
{
std::shared_ptr<PigZombie> pigZombie = dynamic_pointer_cast<PigZombie>(e);
std::shared_ptr<PigZombie> pigZombie = std::dynamic_pointer_cast<PigZombie>(e);
pigZombie->alert(sourceEntity);
}
}

View File

@@ -126,7 +126,7 @@ bool PistonBaseTile::use(Level *level, int x, int y, int z, std::shared_ptr<Play
void PistonBaseTile::setPlacedBy(Level *level, int x, int y, int z, std::shared_ptr<Mob> by)
{
int targetData = getNewFacing(level, x, y, z, dynamic_pointer_cast<Player>(by) );
int targetData = getNewFacing(level, x, y, z, std::dynamic_pointer_cast<Player>(by) );
level->setData(x, y, z, targetData);
if (!level->isClientSide && !ignoreUpdate())
{
@@ -250,9 +250,9 @@ void PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1,
{
PIXBeginNamedEvent(0,"Contract phase A\n");
std::shared_ptr<TileEntity> prevTileEntity = level->getTileEntity(x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]);
if (prevTileEntity != NULL && dynamic_pointer_cast<PistonPieceEntity>(prevTileEntity) != NULL)
if (prevTileEntity != NULL && std::dynamic_pointer_cast<PistonPieceEntity>(prevTileEntity) != NULL)
{
dynamic_pointer_cast<PistonPieceEntity>(prevTileEntity)->finalTick();
std::dynamic_pointer_cast<PistonPieceEntity>(prevTileEntity)->finalTick();
}
stopSharingIfServer(level, x, y, z); // 4J added
@@ -281,9 +281,9 @@ void PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1,
// so replace it with the real data, since it's probably
// this piston which is changing too fast
std::shared_ptr<TileEntity> tileEntity = level->getTileEntity(twoX, twoY, twoZ);
if (tileEntity != NULL && dynamic_pointer_cast<PistonPieceEntity>(tileEntity) != NULL )
if (tileEntity != NULL && std::dynamic_pointer_cast<PistonPieceEntity>(tileEntity) != NULL )
{
std::shared_ptr<PistonPieceEntity> ppe = dynamic_pointer_cast<PistonPieceEntity>(tileEntity);
std::shared_ptr<PistonPieceEntity> ppe = std::dynamic_pointer_cast<PistonPieceEntity>(tileEntity);
if (ppe->getFacing() == facing && ppe->isExtending())
{

View File

@@ -23,9 +23,9 @@ void PistonMovingPiece::onPlace(Level *level, int x, int y, int z)
void PistonMovingPiece::onRemove(Level *level, int x, int y, int z, int id, int data)
{
std::shared_ptr<TileEntity> tileEntity = level->getTileEntity(x, y, z);
if (tileEntity != NULL && dynamic_pointer_cast<PistonPieceEntity>(tileEntity) != NULL)
if (tileEntity != NULL && std::dynamic_pointer_cast<PistonPieceEntity>(tileEntity) != NULL)
{
dynamic_pointer_cast<PistonPieceEntity>(tileEntity)->finalTick();
std::dynamic_pointer_cast<PistonPieceEntity>(tileEntity)->finalTick();
}
else
{
@@ -120,7 +120,7 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z)
void PistonMovingPiece::updateShape(LevelSource *level, int x, int y, int z, int forceData, std::shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
{
std::shared_ptr<PistonPieceEntity> entity = dynamic_pointer_cast<PistonPieceEntity>(forceEntity);
std::shared_ptr<PistonPieceEntity> entity = std::dynamic_pointer_cast<PistonPieceEntity>(forceEntity);
if( entity == NULL ) entity = getEntity(level, x, y, z);
if (entity != NULL)
{
@@ -191,9 +191,9 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z, int tile, fl
std::shared_ptr<PistonPieceEntity> PistonMovingPiece::getEntity(LevelSource *level, int x, int y, int z)
{
std::shared_ptr<TileEntity> tileEntity = level->getTileEntity(x, y, z);
if (tileEntity != NULL && dynamic_pointer_cast<PistonPieceEntity>(tileEntity) != NULL)
if (tileEntity != NULL && std::dynamic_pointer_cast<PistonPieceEntity>(tileEntity) != NULL)
{
return dynamic_pointer_cast<PistonPieceEntity>(tileEntity);
return std::dynamic_pointer_cast<PistonPieceEntity>(tileEntity);
}
return nullptr;
}

View File

@@ -32,7 +32,7 @@ bool PlayGoal::canUse()
{
std::shared_ptr<Entity> c = *it;
if (c.get() == mob) continue;
std::shared_ptr<Villager> friendV = dynamic_pointer_cast<Villager>(c);
std::shared_ptr<Villager> friendV = std::dynamic_pointer_cast<Villager>(c);
if (friendV->isChasing()) continue;
if (friendV->getAge() >= 0) continue;
double distSqr = friendV->distanceToSqr(mob->shared_from_this());
@@ -44,7 +44,7 @@ bool PlayGoal::canUse()
if (followFriend.lock() == NULL)
{
Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 3);
Vec3 *pos = RandomPos::getPos(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 3);
if (pos == NULL) return false;
}
return true;
@@ -78,7 +78,7 @@ void PlayGoal::tick()
{
if (mob->getNavigation()->isDone())
{
Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 3);
Vec3 *pos = RandomPos::getPos(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 3);
if (pos == NULL) return;
mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, speed);
}

View File

@@ -214,7 +214,7 @@ void Player::releaseUsingItem()
{
if (useItem != NULL)
{
useItem->releaseUsing(level, dynamic_pointer_cast<Player>( shared_from_this() ), useItemDuration);
useItem->releaseUsing(level, std::dynamic_pointer_cast<Player>( shared_from_this() ), useItemDuration);
// 4J Stu - Fix for various bugs where an incorrect bow was displayed when it broke (#70859,#93972,#93974)
if (useItem->count == 0)
@@ -312,7 +312,7 @@ void Player::tick()
if (!level->isClientSide)
{
if (containerMenu != NULL && !containerMenu->stillValid( dynamic_pointer_cast<Player>( shared_from_this() ) ))
if (containerMenu != NULL && !containerMenu->stillValid( std::dynamic_pointer_cast<Player>( shared_from_this() ) ))
{
closeContainer();
containerMenu = inventoryMenu;
@@ -355,7 +355,7 @@ void Player::tick()
if (!level->isClientSide)
{
foodData.tick(dynamic_pointer_cast<Player>(shared_from_this()));
foodData.tick(std::dynamic_pointer_cast<Player>(shared_from_this()));
}
// 4J Stu Debugging
@@ -411,29 +411,29 @@ void Player::tick()
//this->drop( std::shared_ptr<ItemInstance>( new ItemInstance( Tile::fence, 64 ) ) );
//std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(Pig::_class->newInstance( level ));
//std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(Pig::_class->newInstance( level ));
//mob->moveTo(x+1, y, z+1, level->random->nextFloat() * 360, 0);
//level->addEntity(mob);
// 4J : WESTY : Spawn some wolves to befriend!
/*
std::shared_ptr<Mob> mob1 = dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
std::shared_ptr<Mob> mob1 = std::dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
mob1->moveTo(x+1, y, z+1, level->random->nextFloat() * 360, 0);
level->addEntity(mob1);
std::shared_ptr<Mob> mob2 = dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
std::shared_ptr<Mob> mob2 = std::dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
mob2->moveTo(x+2, y, z+1, level->random->nextFloat() * 360, 0);
level->addEntity(mob2);
std::shared_ptr<Mob> mob3 = dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
std::shared_ptr<Mob> mob3 = std::dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
mob3->moveTo(x+1, y, z+2, level->random->nextFloat() * 360, 0);
level->addEntity(mob3);
std::shared_ptr<Mob> mob4 = dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
std::shared_ptr<Mob> mob4 = std::dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
mob4->moveTo(x+3, y, z+1, level->random->nextFloat() * 360, 0);
level->addEntity(mob4);
std::shared_ptr<Mob> mob5 = dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
std::shared_ptr<Mob> mob5 = std::dynamic_pointer_cast<Mob>(Wolf::_class->newInstance( level ));
mob5->moveTo(x+1, y, z+3, level->random->nextFloat() * 360, 0);
level->addEntity(mob5);
*/
@@ -558,7 +558,7 @@ void Player::completeUsingItem()
spawnEatParticles(useItem, 16);
int oldCount = useItem->count;
std::shared_ptr<ItemInstance> itemInstance = useItem->useTimeDepleted(level, dynamic_pointer_cast<Player>(shared_from_this()));
std::shared_ptr<ItemInstance> itemInstance = useItem->useTimeDepleted(level, std::dynamic_pointer_cast<Player>(shared_from_this()));
if (itemInstance != useItem || (itemInstance != NULL && itemInstance->count != oldCount))
{
inventory->items[inventory->selected] = itemInstance;
@@ -943,7 +943,7 @@ void Player::rideTick()
//xRot = preXRot;
//yRot = preYRot;
std::shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(riding);
std::shared_ptr<Pig> pig = std::dynamic_pointer_cast<Pig>(riding);
yBodyRot = pig->yBodyRot;
while (yBodyRot - yBodyRotO < -180)
@@ -1056,7 +1056,7 @@ void Player::aiStep()
void Player::touch(std::shared_ptr<Entity> entity)
{
entity->playerTouch( dynamic_pointer_cast<Player>( shared_from_this() ) );
entity->playerTouch( std::dynamic_pointer_cast<Player>( shared_from_this() ) );
}
// 4J - Removed 1.0.1
@@ -1350,17 +1350,17 @@ bool Player::hurt(DamageSource *source, int dmg)
if (dmg == 0) return false;
std::shared_ptr<Entity> attacker = source->getEntity();
if ( dynamic_pointer_cast<Arrow>( attacker ) != NULL )
if ( std::dynamic_pointer_cast<Arrow>( attacker ) != NULL )
{
if ((dynamic_pointer_cast<Arrow>(attacker))->owner != NULL)
if ((std::dynamic_pointer_cast<Arrow>(attacker))->owner != NULL)
{
attacker = (dynamic_pointer_cast<Arrow>(attacker))->owner;
attacker = (std::dynamic_pointer_cast<Arrow>(attacker))->owner;
}
}
if ( dynamic_pointer_cast<Mob>( attacker ) != NULL )
if ( std::dynamic_pointer_cast<Mob>( attacker ) != NULL )
{
// aggreviate all pet wolves nearby
directAllTameWolvesOnTarget(dynamic_pointer_cast<Mob>(attacker), false);
directAllTameWolvesOnTarget(std::dynamic_pointer_cast<Mob>(attacker), false);
}
return this->Mob::hurt(source, dmg);
@@ -1399,20 +1399,20 @@ void Player::directAllTameWolvesOnTarget(std::shared_ptr<Mob> target, bool skipS
{
// filter un-attackable mobs
if ((dynamic_pointer_cast<Creeper>( target ) != NULL) || (dynamic_pointer_cast<Ghast>( target) != NULL))
if ((std::dynamic_pointer_cast<Creeper>( target ) != NULL) || (std::dynamic_pointer_cast<Ghast>( target) != NULL))
{
return;
}
// never target wolves that has this player as owner
if (dynamic_pointer_cast<Wolf>(target) != NULL)
if (std::dynamic_pointer_cast<Wolf>(target) != NULL)
{
std::shared_ptr<Wolf> wolfTarget = dynamic_pointer_cast<Wolf>(target);
std::shared_ptr<Wolf> wolfTarget = std::dynamic_pointer_cast<Wolf>(target);
if (wolfTarget->isTame() && m_UUID.compare( wolfTarget->getOwnerUUID() ) == 0 )
{
return;
}
}
if ((dynamic_pointer_cast<Player>( target ) != NULL) && !isPlayerVersusPlayer())
if ((std::dynamic_pointer_cast<Player>( target ) != NULL) && !isPlayerVersusPlayer())
{
// pvp is off
return;
@@ -1424,7 +1424,7 @@ void Player::directAllTameWolvesOnTarget(std::shared_ptr<Mob> target, bool skipS
AUTO_VAR(itEnd, nearbyWolves->end());
for (AUTO_VAR(it, nearbyWolves->begin()); it != itEnd; it++)
{
std::shared_ptr<Wolf> wolf = dynamic_pointer_cast<Wolf>(*it);;
std::shared_ptr<Wolf> wolf = std::dynamic_pointer_cast<Wolf>(*it);;
if (wolf->isTame() && wolf->getAttackTarget() == NULL && m_UUID.compare( wolf->getOwnerUUID() ) == 0)
{
if (!skipSitting || !wolf->isSitting())
@@ -1509,15 +1509,15 @@ void Player::openItemInstanceGui(std::shared_ptr<ItemInstance> itemInstance)
bool Player::interact(std::shared_ptr<Entity> entity)
{
if (entity->interact( dynamic_pointer_cast<Player>( shared_from_this() ) )) return true;
if (entity->interact( std::dynamic_pointer_cast<Player>( shared_from_this() ) )) return true;
std::shared_ptr<ItemInstance> item = getSelectedItem();
if (item != NULL && dynamic_pointer_cast<Mob>( entity ) != NULL)
if (item != NULL && std::dynamic_pointer_cast<Mob>( entity ) != NULL)
{
// 4J - PC Comments
// Hack to prevent item stacks from decrementing if the player has
// the ability to instabuild
if(this->abilities.instabuild) item = item->copy();
if(item->interactEnemy(dynamic_pointer_cast<Mob>(entity)))
if(item->interactEnemy(std::dynamic_pointer_cast<Mob>(entity)))
{
// 4J - PC Comments
// Don't remove the item in hand if the player has the ability
@@ -1577,7 +1577,7 @@ void Player::attack(std::shared_ptr<Entity> entity)
int knockback = 0;
int magicBoost = 0;
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(entity);
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(entity);
if (mob != NULL)
{
magicBoost = EnchantmentHelper::getDamageBonus(inventory, mob);
@@ -1600,14 +1600,14 @@ void Player::attack(std::shared_ptr<Entity> entity)
// Ensure we put the entity on fire if we're hitting with a
// fire-enchanted weapon
bool setOnFireTemporatily = false;
int fireAspect = EnchantmentHelper::getFireAspect(dynamic_pointer_cast<Mob>(shared_from_this()));
if (dynamic_pointer_cast<Mob>(entity) && fireAspect > 0 && !entity->isOnFire())
int fireAspect = EnchantmentHelper::getFireAspect(std::dynamic_pointer_cast<Mob>(shared_from_this()));
if (std::dynamic_pointer_cast<Mob>(entity) && fireAspect > 0 && !entity->isOnFire())
{
setOnFireTemporatily = true;
entity->setOnFire(1);
}
DamageSource *damageSource = DamageSource::playerAttack(dynamic_pointer_cast<Player>(shared_from_this()));
DamageSource *damageSource = DamageSource::playerAttack(std::dynamic_pointer_cast<Player>(shared_from_this()));
bool wasHurt = entity->hurt(damageSource, dmg);
delete damageSource;
if (wasHurt)
@@ -1635,7 +1635,7 @@ void Player::attack(std::shared_ptr<Entity> entity)
}
setLastHurtMob(entity);
std::shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(entity);
std::shared_ptr<Mob> mob = std::dynamic_pointer_cast<Mob>(entity);
if (mob)
{
ThornsEnchantment::doThornsAfterAttack(shared_from_this(), mob, random);
@@ -1643,19 +1643,19 @@ void Player::attack(std::shared_ptr<Entity> entity)
}
std::shared_ptr<ItemInstance> item = getSelectedItem();
if (item != NULL && dynamic_pointer_cast<Mob>( entity ) != NULL)
if (item != NULL && std::dynamic_pointer_cast<Mob>( entity ) != NULL)
{
item->hurtEnemy(dynamic_pointer_cast<Mob>(entity), dynamic_pointer_cast<Player>( shared_from_this() ) );
item->hurtEnemy(std::dynamic_pointer_cast<Mob>(entity), std::dynamic_pointer_cast<Player>( shared_from_this() ) );
if (item->count <= 0)
{
removeSelectedItem();
}
}
if (dynamic_pointer_cast<Mob>( entity ) != NULL)
if (std::dynamic_pointer_cast<Mob>( entity ) != NULL)
{
if (entity->isAlive())
{
directAllTameWolvesOnTarget(dynamic_pointer_cast<Mob>(entity), true);
directAllTameWolvesOnTarget(std::dynamic_pointer_cast<Mob>(entity), true);
}
// 4J Stu - Brought forward wasHurt check to Fix 66140 - Bug: Fire Aspect bypasses "Player v Player" being Disabled
if (fireAspect > 0 && wasHurt)
@@ -1708,10 +1708,10 @@ Slot *Player::getInventorySlot(int slotId)
void Player::remove()
{
this->Mob::remove();
inventoryMenu->removed( dynamic_pointer_cast<Player>( shared_from_this() ) );
inventoryMenu->removed( std::dynamic_pointer_cast<Player>( shared_from_this() ) );
if (containerMenu != NULL)
{
containerMenu->removed( dynamic_pointer_cast<Player>( shared_from_this() ) );
containerMenu->removed( std::dynamic_pointer_cast<Player>( shared_from_this() ) );
}
}
@@ -2142,7 +2142,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz)
int distance = (int) Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f);
if (distance > 0)
{
if ( dynamic_pointer_cast<Minecart>( riding ) )
if ( std::dynamic_pointer_cast<Minecart>( riding ) )
{
distanceMinecart += distance;
if( distanceMinecart >= 100 )
@@ -2189,7 +2189,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz)
}
}
else if (dynamic_pointer_cast<Boat>( riding ) != NULL)
else if (std::dynamic_pointer_cast<Boat>( riding ) != NULL)
{
distanceBoat += distance;
if( distanceBoat >= 100 )
@@ -2199,7 +2199,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz)
awardStat(GenericStats::boatOneM(), GenericStats::param_boat(newDistance/100) );
}
}
else if (dynamic_pointer_cast<Pig>( riding ) != NULL)
else if (std::dynamic_pointer_cast<Pig>( riding ) != NULL)
{
distancePig += distance;
if( distancePig >= 100 )
@@ -2235,7 +2235,7 @@ void Player::causeFallDamage(float distance)
void Player::killed(std::shared_ptr<Mob> mob)
{
// 4J-PB - added the lavaslime enemy - fix for #64007 - TU7: Code: Achievements: TCR#073: Killing Magma Cubes doesn't unlock "Monster Hunter" Achievement.
if( dynamic_pointer_cast<Monster>( mob ) != NULL || mob->GetType() == eTYPE_GHAST || mob->GetType() == eTYPE_SLIME || mob->GetType() == eTYPE_LAVASLIME || mob->GetType() == eTYPE_ENDERDRAGON)
if( std::dynamic_pointer_cast<Monster>( mob ) != NULL || mob->GetType() == eTYPE_GHAST || mob->GetType() == eTYPE_SLIME || mob->GetType() == eTYPE_LAVASLIME || mob->GetType() == eTYPE_ENDERDRAGON)
{
awardStat(GenericStats::killEnemy(), GenericStats::param_noArgs());
@@ -2425,7 +2425,7 @@ void Player::startUsingItem(std::shared_ptr<ItemInstance> instance, int duration
// 4J-JEV, hook for ItemUsed event, and ironbelly achievement.
awardStat(GenericStats::itemsUsed(instance->getItem()->id),
GenericStats::param_itemsUsed(dynamic_pointer_cast<Player>(shared_from_this()),instance));
GenericStats::param_itemsUsed(std::dynamic_pointer_cast<Player>(shared_from_this()),instance));
#if (!defined _DURANGO) && (defined _EXTENDED_ACHIEVEMENTS)
if ( (instance->getItem()->id == Item::rotten_flesh_Id) && (getFoodData()->getFoodLevel() == 0) )
@@ -2774,7 +2774,7 @@ bool Player::isAllowedToInteract(std::shared_ptr<Entity> target)
{
if (getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CanUseContainers) == 0)
{
std::shared_ptr<Minecart> minecart = dynamic_pointer_cast<Minecart>( target );
std::shared_ptr<Minecart> minecart = std::dynamic_pointer_cast<Minecart>( target );
if (minecart->type == Minecart::CHEST)
allowed = false;
}

View File

@@ -21,7 +21,7 @@ bool RandomStrollGoal::canUse()
{
if (mob->getRandom()->nextInt(120) == 0)
{
Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 10, 7);
Vec3 *pos = RandomPos::getPos(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 10, 7);
if (pos == NULL) return false;
wantedX = pos->x;
wantedY = pos->y;
@@ -37,7 +37,7 @@ bool RandomStrollGoal::canUse()
if( mob->isExtraWanderingEnabled() )
{
Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 10, 7,mob->getWanderingQuadrant());
Vec3 *pos = RandomPos::getPos(std::dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 10, 7,mob->getWanderingQuadrant());
if (pos == NULL) return false;
wantedX = pos->x;
wantedY = pos->y;

View File

@@ -42,7 +42,7 @@ void RecordPlayerTile::setRecord(Level *level, int x, int y, int z, int record)
{
if (level->isClientSide) return;
std::shared_ptr<RecordPlayerTile::Entity> rte = dynamic_pointer_cast<RecordPlayerTile::Entity>( level->getTileEntity(x, y, z) );
std::shared_ptr<RecordPlayerTile::Entity> rte = std::dynamic_pointer_cast<RecordPlayerTile::Entity>( level->getTileEntity(x, y, z) );
rte->record = record;
rte->setChanged();
@@ -53,7 +53,7 @@ void RecordPlayerTile::dropRecording(Level *level, int x, int y, int z)
{
if (level->isClientSide) return;
std::shared_ptr<RecordPlayerTile::Entity> rte = dynamic_pointer_cast<RecordPlayerTile::Entity>( level->getTileEntity(x, y, z) );
std::shared_ptr<RecordPlayerTile::Entity> rte = std::dynamic_pointer_cast<RecordPlayerTile::Entity>( level->getTileEntity(x, y, z) );
if( rte == NULL ) return;
int oldRecord = rte->record;

View File

@@ -35,7 +35,7 @@ void ResultSlot::onQuickCraft(std::shared_ptr<ItemInstance> picked, int count)
void ResultSlot::checkTakeAchievements(std::shared_ptr<ItemInstance> carried)
{
carried->onCraftedBy(player->level, dynamic_pointer_cast<Player>( player->shared_from_this() ), removeCount);
carried->onCraftedBy(player->level, std::dynamic_pointer_cast<Player>( player->shared_from_this() ), removeCount);
removeCount = 0;
if (carried->id == Tile::workBench_Id) player->awardStat(GenericStats::buildWorkbench(), GenericStats::param_buildWorkbench());

View File

@@ -41,7 +41,7 @@ bool RotateHeadPacket::canBeInvalidated()
bool RotateHeadPacket::isInvalidatedBy(std::shared_ptr<Packet> packet)
{
std::shared_ptr<RotateHeadPacket> target = dynamic_pointer_cast<RotateHeadPacket>(packet);
std::shared_ptr<RotateHeadPacket> target = std::dynamic_pointer_cast<RotateHeadPacket>(packet);
return target->id == id;
}

View File

@@ -11,9 +11,9 @@ SaddleItem::SaddleItem(int id) : Item(id)
bool SaddleItem::interactEnemy(std::shared_ptr<ItemInstance> itemInstance, std::shared_ptr<Mob> mob)
{
if ( dynamic_pointer_cast<Pig>(mob) )
if ( std::dynamic_pointer_cast<Pig>(mob) )
{
std::shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(mob);
std::shared_ptr<Pig> pig = std::dynamic_pointer_cast<Pig>(mob);
if (!pig->hasSaddle() && !pig->isBaby())
{
pig->setSaddle(true);

View File

@@ -32,16 +32,16 @@ std::shared_ptr<SavedData> SavedDataStorage::get(const type_info& clazz, const w
ConsoleSavePath file = levelStorage->getDataFile(id);
if (!file.getName().empty() && levelStorage->getSaveFile()->doesFileExist( file ) )
{
// mob = dynamic_pointer_cast<Mob>(Mob::_class->newInstance( level ));
// mob = std::dynamic_pointer_cast<Mob>(Mob::_class->newInstance( level ));
//data = clazz.getConstructor(String.class).newInstance(id);
if( clazz == typeid(MapItemSavedData) )
{
data = dynamic_pointer_cast<SavedData>( std::shared_ptr<MapItemSavedData>(new MapItemSavedData(id)) );
data = std::dynamic_pointer_cast<SavedData>( std::shared_ptr<MapItemSavedData>(new MapItemSavedData(id)) );
}
else if( clazz == typeid(Villages) )
{
data = dynamic_pointer_cast<SavedData>( std::shared_ptr<Villages>(new Villages(id) ) );
data = std::dynamic_pointer_cast<SavedData>( std::shared_ptr<Villages>(new Villages(id) ) );
}
else
{

View File

@@ -108,6 +108,6 @@ bool SetEntityMotionPacket::canBeInvalidated()
bool SetEntityMotionPacket::isInvalidatedBy(std::shared_ptr<Packet> packet)
{
std::shared_ptr<SetEntityMotionPacket> target = dynamic_pointer_cast<SetEntityMotionPacket>(packet);
std::shared_ptr<SetEntityMotionPacket> target = std::dynamic_pointer_cast<SetEntityMotionPacket>(packet);
return target->id == id;
}

View File

@@ -64,6 +64,6 @@ bool SetEquippedItemPacket::canBeInvalidated()
bool SetEquippedItemPacket::isInvalidatedBy(std::shared_ptr<Packet> packet)
{
std::shared_ptr<SetEquippedItemPacket> target = dynamic_pointer_cast<SetEquippedItemPacket>(packet);
std::shared_ptr<SetEquippedItemPacket> target = std::dynamic_pointer_cast<SetEquippedItemPacket>(packet);
return target->entity == entity && target->slot == slot;
}

View File

@@ -48,6 +48,6 @@ bool SetRidingPacket::canBeInvalidated()
bool SetRidingPacket::isInvalidatedBy(std::shared_ptr<Packet> packet)
{
std::shared_ptr<SetRidingPacket> target = dynamic_pointer_cast<SetRidingPacket>(packet);
std::shared_ptr<SetRidingPacket> target = std::dynamic_pointer_cast<SetRidingPacket>(packet);
return target->riderId == riderId;
}

View File

@@ -277,9 +277,9 @@ std::shared_ptr<AgableMob> Sheep::getBreedOffspring(std::shared_ptr<AgableMob> t
// 4J - added limit to number of animals that can be bred
if( level->canCreateMore( GetType(), Level::eSpawnType_Breed) )
{
std::shared_ptr<Sheep> otherSheep = dynamic_pointer_cast<Sheep>( target );
std::shared_ptr<Sheep> otherSheep = std::dynamic_pointer_cast<Sheep>( target );
std::shared_ptr<Sheep> sheep = std::shared_ptr<Sheep>( new Sheep(level) );
int color = getOffspringColor(dynamic_pointer_cast<Animal>(shared_from_this()), otherSheep);
int color = getOffspringColor(std::dynamic_pointer_cast<Animal>(shared_from_this()), otherSheep);
sheep->setColor(15 - color);
return sheep;
}
@@ -333,5 +333,5 @@ int Sheep::getOffspringColor(std::shared_ptr<Animal> animal, std::shared_ptr<Ani
int Sheep::getDyeColor(std::shared_ptr<Animal> animal)
{
return 15 - dynamic_pointer_cast<Sheep>(animal)->getColor();
return 15 - std::dynamic_pointer_cast<Sheep>(animal)->getColor();
}

View File

@@ -43,7 +43,7 @@ bool SignItem::useOn(std::shared_ptr<ItemInstance> instance, std::shared_ptr<Pla
}
instance->count--;
std::shared_ptr<SignTileEntity> ste = dynamic_pointer_cast<SignTileEntity>( level->getTileEntity(x, y, z) );
std::shared_ptr<SignTileEntity> ste = std::dynamic_pointer_cast<SignTileEntity>( level->getTileEntity(x, y, z) );
if (ste != NULL) player->openTextEdit(ste);
// 4J-JEV: Hook for durango 'BlockPlaced' event.

View File

@@ -80,7 +80,7 @@ std::shared_ptr<TileEntity> SignTile::newTileEntity(Level *level)
//try {
// 4J Stu - For some reason the newInstance wasn't working right, but doing it like the other TileEntities is fine
return std::shared_ptr<TileEntity>( new SignTileEntity() );
//return dynamic_pointer_cast<TileEntity>( clas->newInstance() );
//return std::dynamic_pointer_cast<TileEntity>( clas->newInstance() );
//} catch (Exception e) {
// TODO 4J Stu - Exception handling
// throw new RuntimeException(e);

Some files were not shown because too many files have changed in this diff Show More