Living: drop useless knockBack() parameters, closes #2634

This commit is contained in:
Dylan K. Taylor 2019-07-02 19:52:51 +01:00
parent b0a85155d7
commit 206b397ee1
3 changed files with 4 additions and 3 deletions

View File

@ -152,6 +152,7 @@ This version features substantial changes to the network system, improving coher
- The following methods have signature changes:
- `Entity->entityBaseTick()` is now `protected`.
- `Entity->move()` is now `protected`.
- `Living->knockBack()` now accepts `float, float, float` (the first two parameters have been removed).
- The following classes have been removed:
- `Creature`
- `Damageable`

View File

@ -579,7 +579,7 @@ abstract class Living extends Entity{
$deltaX = $this->x - $e->x;
$deltaZ = $this->z - $e->z;
$this->knockBack($e, $source->getBaseDamage(), $deltaX, $deltaZ, $source->getKnockBack());
$this->knockBack($deltaX, $deltaZ, $source->getKnockBack());
}
}
@ -593,7 +593,7 @@ abstract class Living extends Entity{
$this->broadcastEntityEvent(EntityEventPacket::HURT_ANIMATION);
}
public function knockBack(Entity $attacker, float $damage, float $x, float $z, float $base = 0.4) : void{
public function knockBack(float $x, float $z, float $base = 0.4) : void{
$f = sqrt($x * $x + $z * $z);
if($f <= 0){
return;

View File

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