While working on #4690, I noticed that ItemEntity fails to load from the disk.
Expected result: What were you expecting to happen? ItemEntity should be loaded without any error
Actual result: What actually happened?
[21:10:32.455] [Server thread/ERROR]: [World: My World] [Loading chunk 28 -3] Bad entity data at list position 0: Item is invalid
[21:10:32.456] [Server thread/CRITICAL]: pocketmine\data\SavedDataLoadingException: "Item is invalid" (EXCEPTION) in "pmsrc/src/entity/EntityFactory" at line 125
Issue description
While working on #4690, I noticed that ItemEntity fails to load from the disk.
Steps to reproduce the issue
OS and versions
PocketMine-MP: f67104c81e160bf8050b464f801a5a019f4d343d
PHP: 8.0.19
Using JIT: No
Server OS: Windows
Game version:
Plugins
N/A
If you remove all plugins, does the issue still occur?
If the issue is not reproducible without plugins:
Crashdump, backtrace or other files
World: world.zip
When I dumped item NBT, it seemed the vanilla client used StringTag(
Name
) instead of IntTag(id
).Here is the item NBT that I dumped:
A possible solution seems to be to find StringTag(
Name
) inItem::nbtDeserialize()
and parse it from LegacyStringToItemParser.https://github.com/pmmp/PocketMine-MP/blob/2ec65ba799c0d0f2ed593cd598ae7f9b32572faa/src/item/Item.php#L680