mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Fixed mis-uses of Item->isTool()
this has been wrongly used to indicate a durable item, but not just tools are durable items.
This commit is contained in:
parent
5368120f13
commit
0247dff909
@ -76,6 +76,7 @@ use pocketmine\inventory\transaction\CraftingTransaction;
|
||||
use pocketmine\inventory\transaction\InventoryTransaction;
|
||||
use pocketmine\inventory\transaction\TransactionValidationException;
|
||||
use pocketmine\item\Consumable;
|
||||
use pocketmine\item\Durable;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\WritableBook;
|
||||
use pocketmine\item\WrittenBook;
|
||||
@ -2511,7 +2512,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$target->attack($ev);
|
||||
|
||||
if($ev->isCancelled()){
|
||||
if($heldItem->isTool() and $this->isSurvival()){
|
||||
if($heldItem instanceof Durable and $this->isSurvival()){
|
||||
$this->inventory->sendContents($this);
|
||||
}
|
||||
return true;
|
||||
|
@ -164,7 +164,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
|
||||
public static function getCreativeItemIndex(Item $item) : int{
|
||||
foreach(Item::$creative as $i => $d){
|
||||
if($item->equals($d, !$item->isTool())){
|
||||
if($item->equals($d, !($item instanceof Durable))){
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user