Merge 'minor-next' into 'major-next'

Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/13360931724
This commit is contained in:
pmmp-admin-bot[bot] 2025-02-17 01:26:25 +00:00
commit c58c64de85

View File

@ -1534,29 +1534,44 @@ class World implements ChunkManager{
$collisionInfo = $this->blockStateRegistry->collisionInfo; $collisionInfo = $this->blockStateRegistry->collisionInfo;
if($targetFirst){ if($targetFirst){
for($z = $minZ; $z <= $maxZ; ++$z){ for($z = $minZ; $z <= $maxZ; ++$z){
$zOverflow = $z === $minZ || $z === $maxZ;
for($x = $minX; $x <= $maxX; ++$x){ for($x = $minX; $x <= $maxX; ++$x){
$zxOverflow = $zOverflow || $x === $minX || $x === $maxX;
for($y = $minY; $y <= $maxY; ++$y){ for($y = $minY; $y <= $maxY; ++$y){
$overflow = $zxOverflow || $y === $minY || $y === $maxY;
$stateCollisionInfo = $this->getBlockCollisionInfo($x, $y, $z, $collisionInfo); $stateCollisionInfo = $this->getBlockCollisionInfo($x, $y, $z, $collisionInfo);
if(match($stateCollisionInfo){ if($overflow ?
RuntimeBlockStateRegistry::COLLISION_CUBE => true, $stateCollisionInfo === RuntimeBlockStateRegistry::COLLISION_MAY_OVERFLOW && $this->getBlockAt($x, $y, $z)->collidesWithBB($bb) :
RuntimeBlockStateRegistry::COLLISION_NONE => false, match ($stateCollisionInfo) {
default => $this->getBlockAt($x, $y, $z)->collidesWithBB($bb) RuntimeBlockStateRegistry::COLLISION_CUBE => true,
}){ RuntimeBlockStateRegistry::COLLISION_NONE => false,
default => $this->getBlockAt($x, $y, $z)->collidesWithBB($bb)
}
){
return [$this->getBlockAt($x, $y, $z)]; return [$this->getBlockAt($x, $y, $z)];
} }
} }
} }
} }
}else{ }else{
//TODO: duplicated code :( this way is better for performance though
for($z = $minZ; $z <= $maxZ; ++$z){ for($z = $minZ; $z <= $maxZ; ++$z){
$zOverflow = $z === $minZ || $z === $maxZ;
for($x = $minX; $x <= $maxX; ++$x){ for($x = $minX; $x <= $maxX; ++$x){
$zxOverflow = $zOverflow || $x === $minX || $x === $maxX;
for($y = $minY; $y <= $maxY; ++$y){ for($y = $minY; $y <= $maxY; ++$y){
$overflow = $zxOverflow || $y === $minY || $y === $maxY;
$stateCollisionInfo = $this->getBlockCollisionInfo($x, $y, $z, $collisionInfo); $stateCollisionInfo = $this->getBlockCollisionInfo($x, $y, $z, $collisionInfo);
if(match($stateCollisionInfo){ if($overflow ?
RuntimeBlockStateRegistry::COLLISION_CUBE => true, $stateCollisionInfo === RuntimeBlockStateRegistry::COLLISION_MAY_OVERFLOW && $this->getBlockAt($x, $y, $z)->collidesWithBB($bb) :
RuntimeBlockStateRegistry::COLLISION_NONE => false, match ($stateCollisionInfo) {
default => $this->getBlockAt($x, $y, $z)->collidesWithBB($bb) RuntimeBlockStateRegistry::COLLISION_CUBE => true,
}){ RuntimeBlockStateRegistry::COLLISION_NONE => false,
default => $this->getBlockAt($x, $y, $z)->collidesWithBB($bb)
}
){
$collides[] = $this->getBlockAt($x, $y, $z); $collides[] = $this->getBlockAt($x, $y, $z);
} }
} }