minecart entity tweaks

This commit is contained in:
GameHerobrine 2023-10-28 16:20:13 +03:00
parent 39bfa7115d
commit b362f262f4
7 changed files with 23 additions and 19 deletions

View file

@ -2,7 +2,11 @@
class MCDiagonalProvider implements INeighborProvider
{
private static $neighbors = array([ 0, 0, -1 ], [ 1, 0, 0 ], [ 0, 0, 1 ], [ -1, 0, 0 ]);
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]
);
private static $jumpOffset = [0, 1, 0];
private static $moveDownOffset = [0, -1, 0];
public function getNeighbors(PathTile $tile)
@ -12,12 +16,12 @@ class MCDiagonalProvider implements INeighborProvider
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, false))){
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, false))){
if(!StaticBlock::getIsSolid($tile->level->level->getBlockID($pnt->x, $pnt->y + 1, $pnt->z))){
++$pnt->y;
$pnts[] = $pnt;
}