mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 05:34:54 +00:00
fixed players need to move to pick up dropped items, close #498
This commit is contained in:
parent
f75cc93160
commit
874afc2fd2
@ -1570,10 +1570,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->isSpectator()){
|
|
||||||
$this->checkNearEntities($tickDiff);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->speed = ($to->subtract($from))->divide($tickDiff);
|
$this->speed = ($to->subtract($from))->divide($tickDiff);
|
||||||
}elseif($distanceSquared == 0){
|
}elseif($distanceSquared == 0){
|
||||||
$this->speed = new Vector3(0, 0, 0);
|
$this->speed = new Vector3(0, 0, 0);
|
||||||
@ -1663,28 +1659,33 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
$this->processMovement($tickDiff);
|
$this->processMovement($tickDiff);
|
||||||
$this->entityBaseTick($tickDiff);
|
$this->entityBaseTick($tickDiff);
|
||||||
|
|
||||||
if(!$this->isSpectator() and $this->speed !== null){
|
if(!$this->isSpectator()){
|
||||||
if($this->onGround){
|
$this->checkNearEntities($tickDiff);
|
||||||
if($this->inAirTicks !== 0){
|
|
||||||
$this->startAirTicks = 5;
|
|
||||||
}
|
|
||||||
$this->inAirTicks = 0;
|
|
||||||
}else{
|
|
||||||
if(!$this->allowFlight and $this->inAirTicks > 10 and !$this->isSleeping() and !$this->isImmobile()){
|
|
||||||
$expectedVelocity = (-$this->gravity) / $this->drag - ((-$this->gravity) / $this->drag) * exp(-$this->drag * ($this->inAirTicks - $this->startAirTicks));
|
|
||||||
$diff = ($this->speed->y - $expectedVelocity) ** 2;
|
|
||||||
|
|
||||||
if(!$this->hasEffect(Effect::JUMP) and $diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
|
if($this->speed !== null){
|
||||||
if($this->inAirTicks < 100){
|
if($this->onGround){
|
||||||
$this->setMotion(new Vector3(0, $expectedVelocity, 0));
|
if($this->inAirTicks !== 0){
|
||||||
}elseif($this->kick("Flying is not enabled on this server")){
|
$this->startAirTicks = 5;
|
||||||
$this->timings->stopTiming();
|
}
|
||||||
return false;
|
$this->inAirTicks = 0;
|
||||||
|
}else{
|
||||||
|
if(!$this->allowFlight and $this->inAirTicks > 10 and !$this->isSleeping() and !$this->isImmobile()){
|
||||||
|
$expectedVelocity = (-$this->gravity) / $this->drag - ((-$this->gravity) / $this->drag) * exp(-$this->drag * ($this->inAirTicks - $this->startAirTicks));
|
||||||
|
$diff = ($this->speed->y - $expectedVelocity) ** 2;
|
||||||
|
|
||||||
|
if(!$this->hasEffect(Effect::JUMP) and $diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){
|
||||||
|
if($this->inAirTicks < 100){
|
||||||
|
$this->setMotion(new Vector3(0, $expectedVelocity, 0));
|
||||||
|
}elseif($this->kick("Flying is not enabled on this server")){
|
||||||
|
$this->timings->stopTiming();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
++$this->inAirTicks;
|
++$this->inAirTicks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user