mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 21:45:35 +00:00
Improved Player->onGround checking
This commit is contained in:
parent
fec387d2ec
commit
e3e97a4205
@ -1152,6 +1152,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$pk->teleport = true;
|
$pk->teleport = true;
|
||||||
$this->directDataPacket($pk);
|
$this->directDataPacket($pk);
|
||||||
$this->forceMovement = new Vector3($from->x, $from->y, $from->z);
|
$this->forceMovement = new Vector3($from->x, $from->y, $from->z);
|
||||||
|
$this->newPosition = null;
|
||||||
}else{
|
}else{
|
||||||
$this->forceMovement = null;
|
$this->forceMovement = null;
|
||||||
if($this->nextChunkOrderRun > 20){
|
if($this->nextChunkOrderRun > 20){
|
||||||
|
@ -955,16 +955,14 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
}else{
|
}else{
|
||||||
|
|
||||||
if($this instanceof Player){
|
if($this instanceof Player){
|
||||||
if(($this->onGround and $movY != 0) or (!$this->onGround and $movY < 0)){
|
if(!$this->onGround or $movY != 0){
|
||||||
$bb = clone $this->boundingBox;
|
$bb = clone $this->boundingBox;
|
||||||
$bb->maxY = $bb->minY + 0.5;
|
$bb->maxY = $bb->minY + 1;
|
||||||
if(count($this->level->getCollisionBlocks($bb->expand(0.01, 0.01, 0.01))) > 0){
|
if(count($this->level->getCollisionBlocks($bb->expand(0.01, 0.01, 0.01))) > 0){
|
||||||
$isColliding = true;
|
$this->onGround = true;
|
||||||
}else{
|
}else{
|
||||||
$isColliding = false;
|
$this->onGround = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->onGround = ($movY <= 0 and $isColliding);
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->onGround = ($movY != $dy and $movY < 0);
|
$this->onGround = ($movY != $dy and $movY < 0);
|
||||||
|
@ -1105,7 +1105,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!($player instanceof Player) or $player->isSurvival() === 0){
|
if(!($player instanceof Player) or $player->isSurvival()){
|
||||||
foreach($drops as $drop){
|
foreach($drops as $drop){
|
||||||
if($drop[2] > 0){
|
if($drop[2] > 0){
|
||||||
$this->dropItem($vector->add(0.5, 0.5, 0.5), Item::get(...$drop));
|
$this->dropItem($vector->add(0.5, 0.5, 0.5), Item::get(...$drop));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user