From e992aa4aff2dfbfa6de9ec652d5344457eb355bf Mon Sep 17 00:00:00 2001 From: yefengeeeeeeeeeee <403749250@qq.com> Date: Thu, 13 Aug 2026 17:19:55 +0800 Subject: [PATCH] Player under MCPE 0.7.4 will clean the armor state when death --- src/Player.php | 2 +- src/entity/Entity.php | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Player.php b/src/Player.php index 9c7859cb..dc19fae5 100755 --- a/src/Player.php +++ b/src/Player.php @@ -1469,7 +1469,7 @@ class Player{ } } - if(!$this->isWorkBench && $this->PROTOCOL <= ProtocolInfo6::CURRENT_PROTOCOL_6 && $type === STONE_BRICK){ + if($this->PROTOCOL <= ProtocolInfo6::CURRENT_PROTOCOL_6 && $type === STONE_BRICK){ $this->toCraft = []; $this->craftingItems = []; return false; diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 91d8a31a..85215bd2 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -1629,14 +1629,14 @@ class Entity extends Position if($this->isPlayer()){ $v2 = (int)($dmg / 4); if($v2 < 1) $v2 = 1; - + foreach($this->player->armor as $slot => $part){ $part->hurtAndBreak($v2, $this->player, helditem: false); if($part->count <= 0) $this->player->setArmor($slot, BlockAPI::getItem(0, 0, 0), send: false); } if($this->player->getProtocol() < ProtocolInfo12::CURRENT_PROTOCOL_12 && $this->player->getProtocol() > ProtocolInfo8::CURRENT_PROTOCOL_8){ $pk = new HurtArmorPacket(); - $pk->health = $v2; //TODO: Verify the real attack health for it + $pk->health = $v2; $this->player->entityQueueDataPacket($pk); } $this->player->sendArmor(); @@ -1731,9 +1731,11 @@ class Entity extends Position $pk->event = EntityEventPacket::ENTITY_DEAD; $this->player->entityQueueDataPacket($pk); } elseif (isset($this->player->isOre[DIAMOND_HELMET])) { - $pk = new HurtArmorPacket(); - $pk->health = 900; //TODO Verify the real attack health for it - $this->player->entityQueueDataPacket($pk); + for($i = 0 ; $i < 19 ; $i++){ + $pk = new HurtArmorPacket(); + $pk->health = 127; + $this->player->entityQueueDataPacket($pk); + } } } $this->player->isOre = [];