1.5 -> 1.6 migration: store RS version in patterns. #1816
This commit is contained in:
@@ -502,6 +502,7 @@ public class NetworkNodeGrid extends NetworkNode implements IGridNetworkAware {
|
|||||||
|
|
||||||
ItemStack pattern = new ItemStack(RSItems.PATTERN);
|
ItemStack pattern = new ItemStack(RSItems.PATTERN);
|
||||||
|
|
||||||
|
ItemPattern.setVersion(pattern);
|
||||||
ItemPattern.setOredict(pattern, oredictPattern);
|
ItemPattern.setOredict(pattern, oredictPattern);
|
||||||
ItemPattern.setProcessing(pattern, processingPattern);
|
ItemPattern.setProcessing(pattern, processingPattern);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.item;
|
package com.raoulvdberge.refinedstorage.item;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.RSItems;
|
import com.raoulvdberge.refinedstorage.RSItems;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||||
@@ -30,6 +31,7 @@ import java.util.stream.Collectors;
|
|||||||
public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
||||||
private static Map<ItemStack, CraftingPattern> PATTERN_CACHE = new HashMap<>();
|
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_INPUT_SLOT = "Input_%d";
|
||||||
public static final String NBT_OUTPUT_SLOT = "Output_%d";
|
public static final String NBT_OUTPUT_SLOT = "Output_%d";
|
||||||
private static final String NBT_OREDICT = "Oredict";
|
private static final String NBT_OREDICT = "Oredict";
|
||||||
@@ -152,6 +154,14 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
pattern.getTagCompound().setBoolean(NBT_OREDICT, oredict);
|
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
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
if (!world.isRemote && player.isSneaking()) {
|
if (!world.isRemote && player.isSneaking()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user