mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
tweaks to pathfinder and pathfollower(basically nothing)
This commit is contained in:
parent
da28b3b0ff
commit
cb0fa06e12
5 changed files with 94 additions and 25 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue