first look at separating Entity and Location

This commit is contained in:
Dylan K. Taylor
2019-08-19 17:20:34 +01:00
parent 591d35889e
commit 2d4a32fc77
36 changed files with 302 additions and 257 deletions

View File

@@ -38,7 +38,8 @@ class KnockbackEnchantment extends MeleeWeaponEnchantment{
public function onPostAttack(Entity $attacker, Entity $victim, int $enchantmentLevel) : void{
if($victim instanceof Living){
$victim->knockBack($victim->x - $attacker->x, $victim->z - $attacker->z, $enchantmentLevel * 0.5);
$diff = $victim->getPosition()->subtract($attacker->getPosition());
$victim->knockBack($diff->x, $diff->z, $enchantmentLevel * 0.5);
}
}
}