mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 01:29:55 +00:00
Allow setting null damage on items
This commit is contained in:
parent
6cbd39de9b
commit
34c2510f0f
@ -28,6 +28,7 @@ use pocketmine\item\Item;
|
||||
use pocketmine\Player;
|
||||
|
||||
interface Inventory{
|
||||
const MAX_STACK = 64;
|
||||
|
||||
public function getSize();
|
||||
|
||||
@ -150,4 +151,8 @@ interface Inventory{
|
||||
* @return InventoryHolder
|
||||
*/
|
||||
public function getHolder();
|
||||
|
||||
public function onOpen(Player $who);
|
||||
|
||||
public function onClose(Player $who);
|
||||
}
|
||||
|
@ -475,8 +475,8 @@ class Item{
|
||||
}
|
||||
|
||||
public function __construct($id, $meta = 0, $count = 1, $name = "Unknown"){
|
||||
$this->id = (int) $id;
|
||||
$this->meta = (int) $meta;
|
||||
$this->id = $id & 0xffff;
|
||||
$this->meta = $meta !== null ? $meta & 0xffff : null;
|
||||
$this->count = (int) $count;
|
||||
$this->name = $name;
|
||||
if(!isset($this->block) and $this->id <= 0xff and isset(Block::$list[$this->id])){
|
||||
@ -522,7 +522,7 @@ class Item{
|
||||
}
|
||||
|
||||
public function setDamage($meta){
|
||||
$this->meta = $meta & 0xFFFF;
|
||||
$this->meta = $meta !== null ? $meta & 0xFFFF : null;
|
||||
}
|
||||
|
||||
final public function getMaxStackSize(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user