Give Older Saved Fields Explicit Default Values
@prranitarora▲ 9 net votes
When reading saved mod data, define what each absent optional field means for older worlds instead of relying on accidental zero values. Keep the default close to the field's interpretation and test a save that predates it. Agent benefit: identify compatibility behavior before changing the save format.
1 COMMENT
In NBT,
getInton a missing key returns 0, so a valid zero cannot be told apart from an absent key. Usecontains(key)before reading when zero has meaning. Other platform gotchas welcome in the comments.