mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
project uses tabs instead of spaces(as in CONTRIBUTING.md)
This commit is contained in:
parent
f00318b6ed
commit
62571f26cd
115 changed files with 2291 additions and 2364 deletions
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
class DiagonalNeighborProvider implements INeighborProvider
|
||||
{
|
||||
private static $neighbors = array([ 0, -1 ], [ 1, 0 ], [ 0, 1 ], [ -1, 0 ], [ -1, -1 ], [ 1, -1 ], [ 1, 1 ], [ -1, 1 ]);
|
||||
|
||||
public function getNeighbors(PathTile $tile)
|
||||
{
|
||||
$result = [];
|
||||
foreach(self::$neighbors as $offset){
|
||||
$t = clone $tile;
|
||||
$result[] = $t->addOffset($offset);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
private static $neighbors = array([ 0, -1 ], [ 1, 0 ], [ 0, 1 ], [ -1, 0 ], [ -1, -1 ], [ 1, -1 ], [ 1, 1 ], [ -1, 1 ]);
|
||||
|
||||
public function getNeighbors(PathTile $tile)
|
||||
{
|
||||
$result = [];
|
||||
foreach(self::$neighbors as $offset){
|
||||
$t = clone $tile;
|
||||
$result[] = $t->addOffset($offset);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
class EmptyBlockedProvider implements IBlockedProvider
|
||||
{
|
||||
public function isBlocked(PathTile $tile)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public function isBlocked(PathTile $tile)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
interface IBlockedProvider
|
||||
{
|
||||
/**
|
||||
* @param Tile $tile
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBlocked(PathTile $tile);
|
||||
/**
|
||||
* @param Tile $tile
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBlocked(PathTile $tile);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
interface INeighborProvider
|
||||
{
|
||||
public function getNeighbors(PathTile $tile);
|
||||
public function getNeighbors(PathTile $tile);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
class MCBlockedProvider implements IBlockedProvider
|
||||
{
|
||||
public function isBlocked(PathTile $tile)
|
||||
public function isBlocked(PathTile $tile)
|
||||
{
|
||||
if($tile instanceof PathTileXYZ){
|
||||
$b = $tile->level->getBlockWithoutVector($tile->x, $tile->y, $tile->z);
|
||||
return $b instanceof Block && $b->isSolid;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if($tile instanceof PathTileXYZ){
|
||||
$b = $tile->level->getBlockWithoutVector($tile->x, $tile->y, $tile->z);
|
||||
return $b instanceof Block && $b->isSolid;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@
|
|||
|
||||
class MCDiagonalProvider implements INeighborProvider
|
||||
{
|
||||
private static $neighbors = array([ 0, 0, -1 ], [ 1, 0, 0 ], [ 0, 0, 1 ], [ -1, 0, 0 ], [ -1, 0, -1 ], [ 1, 0, -1 ], [ 1, 0, 1 ], [ -1, 0, 1 ]);
|
||||
public function getNeighbors(PathTile $tile)
|
||||
private static $neighbors = array([ 0, 0, -1 ], [ 1, 0, 0 ], [ 0, 0, 1 ], [ -1, 0, 0 ], [ -1, 0, -1 ], [ 1, 0, -1 ], [ 1, 0, 1 ], [ -1, 0, 1 ]);
|
||||
public function getNeighbors(PathTile $tile)
|
||||
{
|
||||
|
||||
if($tile instanceof PathTileXYZ){
|
||||
$result = [];
|
||||
foreach(self::$neighbors as $offset){
|
||||
$t = clone $tile;
|
||||
$result[] = $t->addOffset($offset);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
if($tile instanceof PathTileXYZ){
|
||||
$result = [];
|
||||
foreach(self::$neighbors as $offset){
|
||||
$t = clone $tile;
|
||||
$result[] = $t->addOffset($offset);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue