mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Tool: cleanup durability handling, closes #379
long overdue... this isn't quite as extensible as the original api3/blocks system was, but this is primarily intended to replace Item->useOn(). If plugins want to use it it can be extended later on.
This commit is contained in:
@ -715,15 +715,6 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Entity|Block $object
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function useOn($object){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns what type of block-breaking tool this is. Blocks requiring the same tool type as the item will break
|
||||
* faster (except for blocks requiring no tool, which break at the same speed regardless of the tool used)
|
||||
@ -814,6 +805,28 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this item is used to destroy a block. Usually used to update durability.
|
||||
*
|
||||
* @param Block $block
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onDestroyBlock(Block $block) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this item is used to attack an entity. Usually used to update durability.
|
||||
*
|
||||
* @param Entity $victim
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onAttackEntity(Entity $victim) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of ticks a player must wait before activating this item again.
|
||||
*
|
||||
|
Reference in New Issue
Block a user