mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 01:29:55 +00:00
Living: added knockback resistance attribute checks
This commit is contained in:
parent
509e8c5f6d
commit
595f1f58da
@ -564,7 +564,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
if($f <= 0){
|
||||
return;
|
||||
}
|
||||
|
||||
if(mt_rand() / mt_getrandmax() > $this->getAttributeMap()->getAttribute(Attribute::KNOCKBACK_RESISTANCE)->getValue()){
|
||||
$f = 1 / $f;
|
||||
|
||||
$motion = new Vector3($this->motionX, $this->motionY, $this->motionZ);
|
||||
@ -582,6 +582,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
|
||||
$this->setMotion($motion);
|
||||
}
|
||||
}
|
||||
|
||||
public function kill() : void{
|
||||
parent::kill();
|
||||
|
Loading…
x
Reference in New Issue
Block a user