fixed cactus collisions

This commit is contained in:
GameHerobrine 2024-06-07 05:56:09 +03:00
parent aeffaee590
commit 529f2d37dc
2 changed files with 2 additions and 1 deletions

View file

@ -11,7 +11,7 @@ class CactusBlock extends TransparentBlock{
$entity->harm(1, "cactus");
}
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){
return [new AxisAlignedBB($x + 0.0625, $y, $z + 0.0625, $x - 0.0625, $y - 0.0625, $z - 0.0625)];
return [new AxisAlignedBB($x + 0.0625, $y, $z + 0.0625, $x + 1 - 0.0625, $y + 1 - 0.0625, $z + 1 - 0.0625)];
}
public static function onRandomTick(Level $level, $x, $y, $z){

View file

@ -257,6 +257,7 @@ class Level{
$bid = $this->level->getBlockID($x, $y, $z);
if($bid > 0){
$blockBounds = Block::$class[$bid]::getCollisionBoundingBoxes($this, $x, $y, $z, $e); //StaticBlock::getBoundingBoxForBlockCoords($b, $x, $y, $z);
foreach($blockBounds as $blockBound){
if($aABB->intersectsWith($blockBound)) $aABBs[] = $blockBound;
}