Java Code Examples for net.minecraftforge.oredict.OreDictionary#getOreID()

The following examples show how to use net.minecraftforge.oredict.OreDictionary#getOreID() . 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: 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 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: Carving.java    From Chisel with GNU General Public License v2.0 6 votes vote down vote up
public CarvingGroup getGroup(Block block, int metadata)
{
    if(block.equals(Blocks.stone))
        block = Blocks.stonebrick;

    // Check name first
    CarvingGroup res;
    int i = OreDictionary.getOreID(block.getUnlocalizedName());
    if(i < 1)
        return null;

    //if((res = carvingGroupsByOre.get(OreDictionary.getOreIDs(new ItemStack(block, 1, metadata)))) != null)
    //    return res;

    if((res = carvingGroupsByVariation.get(key(block, metadata))) != null)
        return res;

    return null;
}
 
Example 7
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 8
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 9
Source File: RecipeBuilder.java    From EmergingTechnology with MIT License 6 votes vote down vote up
public static IMachineRecipe getMatchingRecipe(ItemStack itemStack, List<IMachineRecipe> recipes) {

        if (itemStack == null || itemStack.isEmpty())
            return null;

        int[] oreIds = OreDictionary.getOreIDs(itemStack);

        for (IMachineRecipe recipe : recipes) {

            if (!recipe.hasOreDictInput()) {
                if (recipe.getInput().isItemEqual(itemStack)) {
                    return recipe;
                }
            } else {

                int oreId = OreDictionary.getOreID(recipe.getInputOreName());

                for (int id : oreIds) {
                    if (id == oreId) {
                        return recipe;
                    }
                }
            }
        }
        return null;
    }
 
Example 10
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 11
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 12
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 13
Source File: TileEntityScanner.java    From Cyberware with MIT License 6 votes vote down vote up
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
	switch (slot)
	{
		case 0:
			return CyberwareAPI.canDeconstruct(stack);
		case 1:
			int[] ids = OreDictionary.getOreIDs(stack);
			int paperId = OreDictionary.getOreID("paper");
			for (int id : ids)
			{
				if (id == paperId)
				{
					return true;
				}
			}
			return false;
		case 2:
			return false;
	}
	return true;
}
 
Example 14
Source File: TileEntityEngineeringTable.java    From Cyberware with MIT License 6 votes vote down vote up
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
	switch (slot)
	{
		case 0:
			return CyberwareAPI.canDeconstruct(stack);
		case 1:
			int[] ids = OreDictionary.getOreIDs(stack);
			int paperId = OreDictionary.getOreID("paper");
			for (int id : ids)
			{
				if (id == paperId)
				{
					return true;
				}
			}
			return false;
		case 8:
			return stack != null && stack.getItem() instanceof IBlueprint;
		case 9:
			return false;
		default:
			return overrideExtract || !CyberwareAPI.canDeconstruct(stack);
	}
}
 
Example 15
Source File: OreDictionaryIntegration.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void onNovaRemoved(DictionaryEvent.Remove<Item> event) {
	int id = OreDictionary.getOreID(event.key);
	ItemStack nativeStack = ItemConverter.instance().toNative(event.value);
	Optional<ItemStack> toRemove = OreDictionary.getOres(event.key).stream().filter(stack -> stack.isItemEqual(nativeStack)).findFirst();

	if (toRemove.isPresent()) {
		OREDICT_CONTENTS.get(id).remove(toRemove.get());
	}
}
 
Example 16
Source File: TileEntityEtherealMacerator.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
public boolean isOP() {
    final int cobblestoneId = OreDictionary.getOreID("blockCobble");

    if (OreDictionary.getOreID(this.slots[0]) == cobblestoneId || this.slots[0].getItem() == Item.getItemFromBlock(Blocks.sand) || this.slots[0].getItem() == Items.potato || this.slots[0].getItem() == Items.porkchop || this.slots[0].getItem() == Items.beef || this.slots[0].getItem() == Items.chicken || this.slots[0].getItem() == Items.fish || this.slots[0].getItem() == IC2Items.getItem("coalDust").getItem() || (OreDictionary.getOreName(OreDictionary.getOreID(this.slots[0])).toLowerCase().contains("dust") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("armour") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("armor") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("helm") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("legging") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("boot") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("chestp") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("pick") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("shovel") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("axe") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("pick"))) {
        return true;
    } else {
        return false;
    }
}
 
Example 17
Source File: OreDictionaryIntegration.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void onNovaRemoved(DictionaryEvent.Remove<Item> event) {
	int id = OreDictionary.getOreID(event.key);
	ItemStack nativeStack = ItemConverter.instance().toNative(event.value);
	Optional<ItemStack> toRemove = OreDictionary.getOres(event.key).stream().filter(stack -> stack.isItemEqual(nativeStack)).findFirst();

	if (toRemove.isPresent()) {
		OREDICT_CONTENTS.get(id).remove(toRemove.get());
	}
}
 
Example 18
Source File: OreDictionaryIntegration.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void onNovaRemoved(DictionaryEvent.Remove<Item> event) {
	int id = OreDictionary.getOreID(event.key);
	ItemStack nativeStack = ItemConverter.instance().toNative(event.value);
	Optional<ItemStack> toRemove = OreDictionary.getOres(event.key).stream().filter(stack -> stack.isItemEqual(nativeStack)).findFirst();

	if (toRemove.isPresent()) {
		OREDICT_CONTENTS.get(id).remove(toRemove.get());
	}
}
 
Example 19
Source File: ItemBackpack.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
	if (repair.isEmpty()) return false;

	// Returns is the specified repair item is
	// registered in the ore dictionary as leather.
	int leatherOreID = OreDictionary.getOreID("leather");
	return ArrayUtils.contains(OreDictionary.getOreIDs(repair), leatherOreID);
}
 
Example 20
Source File: SlotItemSpecific.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
SlotItemSpecific(IInventory par2IInventory, String oreDictKeyAllowed, int par3, int par4, int par5){
    super(par2IInventory, par3, par4, par5);
    oreDictEntry = OreDictionary.getOreID(oreDictKeyAllowed);
    dye = oreDictKeyAllowed.equals("dye");
}