mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Level: fixed randomTickBlocks, also delete some useless code
the randomTickBlocks thing is populated with state IDs anyway, not variants...
This commit is contained in:
parent
369a1e1472
commit
899081e1b9
@ -51,9 +51,6 @@ class BlockFactory{
|
||||
/** @var \SplFixedArray<float> */
|
||||
public static $blastResistance = null;
|
||||
|
||||
/** @var \SplFixedArray|int[] */
|
||||
private static $stateMasks = null;
|
||||
|
||||
/** @var int[] */
|
||||
public static $staticRuntimeIdMap = [];
|
||||
|
||||
@ -74,8 +71,6 @@ class BlockFactory{
|
||||
self::$diffusesSkyLight = \SplFixedArray::fromArray(array_fill(0, 8192, false));
|
||||
self::$blastResistance = \SplFixedArray::fromArray(array_fill(0, 8192, 0));
|
||||
|
||||
self::$stateMasks = new \SplFixedArray(8192);
|
||||
|
||||
self::register(new ActivatorRail(new BID(Block::ACTIVATOR_RAIL, BaseRail::STRAIGHT_NORTH_SOUTH), "Activator Rail"));
|
||||
self::register(new Air(new BID(Block::AIR), "Air"));
|
||||
self::register(new Anvil(new BID(Block::ANVIL, Anvil::TYPE_NORMAL), "Anvil"));
|
||||
@ -575,7 +570,6 @@ class BlockFactory{
|
||||
|
||||
private static function fillStaticArrays(int $index, Block $block) : void{
|
||||
self::$fullList[$index] = $block;
|
||||
self::$stateMasks[$index] = $block->getStateBitmask();
|
||||
self::$lightFilter[$index] = min(15, $block->getLightFilter() + 1); //opacity plus 1 standard light filter
|
||||
self::$diffusesSkyLight[$index] = $block->diffusesSkyLight();
|
||||
self::$blastResistance[$index] = $block->getBlastResistance();
|
||||
@ -621,10 +615,6 @@ class BlockFactory{
|
||||
return self::get($fullState >> 4, $fullState & 0xf, $pos);
|
||||
}
|
||||
|
||||
public static function getStateMask(int $id) : int{
|
||||
return self::$stateMasks[$id] ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a specified block state is already registered in the block factory.
|
||||
*
|
||||
|
@ -1085,7 +1085,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
$state = $subChunk->getFullBlock($x, $y, $z);
|
||||
|
||||
if($this->randomTickBlocks[$state & ~BlockFactory::getStateMask($state >> 4)]){
|
||||
if($this->randomTickBlocks[$state]){
|
||||
/** @var Block $block */
|
||||
$block = BlockFactory::fromFullBlock($state, $this->temporalPosition->setComponents(
|
||||
$chunkX * 16 + $x,
|
||||
|
Loading…
x
Reference in New Issue
Block a user