tweaks to pathfinder and pathfollower(basically nothing)

This commit is contained in:
GameHerobrine 2024-04-14 03:41:24 +03:00
parent da28b3b0ff
commit cb0fa06e12
5 changed files with 94 additions and 25 deletions

View file

@ -3,9 +3,10 @@
class MCDiagonalProvider implements INeighborProvider
{
private static $neighbors = array(
[ -1, 0, -1 ], [-1, 0, 0], [-1, 0, 1],
[0, 0, -1], [0, 0, 1],
[1, 0, -1], [1, 0, 0], [1, 0, -1]
[-1, 0, 0],
[0, 0, -1],
[1, 0, 0],
[0, 0, 1],
);
private static $jumpOffset = [0, 1, 0];
private static $moveDownOffset = [0, -1, 0];
@ -15,17 +16,26 @@ class MCDiagonalProvider implements INeighborProvider
$pnts = [];
foreach(MCDiagonalProvider::$neighbors as $offset){
$pnt = $tile->addOffset($offset);
if(!StaticBlock::getIsSolid($tile->level->level->getBlockID($pnt->x, $pnt->y, $pnt->z))){
if(!StaticBlock::getIsSolid($tile->level->level->getBlockID($pnt->x, $pnt->y - 1, $pnt->z))){
--$pnt->y;
}
$pnts[] = $pnt;
}else{
if(!StaticBlock::getIsSolid($tile->level->level->getBlockID($pnt->x, $pnt->y + 1, $pnt->z))){
++$pnt->y;
$pnts[] = $pnt;
}
}
//if(!StaticBlock::getIsSolid($tile->level->level->getBlockID($pnt->x, $pnt->y, $pnt->z))){
//
//}
//if(!StaticBlock::getIsSolid($tile->level->level->getBlockID($pnt->x, $pnt->y, $pnt->z))){
// if(!StaticBlock::getIsSolid($tile->level->level->getBlockID($pnt->x, $pnt->y - 1, $pnt->z))){
// --$pnt->y;
// }
// $pnts[] = $pnt;
//}else{
// if(!StaticBlock::getIsSolid($tile->level->level->getBlockID($pnt->x, $pnt->y + 1, $pnt->z))){
// ++$pnt->y;
// $pnts[] = $pnt;
// }
//}
}
return $pnts;
}