mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Merge 'minor-next' into 'major-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/13360931724
This commit is contained in:
commit
c58c64de85
@ -1534,29 +1534,44 @@ class World implements ChunkManager{
|
||||
$collisionInfo = $this->blockStateRegistry->collisionInfo;
|
||||
if($targetFirst){
|
||||
for($z = $minZ; $z <= $maxZ; ++$z){
|
||||
$zOverflow = $z === $minZ || $z === $maxZ;
|
||||
for($x = $minX; $x <= $maxX; ++$x){
|
||||
$zxOverflow = $zOverflow || $x === $minX || $x === $maxX;
|
||||
for($y = $minY; $y <= $maxY; ++$y){
|
||||
$overflow = $zxOverflow || $y === $minY || $y === $maxY;
|
||||
|
||||
$stateCollisionInfo = $this->getBlockCollisionInfo($x, $y, $z, $collisionInfo);
|
||||
if(match($stateCollisionInfo){
|
||||
RuntimeBlockStateRegistry::COLLISION_CUBE => true,
|
||||
RuntimeBlockStateRegistry::COLLISION_NONE => false,
|
||||
default => $this->getBlockAt($x, $y, $z)->collidesWithBB($bb)
|
||||
}){
|
||||
if($overflow ?
|
||||
$stateCollisionInfo === RuntimeBlockStateRegistry::COLLISION_MAY_OVERFLOW && $this->getBlockAt($x, $y, $z)->collidesWithBB($bb) :
|
||||
match ($stateCollisionInfo) {
|
||||
RuntimeBlockStateRegistry::COLLISION_CUBE => true,
|
||||
RuntimeBlockStateRegistry::COLLISION_NONE => false,
|
||||
default => $this->getBlockAt($x, $y, $z)->collidesWithBB($bb)
|
||||
}
|
||||
){
|
||||
return [$this->getBlockAt($x, $y, $z)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//TODO: duplicated code :( this way is better for performance though
|
||||
for($z = $minZ; $z <= $maxZ; ++$z){
|
||||
$zOverflow = $z === $minZ || $z === $maxZ;
|
||||
for($x = $minX; $x <= $maxX; ++$x){
|
||||
$zxOverflow = $zOverflow || $x === $minX || $x === $maxX;
|
||||
for($y = $minY; $y <= $maxY; ++$y){
|
||||
$overflow = $zxOverflow || $y === $minY || $y === $maxY;
|
||||
|
||||
$stateCollisionInfo = $this->getBlockCollisionInfo($x, $y, $z, $collisionInfo);
|
||||
if(match($stateCollisionInfo){
|
||||
RuntimeBlockStateRegistry::COLLISION_CUBE => true,
|
||||
RuntimeBlockStateRegistry::COLLISION_NONE => false,
|
||||
default => $this->getBlockAt($x, $y, $z)->collidesWithBB($bb)
|
||||
}){
|
||||
if($overflow ?
|
||||
$stateCollisionInfo === RuntimeBlockStateRegistry::COLLISION_MAY_OVERFLOW && $this->getBlockAt($x, $y, $z)->collidesWithBB($bb) :
|
||||
match ($stateCollisionInfo) {
|
||||
RuntimeBlockStateRegistry::COLLISION_CUBE => true,
|
||||
RuntimeBlockStateRegistry::COLLISION_NONE => false,
|
||||
default => $this->getBlockAt($x, $y, $z)->collidesWithBB($bb)
|
||||
}
|
||||
){
|
||||
$collides[] = $this->getBlockAt($x, $y, $z);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user