From 206b397ee1443c6341427a2cd5fccd2296683035 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Jul 2019 19:52:51 +0100 Subject: [PATCH] Living: drop useless knockBack() parameters, closes #2634 --- changelogs/4.0-snapshot.md | 1 + src/pocketmine/entity/Living.php | 4 ++-- src/pocketmine/item/enchantment/KnockbackEnchantment.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/changelogs/4.0-snapshot.md b/changelogs/4.0-snapshot.md index 4ed0b3cfa..3594ce779 100644 --- a/changelogs/4.0-snapshot.md +++ b/changelogs/4.0-snapshot.md @@ -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` diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index 2225f54ba..c0fd5338b 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -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; diff --git a/src/pocketmine/item/enchantment/KnockbackEnchantment.php b/src/pocketmine/item/enchantment/KnockbackEnchantment.php index 04cb92fe5..da274a409 100644 --- a/src/pocketmine/item/enchantment/KnockbackEnchantment.php +++ b/src/pocketmine/item/enchantment/KnockbackEnchantment.php @@ -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); } } }