From 294745fb0963abcffb89dcf6257df4547d543965 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Fri, 30 May 2025 10:11:25 +0300 Subject: [PATCH] armor will actually be removed now --- src/Player.php | 2 +- src/entity/Entity.php | 1 + src/material/Item.php | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Player.php b/src/Player.php index 46214af2..503993a6 100755 --- a/src/Player.php +++ b/src/Player.php @@ -2355,7 +2355,7 @@ class Player{ $slot = $this->armor[$i]; if($slot->getID() !== AIR && $s->getID() === AIR){ - $this->addItem($slot->getID(), $slot->getMetadata(), 1, false); + $this->addItem($slot->getID(), $slot->getMetadata(), $slot->count, false); $this->armor[$i] = BlockAPI::getItem(AIR, 0, 0); $packet->slots[$i] = 255; }elseif($s->getID() !== AIR and $slot->getID() === AIR and ($sl = $this->hasItem($s->getID())) !== false){ diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 43a6183c..bcf59a55 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -1567,6 +1567,7 @@ class Entity extends Position 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); } $this->player->sendArmor(); } diff --git a/src/material/Item.php b/src/material/Item.php index f67a52be..104be38b 100755 --- a/src/material/Item.php +++ b/src/material/Item.php @@ -236,6 +236,10 @@ class Item{ if($this->meta > $this->getMaxDurability()){ $player->consumeSingleItem(); } + }else{ + if($this->meta > $this->getMaxDurability()){ + --$this->count; + } } } }