mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Merged in 1.0.6 changes, added autogenerated data for 1.1.0.3 (doesn't work yet) and deliberately made the same merge error as Mojang
This commit is contained in:
@ -440,14 +440,10 @@ class Effect{
|
||||
$attr->setMaxValue($max);
|
||||
break;
|
||||
case Effect::ABSORPTION:
|
||||
if($ev->willModify() and $oldEffect !== null){
|
||||
$value = $entity->getAbsorption() - (4 * ($oldEffect->getAmplifier() + 1));
|
||||
}else{
|
||||
$value = $entity->getAbsorption();
|
||||
$new = (4 * ($this->amplifier + 1));
|
||||
if($new > $entity->getAbsorption()){
|
||||
$entity->setAbsorption($new);
|
||||
}
|
||||
|
||||
$value += (4 * ($this->amplifier + 1));
|
||||
$entity->setAbsorption($value);
|
||||
break;
|
||||
|
||||
}
|
||||
@ -490,7 +486,7 @@ class Effect{
|
||||
$attr->setMaxValue($attr->getMaxValue() - (4 * ($this->amplifier + 1)));
|
||||
break;
|
||||
case Effect::ABSORPTION:
|
||||
$entity->setAbsorption($entity->getAbsorption() - (4 * ($this->amplifier + 1)));
|
||||
$entity->setAbsorption(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -394,21 +394,38 @@ abstract class Entity extends Location implements Metadatable{
|
||||
public function setNameTagAlwaysVisible($value = true){
|
||||
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ALWAYS_SHOW_NAMETAG, $value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getScale(): float{
|
||||
public function getScale() : float{
|
||||
return $this->getDataProperty(self::DATA_SCALE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
*/
|
||||
public function setScale(float $value){
|
||||
$multiplier = $value / $this->getScale();
|
||||
|
||||
$this->width *= $multiplier;
|
||||
$this->height *= $multiplier;
|
||||
$halfWidth = $this->width / 2;
|
||||
|
||||
$this->boundingBox->setBounds(
|
||||
$this->x - $halfWidth,
|
||||
$this->y,
|
||||
$this->z - $halfWidth,
|
||||
$this->x + $halfWidth,
|
||||
$this->y + $this->height,
|
||||
$this->z + $halfWidth
|
||||
);
|
||||
|
||||
$this->setDataProperty(self::DATA_SCALE, self::DATA_TYPE_FLOAT, $value);
|
||||
$this->setDataProperty(self::DATA_BOUNDING_BOX_WIDTH, self::DATA_TYPE_FLOAT, $this->width);
|
||||
$this->setDataProperty(self::DATA_BOUNDING_BOX_HEIGHT, self::DATA_TYPE_FLOAT, $this->height);
|
||||
}
|
||||
|
||||
|
||||
public function isSneaking(){
|
||||
return $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_SNEAKING);
|
||||
}
|
||||
|
Reference in New Issue
Block a user