mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 00:55:14 +00:00
Clean up terminology around block state IDs and their handling
This commit is contained in:
@ -33,11 +33,11 @@ use const SORT_STRING;
|
||||
|
||||
class BlockTest extends TestCase{
|
||||
|
||||
/** @var BlockFactory */
|
||||
/** @var RuntimeBlockStateRegistry */
|
||||
private $blockFactory;
|
||||
|
||||
public function setUp() : void{
|
||||
$this->blockFactory = new BlockFactory();
|
||||
$this->blockFactory = new RuntimeBlockStateRegistry();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,17 +22,17 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\block\RuntimeBlockStateRegistry;
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
|
||||
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). */
|
||||
|
||||
$factory = new \pocketmine\block\BlockFactory();
|
||||
$factory = new \pocketmine\block\RuntimeBlockStateRegistry();
|
||||
$remaps = [];
|
||||
$new = [];
|
||||
foreach(BlockFactory::getInstance()->getAllKnownStates() as $index => $block){
|
||||
foreach(RuntimeBlockStateRegistry::getInstance()->getAllKnownStates() as $index => $block){
|
||||
if($index !== $block->getStateId()){
|
||||
throw new AssumptionFailedError("State index should always match state ID");
|
||||
}
|
||||
|
Reference in New Issue
Block a user