Added code to fix broken Minecraft level.dat files with Inventory list type of byte.
This commit is contained in:
parent
3ecdcfd20e
commit
de26cd1000
@ -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:
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user