Living: improved projectile knockback

this isn't pretty, but it works. I have a nicer idea how to do this on PM4, but it's going to involve BC breaks (as usual).
closes #3382
This commit is contained in:
Dylan K. Taylor 2020-05-31 20:04:12 +01:00
parent 2b58f2bafd
commit 8c5a81cf5c

View File

@ -548,12 +548,14 @@ abstract class Living extends Entity implements Damageable{
$this->attackTime = $source->getAttackCooldown();
if($source instanceof EntityDamageByEntityEvent){
$e = $source->getDamager();
if($source instanceof EntityDamageByChildEntityEvent){
$e = $source->getChild();
if($source instanceof EntityDamageByChildEntityEvent){
$e = $source->getChild();
if($e !== null){
$motion = $e->getMotion();
$this->knockBack($e, $source->getBaseDamage(), $motion->x, $motion->z, $source->getKnockBack());
}
}elseif($source instanceof EntityDamageByEntityEvent){
$e = $source->getDamager();
if($e !== null){
$deltaX = $this->x - $e->x;
$deltaZ = $this->z - $e->z;