Merge branch 'master' into mcpe-1.2

This commit is contained in:
Dylan K. Taylor
2017-08-17 17:14:16 +01:00
215 changed files with 1482 additions and 1257 deletions

View File

@ -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);
}
}