mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-16 16:34:05 +00:00
Living: drop useless knockBack() parameters, closes #2634
This commit is contained in:
parent
b0a85155d7
commit
206b397ee1
@ -152,6 +152,7 @@ This version features substantial changes to the network system, improving coher
|
|||||||
- The following methods have signature changes:
|
- The following methods have signature changes:
|
||||||
- `Entity->entityBaseTick()` is now `protected`.
|
- `Entity->entityBaseTick()` is now `protected`.
|
||||||
- `Entity->move()` 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:
|
- The following classes have been removed:
|
||||||
- `Creature`
|
- `Creature`
|
||||||
- `Damageable`
|
- `Damageable`
|
||||||
|
@ -579,7 +579,7 @@ abstract class Living extends Entity{
|
|||||||
|
|
||||||
$deltaX = $this->x - $e->x;
|
$deltaX = $this->x - $e->x;
|
||||||
$deltaZ = $this->z - $e->z;
|
$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);
|
$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);
|
$f = sqrt($x * $x + $z * $z);
|
||||||
if($f <= 0){
|
if($f <= 0){
|
||||||
return;
|
return;
|
||||||
|
@ -38,7 +38,7 @@ class KnockbackEnchantment extends MeleeWeaponEnchantment{
|
|||||||
|
|
||||||
public function onPostAttack(Entity $attacker, Entity $victim, int $enchantmentLevel) : void{
|
public function onPostAttack(Entity $attacker, Entity $victim, int $enchantmentLevel) : void{
|
||||||
if($victim instanceof Living){
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user