mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
BlockFactory: remove some useless static arrays
This commit is contained in:
parent
a80d5bb6a8
commit
48a5eeb3a4
@ -35,12 +35,6 @@ class BlockFactory{
|
|||||||
|
|
||||||
/** @var \SplFixedArray<bool> */
|
/** @var \SplFixedArray<bool> */
|
||||||
public static $solid = null;
|
public static $solid = null;
|
||||||
/** @var \SplFixedArray<bool> */
|
|
||||||
public static $transparent = null;
|
|
||||||
/** @var \SplFixedArray<float> */
|
|
||||||
public static $hardness = null;
|
|
||||||
/** @var \SplFixedArray<int> */
|
|
||||||
public static $light = null;
|
|
||||||
/** @var \SplFixedArray<int> */
|
/** @var \SplFixedArray<int> */
|
||||||
public static $lightFilter = null;
|
public static $lightFilter = null;
|
||||||
/** @var \SplFixedArray<bool> */
|
/** @var \SplFixedArray<bool> */
|
||||||
@ -64,11 +58,8 @@ class BlockFactory{
|
|||||||
public static function init() : void{
|
public static function init() : void{
|
||||||
self::$fullList = new \SplFixedArray(4096);
|
self::$fullList = new \SplFixedArray(4096);
|
||||||
|
|
||||||
self::$light = new \SplFixedArray(256);
|
|
||||||
self::$lightFilter = new \SplFixedArray(256);
|
self::$lightFilter = new \SplFixedArray(256);
|
||||||
self::$solid = new \SplFixedArray(256);
|
self::$solid = new \SplFixedArray(256);
|
||||||
self::$hardness = new \SplFixedArray(256);
|
|
||||||
self::$transparent = new \SplFixedArray(256);
|
|
||||||
self::$diffusesSkyLight = new \SplFixedArray(256);
|
self::$diffusesSkyLight = new \SplFixedArray(256);
|
||||||
self::$blastResistance = new \SplFixedArray(256);
|
self::$blastResistance = new \SplFixedArray(256);
|
||||||
|
|
||||||
@ -357,9 +348,6 @@ class BlockFactory{
|
|||||||
}
|
}
|
||||||
|
|
||||||
self::$solid[$id] = $block->isSolid();
|
self::$solid[$id] = $block->isSolid();
|
||||||
self::$transparent[$id] = $block->isTransparent();
|
|
||||||
self::$hardness[$id] = $block->getHardness();
|
|
||||||
self::$light[$id] = $block->getLightLevel();
|
|
||||||
self::$lightFilter[$id] = min(15, $block->getLightFilter() + 1); //opacity plus 1 standard light filter
|
self::$lightFilter[$id] = min(15, $block->getLightFilter() + 1); //opacity plus 1 standard light filter
|
||||||
self::$diffusesSkyLight[$id] = $block->diffusesSkyLight();
|
self::$diffusesSkyLight[$id] = $block->diffusesSkyLight();
|
||||||
self::$blastResistance[$id] = $block->getBlastResistance();
|
self::$blastResistance[$id] = $block->getBlastResistance();
|
||||||
|
@ -1463,8 +1463,8 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
public function updateBlockLight(int $x, int $y, int $z){
|
public function updateBlockLight(int $x, int $y, int $z){
|
||||||
$this->timings->doBlockLightUpdates->startTiming();
|
$this->timings->doBlockLightUpdates->startTiming();
|
||||||
|
|
||||||
$id = $this->getBlockIdAt($x, $y, $z);
|
$block = $this->getBlockAt($x, $y, $z);
|
||||||
$newLevel = max(BlockFactory::$light[$id], $this->getHighestAdjacentBlockLight($x, $y, $z) - BlockFactory::$lightFilter[$id]);
|
$newLevel = max($block->getLightLevel(), $this->getHighestAdjacentBlockLight($x, $y, $z) - $block->getLightFilter());
|
||||||
|
|
||||||
if($this->blockLightUpdate === null){
|
if($this->blockLightUpdate === null){
|
||||||
$this->blockLightUpdate = new BlockLightUpdate($this);
|
$this->blockLightUpdate = new BlockLightUpdate($this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user