mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Use new features in pocketmine/math 1.0.0
This commit is contained in:
@ -1906,14 +1906,7 @@ class World implements ChunkManager{
|
||||
unset($this->blockCollisionBoxCache[$chunkHash][$relativeBlockHash]);
|
||||
//blocks like fences have collision boxes that reach into neighbouring blocks, so we need to invalidate the
|
||||
//caches for those blocks as well
|
||||
foreach([
|
||||
[0, 0, 1],
|
||||
[0, 0, -1],
|
||||
[0, 1, 0],
|
||||
[0, -1, 0],
|
||||
[1, 0, 0],
|
||||
[-1, 0, 0]
|
||||
] as [$offsetX, $offsetY, $offsetZ]){
|
||||
foreach(Facing::OFFSET as [$offsetX, $offsetY, $offsetZ]){
|
||||
$sideChunkPosHash = World::chunkHash(($x + $offsetX) >> Chunk::COORD_BIT_SIZE, ($z + $offsetZ) >> Chunk::COORD_BIT_SIZE);
|
||||
$sideChunkBlockHash = World::chunkBlockHash($x + $offsetX, $y + $offsetY, $z + $offsetZ);
|
||||
unset($this->blockCollisionBoxCache[$sideChunkPosHash][$sideChunkBlockHash]);
|
||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\light;
|
||||
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\world\format\LightArray;
|
||||
use pocketmine\world\format\SubChunk;
|
||||
use pocketmine\world\utils\SubChunkExplorer;
|
||||
@ -33,15 +34,6 @@ use function max;
|
||||
|
||||
//TODO: make light updates asynchronous
|
||||
abstract class LightUpdate{
|
||||
private const ADJACENTS = [
|
||||
[ 1, 0, 0],
|
||||
[-1, 0, 0],
|
||||
[ 0, 1, 0],
|
||||
[ 0, -1, 0],
|
||||
[ 0, 0, 1],
|
||||
[ 0, 0, -1]
|
||||
];
|
||||
|
||||
public const BASE_LIGHT_FILTER = 1;
|
||||
|
||||
/**
|
||||
@ -78,7 +70,7 @@ abstract class LightUpdate{
|
||||
|
||||
protected function getHighestAdjacentLight(int $x, int $y, int $z) : int{
|
||||
$adjacent = 0;
|
||||
foreach(self::ADJACENTS as [$ox, $oy, $oz]){
|
||||
foreach(Facing::OFFSET as [$ox, $oy, $oz]){
|
||||
if(($adjacent = max($adjacent, $this->getEffectiveLight($x + $ox, $y + $oy, $z + $oz))) === 15){
|
||||
break;
|
||||
}
|
||||
@ -123,7 +115,7 @@ abstract class LightUpdate{
|
||||
$touched++;
|
||||
[$x, $y, $z, $oldAdjacentLight] = $context->removalQueue->dequeue();
|
||||
|
||||
foreach(self::ADJACENTS as [$ox, $oy, $oz]){
|
||||
foreach(Facing::OFFSET as [$ox, $oy, $oz]){
|
||||
$cx = $x + $ox;
|
||||
$cy = $y + $oy;
|
||||
$cz = $z + $oz;
|
||||
@ -163,7 +155,7 @@ abstract class LightUpdate{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach(self::ADJACENTS as [$ox, $oy, $oz]){
|
||||
foreach(Facing::OFFSET as [$ox, $oy, $oz]){
|
||||
$cx = $x + $ox;
|
||||
$cy = $y + $oy;
|
||||
$cz = $z + $oz;
|
||||
|
Reference in New Issue
Block a user