LegacyStringToItemParser: special-case air, which the item deserializer doesn't recognize

This commit is contained in:
Dylan K. Taylor 2022-07-20 20:20:14 +01:00
parent 67682cbf27
commit 47adcf763d
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -118,7 +118,13 @@ final class LegacyStringToItemParser{
throw new LegacyStringToItemParserException("Unable to parse \"" . $b[1] . "\" from \"" . $input . "\" as a valid meta value");
}
$legacyId = $this->map[strtolower($b[0])] ?? null;
$lower = strtolower($b[0]);
if($lower === "0" || $lower === "air"){
//item deserializer doesn't recognize air items since they aren't supposed to exist
return VanillaItems::AIR();
}
$legacyId = $this->map[$lower] ?? null;
if($legacyId === null){
throw new LegacyStringToItemParserException("Unable to resolve \"" . $input . "\" to a valid item");
}