mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +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\InventoryTransaction;
|
||||||
use pocketmine\inventory\transaction\TransactionValidationException;
|
use pocketmine\inventory\transaction\TransactionValidationException;
|
||||||
use pocketmine\item\Consumable;
|
use pocketmine\item\Consumable;
|
||||||
|
use pocketmine\item\Durable;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\item\WritableBook;
|
use pocketmine\item\WritableBook;
|
||||||
use pocketmine\item\WrittenBook;
|
use pocketmine\item\WrittenBook;
|
||||||
@ -2511,7 +2512,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$target->attack($ev);
|
$target->attack($ev);
|
||||||
|
|
||||||
if($ev->isCancelled()){
|
if($ev->isCancelled()){
|
||||||
if($heldItem->isTool() and $this->isSurvival()){
|
if($heldItem instanceof Durable and $this->isSurvival()){
|
||||||
$this->inventory->sendContents($this);
|
$this->inventory->sendContents($this);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -164,7 +164,7 @@ class Item implements ItemIds, \JsonSerializable{
|
|||||||
|
|
||||||
public static function getCreativeItemIndex(Item $item) : int{
|
public static function getCreativeItemIndex(Item $item) : int{
|
||||||
foreach(Item::$creative as $i => $d){
|
foreach(Item::$creative as $i => $d){
|
||||||
if($item->equals($d, !$item->isTool())){
|
if($item->equals($d, !($item instanceof Durable))){
|
||||||
return $i;
|
return $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user