Fixed EntityMoveEvent not being cancelled correctly on players

This commit is contained in:
Shoghi Cervantes 2014-09-10 20:06:30 +02:00
parent 60011a5ecf
commit fba12c6ddf
3 changed files with 8 additions and 2 deletions

View File

@ -1368,7 +1368,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->setRotation($packet->yaw, $packet->pitch);
//$this->inBlock = $this->checkObstruction($this->x, ($this->boundingBox->minY + $this->boundingBox->maxY) / 2, $this->z);
$this->move($dx, $dy, $dz);
$revert = !$this->move($dx, $dy, $dz);
$diffX = $this->x - $newPos->x;
$diffZ = $this->z - $newPos->z;

View File

@ -715,7 +715,7 @@ abstract class Entity extends Position implements Metadatable{
//$collision = [];
//$this->checkBlockCollision($collision);
if($dx == 0 and $dz == 0 and $dy == 0){
return;
return true;
}
//if($this->inBlock){ //TODO: noclip
@ -887,8 +887,11 @@ abstract class Entity extends Position implements Metadatable{
($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2
);
$result = true;
if(!$this->setPosition($pos)){
$this->boundingBox->setBB($axisalignedbb);
$result = false;
}else{
if($this instanceof Player){
@ -922,6 +925,8 @@ abstract class Entity extends Position implements Metadatable{
//TODO: vehicle collision events (first we need to spawn them!)
Timings::$entityMoveTimer->stopTiming();
return $result;
//}
}

View File

@ -913,6 +913,7 @@ class Level implements ChunkManager, Metadatable{
}
$this->changedBlocks[$index][$Y][] = clone $block;
}
if($update === true){
$this->updateAround($pos, self::BLOCK_UPDATE_NORMAL);
$block->onUpdate(self::BLOCK_UPDATE_NORMAL);