Added code to fix broken Minecraft level.dat files with Inventory list type of byte.

This commit is contained in:
preble 2010-10-14 22:25:18 -04:00
parent 3ecdcfd20e
commit de26cd1000
2 changed files with 13 additions and 0 deletions

View File

@ -56,6 +56,15 @@
{
NSMutableArray *newChildren = [NSMutableArray array];
NBTContainer *inventoryList = [self inventoryList];
if (inventoryList.listType != NBTTypeCompound)
{
// There appears to be a bug in the way Minecraft writes empty inventory lists; it appears to
// set the list type to 'byte', so we will correct it here.
NSLog(@"%s Fixing inventory list type; was %d.", __PRETTY_FUNCTION__, inventoryList.listType);
inventoryList.listType = NBTTypeCompound;
}
for (IJInventoryItem *invItem in newInventory)
{
NSArray *listItems = [NSArray arrayWithObjects:

View File

@ -270,6 +270,10 @@
{
[self appendDouble:[item doubleValue] toData:data];
}
else if (listType == NBTTypeByte)
{
[self appendByte:[item unsignedCharValue] toData:data];
}
else
{
NSLog(@"Unhandled list type: %d", listType);