mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
armor rewrite
This commit is contained in:
parent
45b36cb034
commit
bae0d4618e
34 changed files with 143 additions and 67 deletions
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
class TileNavigator implements ITileNavigator
|
||||
{
|
||||
private $blockedProvider, $neighborProvider, $distanceAlgorithm;
|
||||
private $blockedProvider, $neighborProvider, $distanceAlgorithm;
|
||||
|
||||
public static $pathfinderAccessed = 0;
|
||||
public static $pathfinderAccessed = 0;
|
||||
|
||||
public function __construct(IBlockedProvider $blockedProvider, INeighborProvider $neighborProvider, IDistanceAlgorithm $distanceAlgorithm){
|
||||
$this->blockedProvider = $blockedProvider;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Pythagoras3D implements IDistanceAlgorithm
|
|||
public function calculate(PathTile $from, PathTile $to)
|
||||
{
|
||||
if($from instanceof PathTileXYZ && $to instanceof PathTileXYZ){
|
||||
return Utils::distance_noroot($from->asArray(), $to->asArray());
|
||||
return Utils::distance_noroot($from->asArray(), $to->asArray());
|
||||
}
|
||||
return INF;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ class MCDiagonalProvider implements INeighborProvider
|
|||
foreach(MCDiagonalProvider::$neighbors as $offset){
|
||||
$pnt = $tile->addOffset($offset);
|
||||
if(!$tile->level->getBlockWithoutVector($pnt->x, $pnt->y, $pnt->z, false)->isSolid){
|
||||
if(!$tile->level->getBlockWithoutVector($pnt->x, $pnt->y - 1, $pnt->z, false)->isSolid){
|
||||
if(!$tile->level->getBlockWithoutVector($pnt->x, $pnt->y - 1, $pnt->z, false)->isSolid){
|
||||
--$pnt->y;
|
||||
}
|
||||
$pnts[] = $pnt;
|
||||
}else{
|
||||
if(!$tile->level->getBlockWithoutVector($pnt->x, $pnt->y + 1, $pnt->z, false)->isSolid){
|
||||
if(!$tile->level->getBlockWithoutVector($pnt->x, $pnt->y + 1, $pnt->z, false)->isSolid){
|
||||
++$pnt->y;
|
||||
$pnts[] = $pnt;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue