mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Get rid of Block->canPassThrough()
This is only implemented in 1 place where the collision box should just be zero anyway, so there's no point this existing. There's a lot of other blocks which should have bounding boxes without collision boxes as well, but that's outside the scope of this commit.
This commit is contained in:
parent
3eca64e893
commit
c501c740a1
@ -413,10 +413,6 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canPassThrough() : bool{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether entities can climb up this block.
|
* Returns whether entities can climb up this block.
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -78,10 +78,6 @@ class Vine extends Flowable{
|
|||||||
return 0.2;
|
return 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canPassThrough() : bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasEntityCollision() : bool{
|
public function hasEntityCollision() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -150,6 +146,10 @@ class Vine extends Flowable{
|
|||||||
return new AxisAlignedBB($minX, $minY, $minZ, $maxX, 1, $maxZ);
|
return new AxisAlignedBB($minX, $minY, $minZ, $maxX, 1, $maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function recalculateCollisionBoxes() : array{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||||
if(!$blockClicked->isSolid() or Facing::axis($face) === Facing::AXIS_Y){
|
if(!$blockClicked->isSolid() or Facing::axis($face) === Facing::AXIS_Y){
|
||||||
return false;
|
return false;
|
||||||
|
@ -1131,7 +1131,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
for($x = $minX; $x <= $maxX; ++$x){
|
for($x = $minX; $x <= $maxX; ++$x){
|
||||||
for($y = $minY; $y <= $maxY; ++$y){
|
for($y = $minY; $y <= $maxY; ++$y){
|
||||||
$block = $this->getBlockAt($x, $y, $z);
|
$block = $this->getBlockAt($x, $y, $z);
|
||||||
if(!$block->canPassThrough() and $block->collidesWithBB($bb)){
|
if($block->collidesWithBB($bb)){
|
||||||
return [$block];
|
return [$block];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1142,7 +1142,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
for($x = $minX; $x <= $maxX; ++$x){
|
for($x = $minX; $x <= $maxX; ++$x){
|
||||||
for($y = $minY; $y <= $maxY; ++$y){
|
for($y = $minY; $y <= $maxY; ++$y){
|
||||||
$block = $this->getBlockAt($x, $y, $z);
|
$block = $this->getBlockAt($x, $y, $z);
|
||||||
if(!$block->canPassThrough() and $block->collidesWithBB($bb)){
|
if($block->collidesWithBB($bb)){
|
||||||
$collides[] = $block;
|
$collides[] = $block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1193,11 +1193,9 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
for($x = $minX; $x <= $maxX; ++$x){
|
for($x = $minX; $x <= $maxX; ++$x){
|
||||||
for($y = $minY; $y <= $maxY; ++$y){
|
for($y = $minY; $y <= $maxY; ++$y){
|
||||||
$block = $this->getBlockAt($x, $y, $z);
|
$block = $this->getBlockAt($x, $y, $z);
|
||||||
if(!$block->canPassThrough()){
|
foreach($block->getCollisionBoxes() as $blockBB){
|
||||||
foreach($block->getCollisionBoxes() as $blockBB){
|
if($blockBB->intersectsWith($bb)){
|
||||||
if($blockBB->intersectsWith($bb)){
|
$collides[] = $blockBB;
|
||||||
$collides[] = $blockBB;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user