Future MC

Future MC

14M Downloads

[1.12.2] Upgrading causes barrels to lose their content

ephys opened this issue · 2 comments

commented

Hello!

I'm trying to update from 0.1.13 to 0.2.3.2

As doing that directly causes world corruption (#147), and because 0.2.3.2 has a problem where barrel contents aren't saved properly, I'm instead doing the following:

  • go from 0.1.13 to 0.2.01 (the alpha version). Barrels contents are OK here
  • go from 0.2.01 to 2.4.0pre. Barrels contents are now reset

I believe the problem is that during update 0.2.03, the NBT key under which the contents are saved has been renamed from items to item (https://github.com/thedarkcolour/Future-MC/blob/master/src/main/java/thedarkcolour/futuremc/tile/TileBarrel.java#L16)

This could be fixed by replacing the piece of code with this:

String key = compound.hasKey("item") ? "item" : "items";

if (compound.hasKey(key)) {
  storage.deserializeNBT((NBTTagCompound) compound.getTag(key));
}
commented

Good catch, I'll fix it next update

commented

I'm currently stuck on 0.2.02 as well, I'm hoping this fix is going to allow for old inventories to be upgraded properly.

Suggestion: If a barrel has both item and items keys require the user to break and replace dropping both sets of items?