Skip to content

Commit

Permalink
Fixed #32
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Oct 17, 2016
1 parent d53810c commit 1f2eeb1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pocketmine/nbt/NBT.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ public static function getItemHelper(CompoundTag $tag){
return Item::get(0);
}

$item = Item::get($tag->id->getValue(), !isset($tag->Damage) ? 0 : $tag->Damage->getValue(), $tag->Count->getValue());
if($tag->id instanceof IntTag){
$item = Item::get($tag->id->getValue(), !isset($tag->Damage) ? 0 : $tag->Damage->getValue(), $tag->Count->getValue());
}else{ //PC item save format
$item = Item::fromString($tag->id->getValue());
$item->setDamage(!isset($tag->Damage) ? 0 : $tag->Damage->getValue());
$item->setCount($tag->Count->getValue());
}

if(isset($tag->tag) and $tag->tag instanceof CompoundTag){
$item->setNamedTag($tag->tag);
Expand Down

0 comments on commit 1f2eeb1

Please sign in to comment.