Make Item->getNamedTag() a bit less ugly

This commit is contained in:
Dylan K. Taylor 2017-10-08 12:17:18 +01:00
parent 81dee2f9fc
commit 00bf190e54

View File

@ -595,10 +595,9 @@ class Item implements ItemIds, \JsonSerializable{
public function getNamedTag(){
if(!$this->hasCompoundTag()){
return null;
}elseif($this->cachedNBT !== null){
return $this->cachedNBT;
}
return $this->cachedNBT = self::parseCompoundTag($this->tags);
return $this->cachedNBT ?? ($this->cachedNBT = $this->cachedNBT = self::parseCompoundTag($this->tags));
}
/**