// Path: internal/CommonInternals.java
// public class CommonInternals {
// 	
// 	public static HashMap<String,ResourceLocation> jsonLocs = new  HashMap<>();
// 	public static ArrayList<ThaumcraftApi.EntityTags> scanEntities = new ArrayList<>();	
// 	public static HashMap<ResourceLocation,IThaumcraftRecipe> craftingRecipeCatalog = new HashMap<>();
// 	public static HashMap<ResourceLocation,Object> craftingRecipeCatalogFake = new HashMap<>();
// 	public static ArrayList<SmeltBonus> smeltingBonus = new ArrayList<SmeltBonus>();
// 	public static ConcurrentHashMap<Integer,AspectList> objectTags = new ConcurrentHashMap<>();
// 	public static HashMap<Object,Integer> warpMap = new HashMap<Object,Integer>();
// 	public static HashMap<String,ItemStack> seedList = new HashMap<String,ItemStack>();
// 	
// 	public static IThaumcraftRecipe getCatalogRecipe(ResourceLocation key) {	
// 		return craftingRecipeCatalog.get(key);
// 	}
// 	
// 	public static Object getCatalogRecipeFake(ResourceLocation key) {	
// 		return craftingRecipeCatalogFake.get(key);
// 	}
// 	
// 	/**
// 	 * Obviously the int generated is not truly unique, but it is unique enough for this purpose.
// 	 * @param stack
// 	 * @return
// 	 */
// 	public static int generateUniqueItemstackId(ItemStack stack) {
//     	ItemStack sc = stack.copy();
//     	sc.setCount(1);
//     	String ss = sc.serializeNBT().toString();
//     	return ss.hashCode();
//     }
// 	
// 	/**
// 	 * Obviously the int generated is not truly unique, but it is unique enough for this purpose.
// 	 * Strips all nbt data from itemstack
// 	 * @param stack
// 	 * @return
// 	 */
// 	public static int generateUniqueItemstackIdStripped(ItemStack stack) {
//     	ItemStack sc = stack.copy();
//     	sc.setCount(1);
//     	sc.setTagCompound(null);
//     	String ss = sc.serializeNBT().toString();
//     	return ss.hashCode();
//     }
// }


import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.internal.CommonInternals;
package thaumcraft.api.research;



public class ScanOreDictionary implements IScanThing {
	
	String research;	
	String[] entries;	
	
	public ConcurrentHashMap<Integer,Boolean> cache = new ConcurrentHashMap<>();

	public ScanOreDictionary(String research, String ... entries) {
		this.research = research;
		this.entries = entries;
	}
	
	@Override
	public boolean checkThing(EntityPlayer player, Object obj) {	
		ItemStack stack = null;
		if (obj!=null) {
			if (obj instanceof BlockPos) {
				IBlockState state = player.world.getBlockState((BlockPos) obj);
				stack = state.getBlock().getItem(player.world, (BlockPos) obj, state);			
			}
			else
			if (obj instanceof ItemStack) 
				stack = (ItemStack) obj;
			else
			if (obj instanceof EntityItem && ((EntityItem)obj).getItem()!=null) 
				stack = ((EntityItem)obj).getItem();
		}
		
		if (stack!=null && !stack.isEmpty()) {			
// Path: internal/CommonInternals.java
// public class CommonInternals {
// 	
// 	public static HashMap<String,ResourceLocation> jsonLocs = new  HashMap<>();
// 	public static ArrayList<ThaumcraftApi.EntityTags> scanEntities = new ArrayList<>();	
// 	public static HashMap<ResourceLocation,IThaumcraftRecipe> craftingRecipeCatalog = new HashMap<>();
// 	public static HashMap<ResourceLocation,Object> craftingRecipeCatalogFake = new HashMap<>();
// 	public static ArrayList<SmeltBonus> smeltingBonus = new ArrayList<SmeltBonus>();
// 	public static ConcurrentHashMap<Integer,AspectList> objectTags = new ConcurrentHashMap<>();
// 	public static HashMap<Object,Integer> warpMap = new HashMap<Object,Integer>();
// 	public static HashMap<String,ItemStack> seedList = new HashMap<String,ItemStack>();
// 	
// 	public static IThaumcraftRecipe getCatalogRecipe(ResourceLocation key) {	
// 		return craftingRecipeCatalog.get(key);
// 	}
// 	
// 	public static Object getCatalogRecipeFake(ResourceLocation key) {	
// 		return craftingRecipeCatalogFake.get(key);
// 	}
// 	
// 	/**
// 	 * Obviously the int generated is not truly unique, but it is unique enough for this purpose.
// 	 * @param stack
// 	 * @return
// 	 */
// 	public static int generateUniqueItemstackId(ItemStack stack) {
//     	ItemStack sc = stack.copy();
//     	sc.setCount(1);
//     	String ss = sc.serializeNBT().toString();
//     	return ss.hashCode();
//     }
// 	
// 	/**
// 	 * Obviously the int generated is not truly unique, but it is unique enough for this purpose.
// 	 * Strips all nbt data from itemstack
// 	 * @param stack
// 	 * @return
// 	 */
// 	public static int generateUniqueItemstackIdStripped(ItemStack stack) {
//     	ItemStack sc = stack.copy();
//     	sc.setCount(1);
//     	sc.setTagCompound(null);
//     	String ss = sc.serializeNBT().toString();
//     	return ss.hashCode();
//     }
// }


// Path: research/ScanOreDictionary.java
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.internal.CommonInternals;

package thaumcraft.api.research;



public class ScanOreDictionary implements IScanThing {
	
	String research;	
	String[] entries;	
	
	public ConcurrentHashMap<Integer,Boolean> cache = new ConcurrentHashMap<>();

	public ScanOreDictionary(String research, String ... entries) {
		this.research = research;
		this.entries = entries;
	}
	
	@Override
	public boolean checkThing(EntityPlayer player, Object obj) {	
		ItemStack stack = null;
		if (obj!=null) {
			if (obj instanceof BlockPos) {
				IBlockState state = player.world.getBlockState((BlockPos) obj);
				stack = state.getBlock().getItem(player.world, (BlockPos) obj, state);			
			}
			else
			if (obj instanceof ItemStack) 
				stack = (ItemStack) obj;
			else
			if (obj instanceof EntityItem && ((EntityItem)obj).getItem()!=null) 
				stack = ((EntityItem)obj).getItem();
		}
		
		if (stack!=null && !stack.isEmpty()) {			
			int hid = CommonInternals.generateUniqueItemstackId(stack);