mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 12:48:32 +00:00
consistency check regen script now emits which states were added/removed
This commit is contained in:
parent
9afcd72fb6
commit
d7e73705c2
@ -26,11 +26,24 @@ require dirname(__DIR__, 3) . '/vendor/autoload.php';
|
|||||||
/* This script needs to be re-run after any intentional blockfactory change (adding or removing a block state). */
|
/* This script needs to be re-run after any intentional blockfactory change (adding or removing a block state). */
|
||||||
|
|
||||||
\pocketmine\block\BlockFactory::init();
|
\pocketmine\block\BlockFactory::init();
|
||||||
|
|
||||||
|
$old = json_decode(file_get_contents(__DIR__ . '/block_factory_consistency_check.json'), true);
|
||||||
|
$new = array_map(
|
||||||
|
function(\pocketmine\block\Block $block) : string{
|
||||||
|
return $block->getName();
|
||||||
|
},
|
||||||
|
\pocketmine\block\BlockFactory::getAllKnownStates()
|
||||||
|
);
|
||||||
|
foreach($old as $k => $name){
|
||||||
|
if(!isset($new[$k])){
|
||||||
|
echo "Removed state for $name (" . ($k >> 4) . ":" . ($k & 0xf) . ")\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach($new as $k => $name){
|
||||||
|
if(!isset($old[$k])){
|
||||||
|
echo "Added state for $name (" . ($k >> 4) . ":" . ($k & 0xf) . ")\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
file_put_contents(__DIR__ . '/block_factory_consistency_check.json', json_encode(
|
file_put_contents(__DIR__ . '/block_factory_consistency_check.json', json_encode(
|
||||||
array_map(
|
$new
|
||||||
function(\pocketmine\block\Block $block) : string{
|
|
||||||
return $block->getName();
|
|
||||||
},
|
|
||||||
\pocketmine\block\BlockFactory::getAllKnownStates()
|
|
||||||
)
|
|
||||||
));
|
));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user