aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Witch.cpp
diff options
context:
space:
mode:
authorqwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com>2026-03-16 21:44:26 -0500
committerGitHub <noreply@github.com>2026-03-16 21:44:26 -0500
commitce739f6045ec72127491286ea3f3f21e537c1b55 (patch)
treef33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.World/Witch.cpp
parent255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff)
parent5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff)
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.World/Witch.cpp')
-rw-r--r--Minecraft.World/Witch.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Minecraft.World/Witch.cpp b/Minecraft.World/Witch.cpp
index c697d467..375c8388 100644
--- a/Minecraft.World/Witch.cpp
+++ b/Minecraft.World/Witch.cpp
@@ -43,7 +43,7 @@ void Witch::defineSynchedData()
{
Monster::defineSynchedData();
- getEntityData()->define(DATA_USING_ITEM, (byte) 0);
+ getEntityData()->define(DATA_USING_ITEM, static_cast<byte>(0));
}
int Witch::getAmbientSound()
@@ -63,7 +63,7 @@ int Witch::getDeathSound()
void Witch::setUsingItem(bool isUsing)
{
- getEntityData()->set(DATA_USING_ITEM, isUsing ? (byte) 1 : (byte) 0);
+ getEntityData()->set(DATA_USING_ITEM, isUsing ? static_cast<byte>(1) : static_cast<byte>(0));
}
bool Witch::isUsingItem()
@@ -96,10 +96,10 @@ void Witch::aiStep()
shared_ptr<ItemInstance> item = getCarriedItem();
setEquippedSlot(SLOT_WEAPON, nullptr);
- if (item != NULL && item->id == Item::potion_Id)
+ if (item != nullptr && item->id == Item::potion_Id)
{
vector<MobEffectInstance *> *effects = Item::potion->getMobEffects(item);
- if (effects != NULL)
+ if (effects != nullptr)
{
for(auto& effect : *effects)
{
@@ -124,18 +124,18 @@ void Witch::aiStep()
{
potion = PotionBrewing::POTION_ID_HEAL;
}
- else if (random->nextFloat() < 0.25f && getTarget() != NULL && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11)
+ else if (random->nextFloat() < 0.25f && getTarget() != nullptr && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11)
{
potion = PotionBrewing::POTION_ID_SWIFTNESS;
}
- else if (random->nextFloat() < 0.25f && getTarget() != NULL && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11)
+ else if (random->nextFloat() < 0.25f && getTarget() != nullptr && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11)
{
potion = PotionBrewing::POTION_ID_SWIFTNESS;
}
if (potion > -1)
{
- setEquippedSlot(SLOT_WEAPON, shared_ptr<ItemInstance>( new ItemInstance(Item::potion, 1, potion)) );
+ setEquippedSlot(SLOT_WEAPON, std::make_shared<ItemInstance>(Item::potion, 1, potion));
usingTime = getCarriedItem()->getUseDuration();
setUsingItem(true);
AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED);
@@ -198,7 +198,7 @@ void Witch::performRangedAttack(shared_ptr<LivingEntity> target, float power)
{
if (isUsingItem()) return;
- shared_ptr<ThrownPotion> potion = shared_ptr<ThrownPotion>( new ThrownPotion(level, dynamic_pointer_cast<LivingEntity>(shared_from_this()), PotionBrewing::POTION_ID_SPLASH_DAMAGE) );
+ shared_ptr<ThrownPotion> potion = std::make_shared<ThrownPotion>(level, dynamic_pointer_cast<LivingEntity>(shared_from_this()), PotionBrewing::POTION_ID_SPLASH_DAMAGE);
potion->xRot -= -20;
double xd = (target->x + target->xd) - x;
double yd = (target->y + target->getHeadHeight() - 1.1f) - y;