mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 07:39:57 +00:00
BlockFactory: added a hacky method to allow block state remapping
we need this for fixing old data in some cases
This commit is contained in:
parent
f30cee15ca
commit
659cad0eff
@ -803,6 +803,13 @@ class BlockFactory{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function remap(int $id, int $meta, Block $block) : void{
|
||||||
|
if(self::isRegistered($id, $meta)){
|
||||||
|
throw new \InvalidArgumentException("$id:$meta is already mapped");
|
||||||
|
}
|
||||||
|
self::fillStaticArrays(($id << 4) | $meta, $block);
|
||||||
|
}
|
||||||
|
|
||||||
private static function fillStaticArrays(int $index, Block $block) : void{
|
private static function fillStaticArrays(int $index, Block $block) : void{
|
||||||
self::$fullList[$index] = $block;
|
self::$fullList[$index] = $block;
|
||||||
self::$lightFilter[$index] = min(15, $block->getLightFilter() + 1); //opacity plus 1 standard light filter
|
self::$lightFilter[$index] = min(15, $block->getLightFilter() + 1); //opacity plus 1 standard light filter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user