Merge branch 'master' into mcpe-1.2

This commit is contained in:
Dylan K. Taylor
2017-08-27 16:09:23 +01:00
205 changed files with 1131 additions and 1493 deletions

View File

@ -29,14 +29,19 @@ use pocketmine\block\Block;
* Class used for Items that can be Blocks
*/
class ItemBlock extends Item{
public function __construct(Block $block, $meta = 0, int $count = 1){
/**
* @param Block $block
* @param int $meta Used in crafting recipes for any-damage ingredients (blocks must have meta values 0-15)
*/
public function __construct(Block $block, int $meta = 0){
$this->block = $block;
parent::__construct($block->getId(), $block->getDamage(), $count, $block->getName());
parent::__construct($block->getId(), $meta, $block->getName());
}
public function setDamage(int $meta){
$this->meta = $meta !== -1 ? $meta & 0xf : -1;
$this->block->setDamage($this->meta !== -1 ? $this->meta : 0);
$this->meta = $meta;
$this->block->setDamage($this->meta !== -1 ? $this->meta & 0xf : 0);
}
public function getBlock() : Block{