Updated RakLib, changed some Entity move AABB calls

This commit is contained in:
Shoghi Cervantes 2014-12-11 17:39:59 +01:00
parent 94f91967f3
commit 312e064b07
2 changed files with 12 additions and 6 deletions

View File

@ -825,7 +825,7 @@ abstract class Entity extends Location implements Metadatable{
if($this->keepMovement){ if($this->keepMovement){
$this->boundingBox->offset($dx, $dy, $dz); $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; $this->onGround = $this instanceof Player ? true : false;
}else{ }else{
@ -877,7 +877,7 @@ abstract class Entity extends Location implements Metadatable{
//TODO: big messy loop //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){ foreach($list as $bb){
@ -931,7 +931,7 @@ abstract class Entity extends Location implements Metadatable{
$this->boundingBox->setBB($axisalignedbb); $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){ foreach($list as $bb){
$dy = $bb->calculateYOffset($this->boundingBox, $dy); $dy = $bb->calculateYOffset($this->boundingBox, $dy);
@ -983,13 +983,19 @@ abstract class Entity extends Location implements Metadatable{
$dy = $cy; $dy = $cy;
$dz = $cz; $dz = $cz;
$this->boundingBox->setBB($axisalignedbb1); $this->boundingBox->setBB($axisalignedbb1);
}else{
$diff = $this->boundingBox->minY - (int) $this->boundingBox->minY;
if($diff > 0){
$this->ySize += $diff + 0.01;
}
} }
} }
$pos = new Vector3( $pos = new Vector3(
($this->boundingBox->minX + $this->boundingBox->maxX) / 2, ($this->boundingBox->minX + $this->boundingBox->maxX) / 2,
$this->boundingBox->minY - $this->ySize, $this->boundingBox->minY + $this->ySize,
($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2 ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2
); );
@ -1106,7 +1112,7 @@ abstract class Entity extends Location implements Metadatable{
$this->z = $pos->z; $this->z = $pos->z;
$radius = $this->width / 2; $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))){ if($this->chunk === null or ($this->chunkX !== ($this->x >> 4) and $this->chunkZ !== ($this->z >> 4))){

@ -1 +1 @@
Subproject commit 3364683957ff7acb4ab053931e23197865818fc4 Subproject commit 6f08cd6d8001ae29e89297ebfdf828a00da0965f