mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 03:51:37 +00:00
Refactored entity metadata handling into its own class, with type-safe methods (#1876)
This includes several other changes, including: - SLOT data properties now accept items directly - POS data properties now accept floored Vector3s (in future this will be block positions) or null for 0,0,0 - VECTOR3F data properties now accept Vector3s or null for 0,0,0
This commit is contained in:
@@ -1171,7 +1171,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$this->sleeping = clone $pos;
|
||||
|
||||
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [$pos->x, $pos->y, $pos->z]);
|
||||
$this->propertyManager->setBlockPos(self::DATA_PLAYER_BED_POSITION, $pos);
|
||||
$this->setPlayerFlag(self::DATA_PLAYER_FLAG_SLEEP, true);
|
||||
|
||||
$this->setSpawn($pos);
|
||||
@@ -1190,7 +1190,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$this->server->getPluginManager()->callEvent($ev = new PlayerBedLeaveEvent($this, $b));
|
||||
|
||||
$this->sleeping = null;
|
||||
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0]);
|
||||
$this->propertyManager->setBlockPos(self::DATA_PLAYER_BED_POSITION, null);
|
||||
$this->setPlayerFlag(self::DATA_PLAYER_FLAG_SLEEP, false);
|
||||
|
||||
$this->level->setSleepTicks(0);
|
||||
|
Reference in New Issue
Block a user