mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Merge branch 'master' into mcpe-1.2
This commit is contained in:
@ -107,7 +107,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
* @param string $str
|
||||
* @param string $skinId
|
||||
*/
|
||||
public function setSkin($str, $skinId){
|
||||
public function setSkin(string $str, string $skinId){
|
||||
if(!Player::isValidSkin($str)){
|
||||
throw new \InvalidStateException("Specified skin is not valid, must be 8KiB or 16KiB");
|
||||
}
|
||||
@ -298,7 +298,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
|
||||
protected function initEntity(){
|
||||
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false, self::DATA_TYPE_BYTE);
|
||||
$this->setPlayerFlag(self::DATA_PLAYER_FLAG_SLEEP, false);
|
||||
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0], false);
|
||||
|
||||
$this->inventory = new PlayerInventory($this);
|
||||
@ -381,7 +381,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::EXPERIENCE));
|
||||
}
|
||||
|
||||
public function entityBaseTick($tickDiff = 1){
|
||||
public function entityBaseTick(int $tickDiff = 1) : bool{
|
||||
$hasUpdate = parent::entityBaseTick($tickDiff);
|
||||
|
||||
$this->doFoodTick($tickDiff);
|
||||
@ -430,7 +430,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
}
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
public function getName() : string{
|
||||
return $this->getNameTag();
|
||||
}
|
||||
|
||||
@ -541,4 +541,24 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
parent::close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around {@link Entity#getDataFlag} for player-specific data flag reading.
|
||||
*
|
||||
* @param int $flagId
|
||||
* @return bool
|
||||
*/
|
||||
public function getPlayerFlag(int $flagId){
|
||||
return $this->getDataFlag(self::DATA_PLAYER_FLAGS, $flagId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around {@link Entity#setDataFlag} for player-specific data flag setting.
|
||||
*
|
||||
* @param int $flagId
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setPlayerFlag(int $flagId, bool $value = true){
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, $flagId, $value, self::DATA_TYPE_BYTE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user