From 728e0bc869f93c4d5df1f022db5ff89e8cb9e36d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 28 Apr 2023 20:58:18 +0100 Subject: [PATCH] tools/generate-blockstate-upgrade-schema: allow multi-ID remaps to be processed as regular states if their ID didn't change this allows remappedStates to only deal with stuff that has a different ID, which reduced the size of the 1.12 -> 1.13 schema quite nicely. --- tools/generate-blockstate-upgrade-schema.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/generate-blockstate-upgrade-schema.php b/tools/generate-blockstate-upgrade-schema.php index 8bb271ddf..847486a66 100644 --- a/tools/generate-blockstate-upgrade-schema.php +++ b/tools/generate-blockstate-upgrade-schema.php @@ -358,6 +358,15 @@ function generateBlockStateUpgradeSchema(array $upgradeTable) : BlockStateUpgrad processState($mapping->old, $mapping->new, $result, $removedPropertiesCache, $remappedPropertyValuesCache); } }else{ + if(isset($newNameFound[$oldName])){ + //some of the states stayed under the same ID - we can process these as normal states + foreach($blockStateMappings as $k => $mapping){ + if($mapping->new->getName() === $oldName){ + processState($mapping->old, $mapping->new, $result, $removedPropertiesCache, $remappedPropertyValuesCache); + unset($blockStateMappings[$k]); + } + } + } //block mapped to multiple different new IDs; we can't guess these, so we just do a plain old remap foreach($blockStateMappings as $mapping){ if(!$mapping->old->equals($mapping->new)){