Skip to content

Commit

Permalink
BlockStateUpgrader: fixed undefined array key when flattening a block…
Browse files Browse the repository at this point in the history
… whose new ID is the same as the old

this came up during 1.20.50 testing, where minecraft:stone[stone_type=stone] continues to have an ID minecraft:stone without the stone_type property.
This could have appeared in other ways, such as with an invalid legacy blockstate.
  • Loading branch information
dktapps committed Nov 8, 2023
1 parent 8ccaf90 commit 5f3a2a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/data/bedrock/block/upgrade/BlockStateUpgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function upgrade(BlockStateData $blockStateData) : BlockStateData{
if(is_string($remap->newName)){
$newName = $remap->newName;
}else{
$flattenedValue = $oldState[$remap->newName->flattenedProperty];
$flattenedValue = $oldState[$remap->newName->flattenedProperty] ?? null;
if($flattenedValue instanceof StringTag){
$newName = sprintf("%s%s%s", $remap->newName->prefix, $flattenedValue->getValue(), $remap->newName->suffix);
unset($oldState[$remap->newName->flattenedProperty]);
Expand Down

0 comments on commit 5f3a2a5

Please sign in to comment.