mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +00:00
Merge commit '5c8a625d88e511a6ebad765714b75f1a86dfd37f'
This commit is contained in:
commit
1388a2287a
@ -109,6 +109,10 @@ abstract class BaseRail extends Flowable{
|
|||||||
$this->tryReconnect();
|
$this->tryReconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int[] $connections
|
||||||
|
* @param int[][] $lookup
|
||||||
|
*/
|
||||||
protected static function searchState(array $connections, array $lookup) : int{
|
protected static function searchState(array $connections, array $lookup) : int{
|
||||||
$meta = array_search($connections, $lookup, true);
|
$meta = array_search($connections, $lookup, true);
|
||||||
if($meta === false){
|
if($meta === false){
|
||||||
@ -124,6 +128,8 @@ abstract class BaseRail extends Flowable{
|
|||||||
/**
|
/**
|
||||||
* Returns a meta value for the rail with the given connections.
|
* Returns a meta value for the rail with the given connections.
|
||||||
*
|
*
|
||||||
|
* @param int[] $connections
|
||||||
|
*
|
||||||
* @throws \InvalidArgumentException if no state matches the given connections
|
* @throws \InvalidArgumentException if no state matches the given connections
|
||||||
*/
|
*/
|
||||||
protected function getMetaForState(array $connections) : int{
|
protected function getMetaForState(array $connections) : int{
|
||||||
@ -170,6 +176,11 @@ abstract class BaseRail extends Flowable{
|
|||||||
return $connections;
|
return $connections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int[] $constraints
|
||||||
|
*
|
||||||
|
* @return true[]
|
||||||
|
*/
|
||||||
private function getPossibleConnectionDirections(array $constraints) : array{
|
private function getPossibleConnectionDirections(array $constraints) : array{
|
||||||
switch(count($constraints)){
|
switch(count($constraints)){
|
||||||
case 0:
|
case 0:
|
||||||
@ -194,6 +205,9 @@ abstract class BaseRail extends Flowable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true[]
|
||||||
|
*/
|
||||||
protected function getPossibleConnectionDirectionsOneConstraint(int $constraint) : array{
|
protected function getPossibleConnectionDirectionsOneConstraint(int $constraint) : array{
|
||||||
$opposite = Facing::opposite($constraint & ~self::FLAG_ASCEND);
|
$opposite = Facing::opposite($constraint & ~self::FLAG_ASCEND);
|
||||||
|
|
||||||
@ -255,6 +269,9 @@ abstract class BaseRail extends Flowable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int[] $connections
|
||||||
|
*/
|
||||||
private function setConnections(array $connections) : void{
|
private function setConnections(array $connections) : void{
|
||||||
if(count($connections) === 1){
|
if(count($connections) === 1){
|
||||||
$connections[] = Facing::opposite($connections[0] & ~self::FLAG_ASCEND);
|
$connections[] = Facing::opposite($connections[0] & ~self::FLAG_ASCEND);
|
||||||
|
@ -67,6 +67,9 @@ class Leaves extends Transparent{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param true[] $visited reference parameter
|
||||||
|
*/
|
||||||
protected function findLog(Vector3 $pos, array &$visited = [], int $distance = 0) : bool{
|
protected function findLog(Vector3 $pos, array &$visited = [], int $distance = 0) : bool{
|
||||||
$index = World::blockHash($pos->x, $pos->y, $pos->z);
|
$index = World::blockHash($pos->x, $pos->y, $pos->z);
|
||||||
if(isset($visited[$index])){
|
if(isset($visited[$index])){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user