mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 22:15:30 +00:00
Entity: Rename fall() to onHitGround(), and make it protected
this had no business being exposed to public API in the first place.
This commit is contained in:
parent
6ecad153ea
commit
8be1f34736
@ -1025,7 +1025,7 @@ abstract class Entity{
|
|||||||
protected function updateFallState(float $distanceThisTick, bool $onGround) : void{
|
protected function updateFallState(float $distanceThisTick, bool $onGround) : void{
|
||||||
if($onGround){
|
if($onGround){
|
||||||
if($this->fallDistance > 0){
|
if($this->fallDistance > 0){
|
||||||
$this->fall();
|
$this->onHitGround();
|
||||||
$this->resetFallDistance();
|
$this->resetFallDistance();
|
||||||
}
|
}
|
||||||
}elseif($distanceThisTick < $this->fallDistance){
|
}elseif($distanceThisTick < $this->fallDistance){
|
||||||
@ -1042,7 +1042,7 @@ abstract class Entity{
|
|||||||
/**
|
/**
|
||||||
* Called when a falling entity hits the ground.
|
* Called when a falling entity hits the ground.
|
||||||
*/
|
*/
|
||||||
public function fall() : void{
|
protected function onHitGround() : void{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ abstract class Living extends Entity{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fall() : void{
|
protected function onHitGround() : void{
|
||||||
$damage = ceil($this->fallDistance - 3 - (($jumpBoost = $this->effectManager->get(VanillaEffects::JUMP_BOOST())) !== null ? $jumpBoost->getEffectLevel() : 0));
|
$damage = ceil($this->fallDistance - 3 - (($jumpBoost = $this->effectManager->get(VanillaEffects::JUMP_BOOST())) !== null ? $jumpBoost->getEffectLevel() : 0));
|
||||||
if($damage > 0){
|
if($damage > 0){
|
||||||
$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_FALL, $damage);
|
$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_FALL, $damage);
|
||||||
|
@ -1200,9 +1200,9 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
$this->sendPosition($from, $from->yaw, $from->pitch, MovePlayerPacket::MODE_RESET);
|
$this->sendPosition($from, $from->yaw, $from->pitch, MovePlayerPacket::MODE_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fall() : void{
|
protected function onHitGround() : void{
|
||||||
if(!$this->flying){
|
if(!$this->flying){
|
||||||
parent::fall();
|
parent::onHitGround();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user