Fix "Creating default object from empty value" (#858)

while setting lore to items.
This commit is contained in:
Muqsit Rayyan 2017-04-20 22:39:09 +03:00 committed by Dylan K. Taylor
parent 86de0bddd9
commit 547a09c8d4

View File

@ -685,7 +685,7 @@ class Item implements ItemIds, \JsonSerializable{
}
public function setLore(array $lines){
$tag = $this->getNamedTag();
$tag = $this->getNamedTag() ?? new CompoundTag("", []);
if(!isset($tag->display)){
$tag->display = new CompoundTag("display", []);
}