Branch merge

This commit is contained in:
Dylan K. Taylor
2017-08-20 21:07:19 +01:00
112 changed files with 931 additions and 800 deletions

View File

@ -27,9 +27,11 @@ declare(strict_types=1);
namespace pocketmine\item;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\entity\Entity;
use pocketmine\item\enchantment\Enchantment;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
@ -327,7 +329,7 @@ class Item implements ItemIds, \JsonSerializable{
public static function get(int $id, int $meta = 0, int $count = 1, $tags = "") : Item{
try{
if($id < 256){
return (new ItemBlock(Block::get($id, $meta), $meta, $count))->setCompoundTag($tags);
return (new ItemBlock(BlockFactory::get($id, $meta), $meta, $count))->setCompoundTag($tags);
}else{
$class = self::$list[$id];
if($class === null){
@ -387,8 +389,8 @@ class Item implements ItemIds, \JsonSerializable{
$this->meta = $meta !== -1 ? $meta & 0xffff : -1;
$this->count = $count;
$this->name = $name;
if(!isset($this->block) and $this->id <= 0xff and isset(Block::$list[$this->id])){
$this->block = Block::get($this->id, $this->meta);
if(!isset($this->block) and $this->id <= 0xff and isset(BlockFactory::$list[$this->id])){
$this->block = BlockFactory::get($this->id, $this->meta);
$this->name = $this->block->getName();
}
}
@ -877,7 +879,7 @@ class Item implements ItemIds, \JsonSerializable{
if($this->block instanceof Block){
return clone $this->block;
}else{
return Block::get(self::AIR);
return BlockFactory::get(self::AIR);
}
}
@ -982,18 +984,16 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Called when a player uses this item on a block.
*
* @param Level $level
* @param Player $player
* @param Block $block
* @param Block $target
* @param int $face
* @param float $fx
* @param float $fy
* @param float $fz
* @param Level $level
* @param Player $player
* @param Block $block
* @param Block $target
* @param int $face
* @param Vector3 $facePos
*
* @return bool
*/
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
public function onActivate(Level $level, Player $player, Block $block, Block $target, int $face, Vector3 $facePos) : bool{
return false;
}