1.5 -> 1.6 migration: store RS version in patterns. #1816

This commit is contained in:
raoulvdberge
2018-06-14 22:19:26 +02:00
parent 8a93ff122c
commit fff915ac49
2 changed files with 11 additions and 0 deletions

View File

@@ -502,6 +502,7 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware {
ItemStack pattern = new ItemStack(RSItems.PATTERN);
ItemPattern.setVersion(pattern);
ItemPattern.setOredict(pattern, oredictPattern);
ItemPattern.setProcessing(pattern, processingPattern);

View File

@@ -1,5 +1,6 @@
package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.RSItems;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
@@ -30,6 +31,7 @@ import java.util.stream.Collectors;
public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
private static Map<ItemStack, CraftingPattern> PATTERN_CACHE = new HashMap<>();
private static final String NBT_VERSION = "Version";
public static final String NBT_INPUT_SLOT = "Input_%d";
public static final String NBT_OUTPUT_SLOT = "Output_%d";
private static final String NBT_OREDICT = "Oredict";
@@ -152,6 +154,14 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
pattern.getTagCompound().setBoolean(NBT_OREDICT, oredict);
}
public static void setVersion(ItemStack pattern) {
if (!pattern.hasTagCompound()) {
pattern.setTagCompound(new NBTTagCompound());
}
pattern.getTagCompound().setString(NBT_VERSION, RS.VERSION);
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote && player.isSneaking()) {