diff --git a/Minecraft.World/ArmorStand.cpp b/Minecraft.World/ArmorStand.cpp index cff11345..af2aacc9 100644 --- a/Minecraft.World/ArmorStand.cpp +++ b/Minecraft.World/ArmorStand.cpp @@ -80,6 +80,9 @@ void ArmorStand::defineSynchedData() void ArmorStand::tick() { float lockedRot = this->yRot; + if (this->isInWater()|| this->isInLava()) { + this->yd -= 0.0392; + } LivingEntity::tick(); this->yRot = lockedRot; this->yRotO = lockedRot; @@ -87,6 +90,8 @@ void ArmorStand::tick() this->yBodyRotO = lockedRot; this->yHeadRot = lockedRot; this->yHeadRotO = lockedRot; + + } bool ArmorStand::interact(shared_ptr player) @@ -142,50 +147,61 @@ bool ArmorStand::interact(shared_ptr player) return true; } } - bool ArmorStand::hurt(DamageSource *source, float damage) { - if (isInvulnerable()) return false; - if (level->isClientSide || removed) return false; - if (isMarker()) return false; + if (isInvulnerable() || level->isClientSide || removed || isMarker()) return false; - if (dynamic_cast(source) != nullptr) - { - shared_ptr attacker = source->getEntity(); - if (attacker != nullptr && attacker->instanceof(eTYPE_PLAYER)) - { - shared_ptr player = dynamic_pointer_cast(attacker); - if (player->abilities.instabuild) - { - - - level->broadcastEntityEvent(shared_from_this(), (byte)31); + if (source != nullptr && source->getMsgId() == eEntityDamageType_Suffocate) return false; + bool isFireDamage = source->isFire(); + + + if (dynamic_cast(source) != nullptr) { + shared_ptr attacker = source->getEntity(); + if (attacker != nullptr && attacker->instanceof(eTYPE_PLAYER)) { + if (dynamic_pointer_cast(attacker)->abilities.instabuild) { + level->broadcastEntityEvent(shared_from_this(), (byte)31); remove(); return true; } } } + long long now = (long long)tickCount; - if (now - lastHit > 5) - { + + + if (isFireDamage) { + + float currentHealth = this->getHealth() - 0.1f; + this->setHealth(currentHealth); + + if (currentHealth <= 0) { + //level->broadcastEntityEvent(shared_from_this(), (byte)31); + remove(); + return true; + } + + + return false; + } + + + if (now - lastHit > 5) { level->broadcastEntityEvent(shared_from_this(), (byte)32); lastHit = now; - } - else - { + return true; + } else { + level->broadcastEntityEvent(shared_from_this(), (byte)31); remove(); spawnAtLocation(Item::armor_stand_Id, 1); for (int i = 0; i < 5; i++) { - if (equipment[i] != nullptr) { - spawnAtLocation(equipment[i], 0.0f); - } + if (equipment[i] != nullptr) spawnAtLocation(equipment[i], 0.0f); } + return true; } - return true; } bool ArmorStand::isPickable() @@ -427,4 +443,11 @@ void ArmorStand::handleEntityEvent(byte id) lastHit = (long long)tickCount; else LivingEntity::handleEntityEvent(id); -} \ No newline at end of file +} + +bool ArmorStand::updateInWaterState() +{ + + return Entity::updateInWaterState(); +} + diff --git a/Minecraft.World/ArmorStand.h b/Minecraft.World/ArmorStand.h index af1a8f3f..e8f91311 100644 --- a/Minecraft.World/ArmorStand.h +++ b/Minecraft.World/ArmorStand.h @@ -97,6 +97,9 @@ public: virtual wstring getAName() override { return L""; } virtual wstring getDisplayName() override { return L""; } virtual wstring getNetworkName() override { return L""; } + virtual bool isInWall() override { return false; } + + virtual shared_ptr getCarriedItem() override; virtual shared_ptr getCarried(int slot) override; @@ -107,6 +110,8 @@ public: virtual void readAdditionalSaveData(CompoundTag *tag) override; virtual void addAdditonalSaveData(CompoundTag *tag) override; virtual void handleEntityEvent(byte eventId) override; + + virtual bool updateInWaterState() override; protected: virtual void defineSynchedData() override; diff --git a/Minecraft.World/Recipes.cpp b/Minecraft.World/Recipes.cpp index f6645025..54ebb91e 100644 --- a/Minecraft.World/Recipes.cpp +++ b/Minecraft.World/Recipes.cpp @@ -1030,7 +1030,7 @@ Recipes::Recipes() L" S ", L"SXS", L'S', Item::stick, - L'X',Tile::stoneSlabHalf, + L'X', Tile::stoneSlabHalf, L'D');