remove World->isFullBlock(), add Block->isFullCube(), clean up some BB mess

This commit is contained in:
Dylan K. Taylor
2019-08-15 16:22:54 +01:00
parent e29ac514d7
commit 73b2669712
4 changed files with 16 additions and 20 deletions

View File

@ -46,6 +46,7 @@ use pocketmine\world\Position;
use pocketmine\world\World;
use function array_merge;
use function assert;
use function count;
use function dechex;
use const PHP_INT_MAX;
@ -713,6 +714,15 @@ class Block{
return AxisAlignedBB::one();
}
/**
* @return bool
*/
public function isFullCube() : bool{
$bb = $this->getCollisionBoxes();
return count($bb) === 1 and $bb[0]->getAverageEdgeLength() >= 1; //TODO: average length 1 != cube
}
/**
* @param Vector3 $pos1
* @param Vector3 $pos2

View File

@ -35,8 +35,7 @@ class Thin extends Transparent{
foreach(Facing::HORIZONTAL as $facing){
$side = $this->getSide($facing);
//FIXME: currently there's no proper way to tell if a block is a full-block, so we check the bounding box size
if($side instanceof Thin or ($bb = $side->getBoundingBox()) !== null and $bb->getAverageEdgeLength() >= 1){
if($side instanceof Thin or $side->isFullCube()){
$this->connections[$facing] = true;
}else{
unset($this->connections[$facing]);