Small fix for ItemFrame

This commit is contained in:
PeratX 2016-04-05 11:47:55 +08:00
commit 0c864affc1
3 changed files with 13 additions and 1 deletions

View file

@ -2436,7 +2436,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$tile->setItem(Item::get(Item::AIR));
$tile->setItemRotation(0);
}
}
}else $tile->spawnTo($this);
}
break;
case ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET:

View file

@ -1462,6 +1462,16 @@ abstract class Entity extends Location implements Metadatable{
}
}
public function setLocation(Location $pos){
if($this->closed){
return false;
}
$this->setPositionAndRotation($pos, $pos->yaw, $pos->pitch);
return true;
}
public function setPosition(Vector3 $pos){
if($this->closed){
return false;

View file

@ -50,6 +50,8 @@ class Location extends Position{
* @param Level|null $level default null
* @param float $yaw default 0.0
* @param float $pitch default 0.0
*
* @return Location
*/
public static function fromObject(Vector3 $pos, Level $level = null, $yaw = 0.0, $pitch = 0.0){
return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, ($level === null) ? (($pos instanceof Position) ? $pos->level : null) : $level);