Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
Updated RakLib, changed some Entity move AABB calls
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Dec 11, 2014
1 parent 94f9196 commit 312e064
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions src/pocketmine/entity/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ public function move($dx, $dy, $dz){

if($this->keepMovement){
$this->boundingBox->offset($dx, $dy, $dz);
$this->setPosition(new Vector3(($this->boundingBox->minX + $this->boundingBox->maxX) / 2, $this->boundingBox->minY - $this->ySize, ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2));
$this->setPosition(new Vector3(($this->boundingBox->minX + $this->boundingBox->maxX) / 2, $this->boundingBox->minY, ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2));
$this->onGround = $this instanceof Player ? true : false;
}else{

Expand Down Expand Up @@ -877,7 +877,7 @@ public function move($dx, $dy, $dz){
//TODO: big messy loop
}*/

$list = $this->level->getCollisionCubes($this, $this->boundingBox->getOffsetBoundingBox($dx, $dy, $dz));
$list = $this->level->getCollisionCubes($this, $this->boundingBox->addCoord($dx, $dy, $dz));


foreach($list as $bb){
Expand Down Expand Up @@ -931,7 +931,7 @@ public function move($dx, $dy, $dz){

$this->boundingBox->setBB($axisalignedbb);

$list = $this->level->getCollisionCubes($this, $this->boundingBox->getOffsetBoundingBox($movX, $dy, $movZ), false);
$list = $this->level->getCollisionCubes($this, $this->boundingBox->addCoord($movX, $dy, $movZ), false);

foreach($list as $bb){
$dy = $bb->calculateYOffset($this->boundingBox, $dy);
Expand Down Expand Up @@ -983,13 +983,19 @@ public function move($dx, $dy, $dz){
$dy = $cy;
$dz = $cz;
$this->boundingBox->setBB($axisalignedbb1);
}else{
$diff = $this->boundingBox->minY - (int) $this->boundingBox->minY;

if($diff > 0){
$this->ySize += $diff + 0.01;
}
}

}

$pos = new Vector3(
($this->boundingBox->minX + $this->boundingBox->maxX) / 2,
$this->boundingBox->minY - $this->ySize,
$this->boundingBox->minY + $this->ySize,
($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2
);

Expand Down Expand Up @@ -1106,7 +1112,7 @@ public function setPosition(Vector3 $pos){
$this->z = $pos->z;

$radius = $this->width / 2;
$this->boundingBox->setBounds($pos->x - $radius, $pos->y + $this->ySize, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height + $this->ySize, $pos->z + $radius);
$this->boundingBox->setBounds($pos->x - $radius, $pos->y, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height, $pos->z + $radius);


if($this->chunk === null or ($this->chunkX !== ($this->x >> 4) and $this->chunkZ !== ($this->z >> 4))){
Expand Down
2 changes: 1 addition & 1 deletion src/raklib
Submodule raklib updated 1 files
+10 −6 server/Session.php

0 comments on commit 312e064

Please sign in to comment.