Fixed null Items with id < 256 not working correctly

This commit is contained in:
Shoghi Cervantes 2014-05-28 17:58:09 +02:00
parent f66560ccd4
commit dafa4f1b1c
3 changed files with 4 additions and 4 deletions

View File

@ -390,6 +390,7 @@ class CraftingManager{
} }
} }
} }
if(count($checkInput) === 0){ if(count($checkInput) === 0){
$hasRecipe = $recipe; $hasRecipe = $recipe;
break; break;

View File

@ -33,7 +33,7 @@ class Block extends Item{
} }
public function setDamage($meta){ public function setDamage($meta){
$this->meta = $meta & 0x0F; $this->meta = $meta !== null ? $meta & 0xFF : null;
$this->block->setDamage($this->meta); $this->block->setDamage($this->meta);
} }

View File

@ -26,10 +26,10 @@ namespace pocketmine\item;
use pocketmine\block\Block; use pocketmine\block\Block;
use pocketmine\entity\Entity; use pocketmine\entity\Entity;
use pocketmine\inventory\Fuel;
use pocketmine\item\Block as ItemBlock; use pocketmine\item\Block as ItemBlock;
use pocketmine\level\Level; use pocketmine\level\Level;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\recipes\Fuel;
class Item{ class Item{
//All Block IDs are here too //All Block IDs are here too
@ -440,7 +440,6 @@ class Item{
}else{ }else{
$item = new Item($id, $meta, $count); $item = new Item($id, $meta, $count);
} }
return $item; return $item;
} }
@ -587,7 +586,7 @@ class Item{
} }
final public function __toString(){ final public function __toString(){
return "Item " . $this->name . " (" . $this->id . ":" . $this->meta . ")"; return "Item " . $this->name . " (" . $this->id . ":" . ($this->meta === null ? "?" : $this->meta) . ")";
} }
public function getDestroySpeed(Block $block, Player $player){ public function getDestroySpeed(Block $block, Player $player){