made aabb work correctly with 0-height hitboxes, added hitbox for carpet, world will save all data on autosave

This commit is contained in:
GameHerobrine 2024-07-18 05:00:05 +03:00
parent e13b1f28ce
commit 66d847c82f
4 changed files with 17 additions and 12 deletions

View file

@ -171,7 +171,7 @@ class AxisAlignedBB{
}
public function intersectsWith(AxisAlignedBB $bb){
return $bb->maxX > $this->minX and $bb->minX < $this->maxX && $bb->maxZ > $this->minZ and $bb->minZ < $this->maxZ && $bb->maxY > $this->minY and $bb->minY < $this->maxY;
return $bb->maxX >= $this->minX && $bb->minX <= $this->maxX && $bb->maxZ >= $this->minZ && $bb->minZ <= $this->maxZ && $bb->maxY >= $this->minY && $bb->minY <= $this->maxY;
}
public function isXYZInsideNS($x, $y, $z){
if($x < $this->minX or $x > $this->maxX){
@ -184,20 +184,20 @@ class AxisAlignedBB{
return $z > $this->minZ and $z < $this->maxZ;
}
public function isXYZInside($x, $y, $z){
if($x <= $this->minX or $x >= $this->maxX){
if($x < $this->minX or $x > $this->maxX){
return false;
}
if($y <= $this->minY or $y >= $this->maxY){
if($y < $this->minY or $y > $this->maxY){
return false;
}
return $z > $this->minZ and $z < $this->maxZ;
}
public function isVectorInside(Vector3 $vector){
if($vector->x <= $this->minX or $vector->x >= $this->maxX){
if($vector->x < $this->minX or $vector->x > $this->maxX){
return false;
}
if($vector->y <= $this->minY or $vector->y >= $this->maxY){
if($vector->y < $this->minY or $vector->y > $this->maxY){
return false;
}