Java Code Examples for thaumcraft.api.ThaumcraftApiHelper#containsMatch()

The following examples show how to use thaumcraft.api.ThaumcraftApiHelper#containsMatch() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InfusionRecipe.java    From GardenCollection with MIT License 6 votes vote down vote up
public static boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;

//nbt
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);		
if (!t1) return false;

if (fuzzy) {
	Integer od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}

//damage
boolean damage = stack0.getItemDamage() == stack1.getItemDamage() ||
		stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE;		

      return stack0.getItem() != stack1.getItem() ? false : (!damage ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 2
Source File: InfusionEnchantmentRecipe.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
protected boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
if (!t1) return false;
if (fuzzy) {
	Integer od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}
      return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 3
Source File: InfusionRecipe.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
public static boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;

//nbt
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);		
if (!t1) return false;

if (fuzzy) {
	Integer od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}

//damage
boolean damage = stack0.getItemDamage() == stack1.getItemDamage() ||
		stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE;		

      return stack0.getItem() != stack1.getItem() ? false : (!damage ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 4
Source File: InfusionEnchantmentRecipe.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
protected boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
if (!t1) return false;
if (fuzzy) {
	int od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}
      return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 5
Source File: InfusionRecipe.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
public static boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;

//nbt
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);		
if (!t1) return false;

if (fuzzy) {
	int od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}

//damage
boolean damage = stack0.getItemDamage() == stack1.getItemDamage() ||
		stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE;		

      return stack0.getItem() != stack1.getItem() ? false : (!damage ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 6
Source File: InfusionEnchantmentRecipe.java    From GardenCollection with MIT License 6 votes vote down vote up
protected boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
if (!t1) return false;
if (fuzzy) {
	Integer od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}
      return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 7
Source File: InfusionEnchantmentRecipe.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
protected boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
if (!t1) return false;
if (fuzzy) {
	Integer od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}
      return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 8
Source File: InfusionRecipe.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
public static boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;

//nbt
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);		
if (!t1) return false;

if (fuzzy) {
	Integer od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}

//damage
boolean damage = stack0.getItemDamage() == stack1.getItemDamage() ||
		stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE;		

      return stack0.getItem() != stack1.getItem() ? false : (!damage ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 9
Source File: InfusionEnchantmentRecipe.java    From AdvancedMod with GNU General Public License v3.0 6 votes vote down vote up
protected boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
if (!t1) return false;
if (fuzzy) {
	int od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}
      return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 10
Source File: InfusionRecipe.java    From AdvancedMod with GNU General Public License v3.0 6 votes vote down vote up
protected boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
  {
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;
boolean t1=ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(stack0, stack1);
if (!t1) return false;
if (fuzzy) {
	int od = OreDictionary.getOreID(stack0);
	if (od!=-1) {
		ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
			return true;
	}
}
      return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : stack0.stackSize <= stack0.getMaxStackSize() );
  }
 
Example 11
Source File: CrucibleRecipe.java    From GardenCollection with MIT License 5 votes vote down vote up
public boolean matches(AspectList itags, ItemStack cat) {
	if (catalyst instanceof ItemStack &&
			!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return false;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
	}
	if (itags==null) return false;
	for (Aspect tag:aspects.getAspects()) {
		if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
	}
	return true;
}
 
Example 12
Source File: CrucibleRecipe.java    From GardenCollection with MIT License 5 votes vote down vote up
public boolean catalystMatches(ItemStack cat) {
	if (catalyst instanceof ItemStack && ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return true;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return true;
	}
	return false;
}
 
Example 13
Source File: CrucibleRecipe.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
public boolean matches(AspectList itags, ItemStack cat) {
	if (catalyst instanceof ItemStack &&
			!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return false;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
	}
	if (itags==null) return false;
	for (Aspect tag:aspects.getAspects()) {
		if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
	}
	return true;
}
 
Example 14
Source File: CrucibleRecipe.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
public boolean catalystMatches(ItemStack cat) {
	if (catalyst instanceof ItemStack && ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return true;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return true;
	}
	return false;
}
 
Example 15
Source File: CrucibleRecipe.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public boolean matches(AspectList itags, ItemStack cat) {
	if (catalyst instanceof ItemStack &&
			!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return false;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
	}
	if (itags==null) return false;
	for (Aspect tag:aspects.getAspects()) {
		if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
	}
	return true;
}
 
Example 16
Source File: CrucibleRecipe.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public boolean catalystMatches(ItemStack cat) {
	if (catalyst instanceof ItemStack && ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return true;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return true;
	}
	return false;
}
 
Example 17
Source File: CrucibleRecipe.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
public boolean matches(AspectList itags, ItemStack cat) {
	if (catalyst instanceof ItemStack &&
			!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return false;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
	}
	if (itags==null) return false;
	for (Aspect tag:aspects.getAspects()) {
		if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
	}
	return true;
}
 
Example 18
Source File: CrucibleRecipe.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public boolean matches(AspectList itags, ItemStack cat) {
	if (catalyst instanceof ItemStack &&
			!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return false;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false;
	}
	if (itags==null) return false;
	for (Aspect tag:aspects.getAspects()) {
		if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
	}
	return true;
}
 
Example 19
Source File: CrucibleRecipe.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public boolean catalystMatches(ItemStack cat) {
	if (catalyst instanceof ItemStack && ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return true;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return true;
	}
	return false;
}
 
Example 20
Source File: CrucibleRecipe.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
public boolean catalystMatches(ItemStack cat) {
	if (catalyst instanceof ItemStack && ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
		return true;
	} else 
	if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		ItemStack[] ores = ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{});
		if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return true;
	}
	return false;
}