net.minecraftforge.oredict.OreDictionary Java Examples

The following examples show how to use net.minecraftforge.oredict.OreDictionary. 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: InventoryUtils.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Get all the slot numbers that have matching items in the given inventory.
 * If <b>damage</b> is OreDictionary.WILDCARD_VALUE, then the item damage is ignored.
 * @param inv
 * @param item
 * @return an ArrayList containing the slot numbers of the slots with matching items
 */
public static List<Integer> getSlotNumbersOfMatchingItems(IItemHandler inv, Item item, int meta)
{
    List<Integer> slots = new ArrayList<Integer>();
    final int invSize = inv.getSlots();

    for (int slot = 0; slot < invSize; ++slot)
    {
        ItemStack stack = inv.getStackInSlot(slot);

        if (stack.isEmpty() == false && stack.getItem() == item &&
            (stack.getMetadata() == meta || meta == OreDictionary.WILDCARD_VALUE))
        {
            slots.add(Integer.valueOf(slot));
        }
    }

    return slots;
}
 
Example #3
Source File: SakuraRecipeRegister.java    From Sakura_mod with MIT License 6 votes vote down vote up
public static void furnaceRegister() {
  	FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.IRON_SAND), new ItemStack(Items.IRON_INGOT), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 1), new ItemStack(ItemLoader.MATERIAL, 1, 38), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 21), new ItemStack(ItemLoader.MATERIAL, 1, 22), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.EGGPLANT, 1), new ItemStack(ItemLoader.FOODSET, 1, 87), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 17), new ItemStack(ItemLoader.FOODSET, 1, 2), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 15), new ItemStack(ItemLoader.MATERIAL, 1, 31), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 7), new ItemStack(ItemLoader.FOODSET, 1, 131), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.FOODSET, 1, 48), new ItemStack(ItemLoader.FOODSET, 1, 49), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.FOODSET, 1, 58), new ItemStack(ItemLoader.FOODSET, 1, 59), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 6), new ItemStack(ItemLoader.FOODSET, 1, 4), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.FOODSET, 1, 112), new ItemStack(ItemLoader.FOODSET, 1, 113), 0.1F);
      FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 31), new ItemStack(ItemLoader.FOODSET, 1, 73), 0.1F);
FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.MAPLE_LOG, 1), new ItemStack(Items.COAL, 1, 1), 0.1F);
FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.SAKURA_LOG, 1), new ItemStack(Items.COAL, 1, 1), 0.1F);
FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.BAMBOO_BLOCK, 1), new ItemStack(BlockLoader.BAMBOO_CHARCOAL_BLOCK), 0.1F);
FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.BAMBOO, 1), new ItemStack(ItemLoader.MATERIAL, 1, 51), 0.1F);
  	if(SakuraConfig.harder_iron_recipe)
FurnaceRecipes.instance().getSmeltingList().forEach((key,value) ->{
  		if(RecipesUtil.containsMatch(false, OreDictionary.getOres("ingotIron"), value))
  			FurnaceRecipes.instance().getSmeltingList().put(key, new ItemStack(ItemLoader.MATERIAL,1,52));
  	});
  }
 
Example #4
Source File: UniqueMetaIdentifier.java    From GardenCollection with MIT License 6 votes vote down vote up
public UniqueMetaIdentifier (String compoundName) {
    String[] parts1 = compoundName.split(";");
    String[] parts2 = parts1[0].split(":");
    this.modId = parts2[0];

    if (parts2.length >= 2)
        this.name = parts2[1];
    else
        this.name = "";

    if (parts1.length >= 2)
        this.meta = Integer.parseInt(parts1[1]);
    else if (parts2.length > 2)
        this.meta = Integer.parseInt(parts2[parts2.length - 1]);
    else
        this.meta = OreDictionary.WILDCARD_VALUE;
}
 
Example #5
Source File: OreDictUtil.java    From AgriCraft with MIT License 6 votes vote down vote up
/**
 * Determines if the given string represents a valid oredict resource entry.
 *
 * @param prefix
 * @param suffix
 * @return {@literal true} if and only if the given string represents a valid oredict entry, {@literal false} otherwise.
 */
public static final boolean isValidOre(@Nonnull String prefix, @Nonnull String suffix) {
    // Validate
    Preconditions.checkNotNull(prefix, "A stack identifier must have a non-null prefix!");
    Preconditions.checkNotNull(suffix, "A stack identifier must have a non-null suffix!");

    // Check that prefix is correct.
    if (!PREFIX_OREDICT.equals(prefix)) {
        return false;
    }

    // Check that the oredictionary contains the given object.
    if (!OreDictionary.doesOreNameExist(suffix)) {
        AgriCore.getLogger("agricraft").error("Unable to resolve Ore Dictionary Entry: \"{0}:{1}\".", prefix, suffix);
        return false;
    } else {
        return true;
    }
}
 
Example #6
Source File: CrucibleRecipe.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
public CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags) {
	recipeOutput = result;
	this.aspects = tags;
	this.key = researchKey;
	this.catalyst = cat;
	if (cat instanceof String) {
		this.catalyst = OreDictionary.getOres((String) cat);
	}
	String hc = researchKey + result.toString();
	for (Aspect tag:tags.getAspects()) {
		hc += tag.getTag()+tags.getAmount(tag);
	}
	if (cat instanceof ItemStack) {
		hc += ((ItemStack)cat).toString();
	} else
	if (cat instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		for (ItemStack is :(ArrayList<ItemStack>)catalyst) {
			hc += is.toString();
		}
	}
	
	hash = hc.hashCode();
}
 
Example #7
Source File: ModItems.java    From GardenCollection with MIT License 6 votes vote down vote up
public void init () {
    chainLink = new ItemChainLink(makeName("chainLink"));
    ironNugget = new Item().setUnlocalizedName(makeName("ironNugget")).setCreativeTab(ModCreativeTabs.tabGardenCore).setTextureName(GardenStuff.MOD_ID + ":iron_nugget");
    wroughtIronIngot = new Item().setUnlocalizedName(makeName("wroughtIronIngot")).setCreativeTab(ModCreativeTabs.tabGardenCore).setTextureName(GardenStuff.MOD_ID + ":wrought_iron_ingot");
    wroughtIronNugget = new Item().setUnlocalizedName(makeName("wroughtIronNugget")).setCreativeTab(ModCreativeTabs.tabGardenCore).setTextureName(GardenStuff.MOD_ID + ":wrought_iron_nugget");
    mossPaste = new ItemMossPaste(makeName("mossPaste"));
    candle = new Item().setUnlocalizedName(makeName("candle")).setCreativeTab(ModCreativeTabs.tabGardenCore).setTextureName(GardenStuff.MOD_ID + ":candle");


    GameRegistry.registerItem(chainLink, "chain_link");
    GameRegistry.registerItem(ironNugget, "iron_nugget");
    GameRegistry.registerItem(wroughtIronIngot, "wrought_iron_ingot");
    GameRegistry.registerItem(wroughtIronNugget, "wrought_iron_nugget");
    GameRegistry.registerItem(mossPaste, "moss_paste");
    GameRegistry.registerItem(candle, "candle");

    OreDictionary.registerOre("nuggetIron", ironNugget);
    OreDictionary.registerOre("ingotWroughtIron", wroughtIronIngot);
    OreDictionary.registerOre("nuggetWroughtIron", wroughtIronNugget);
}
 
Example #8
Source File: CrucibleRecipe.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
public CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags) {
	recipeOutput = result;
	this.aspects = tags;
	this.key = researchKey;
	this.catalyst = cat;
	if (cat instanceof String) {
		this.catalyst = OreDictionary.getOres((String) cat);
	}
	String hc = researchKey + result.toString();
	for (Aspect tag:tags.getAspects()) {
		hc += tag.getTag()+tags.getAmount(tag);
	}
	if (cat instanceof ItemStack) {
		hc += ((ItemStack)cat).toString();
	} else
	if (cat instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
		for (ItemStack is :(ArrayList<ItemStack>)catalyst) {
			hc += is.toString();
		}
	}
	
	hash = hc.hashCode();
}
 
Example #9
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 #10
Source File: ItemHelper.java    From customstuff4 with GNU General Public License v3.0 6 votes vote down vote up
public static boolean stackMatchesRecipeInput(ItemStack stack, RecipeInput input, boolean checkCount)
{
    if (input.isItemStack())
    {
        ItemStack inputStack = input.getStack().getItemStack();
        if (OreDictionary.itemMatches(inputStack, stack, false)
            && (!checkCount || inputStack.getCount() <= stack.getCount()))
            return true;
    } else
    {
        OreClass oreClass = input.getOreClass();
        if (OreDictionary.containsMatch(false, OreDictionary.getOres(oreClass.getOreName()), stack)
            && (!checkCount || oreClass.getAmount() <= stack.getCount()))
            return true;
    }

    return false;
}
 
Example #11
Source File: ShapedRecipe.java    From customstuff4 with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets recipe input without the chars for the shape.
 */
Object[] getRecipeInput()
{
    Object[] result = new Object[getRecipeWidth() * getRecipeHeight()];

    for (int row = 0; row < shape.length; row++)
    {
        for (int col = 0; col < shape[0].length(); col++)
        {
            RecipeInput input = items.get(shape[row].charAt(col));

            int index = col + row * shape[0].length();

            if (input != null)
            {
                result[index] = input.isOreClass() ? OreDictionary.getOres(input.getOreClass().getOreName()) : input.getStack().getItemStack();
            } else
            {
                result[index] = ItemStack.EMPTY;
            }
        }
    }

    return result;
}
 
Example #12
Source File: UniqueMetaRegistry.java    From GardenCollection with MIT License 6 votes vote down vote up
public E getEntry (UniqueMetaIdentifier id) {
    if (id == null)
        return null;

    if (registry.containsKey(id))
        return registry.get(id);

    if (id.meta != OreDictionary.WILDCARD_VALUE) {
        id = new UniqueMetaIdentifier(id.modId, id.name);
        if (registry.containsKey(id))
            return registry.get(id);

        if (!id.name.isEmpty()) {
            id = new UniqueMetaIdentifier(id.modId);
            if (registry.containsKey(id))
                return registry.get(id);
        }
    }

    return null;
}
 
Example #13
Source File: RecipePureDaisy.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
public boolean isOreDict(ItemStack stack, String entry) {
	if(stack == null || stack.getItem() == null)
		return false;

	List<ItemStack> ores;
	if(oreMap.containsKey(entry))
		ores = oreMap.get(entry);
	else {
		ores = OreDictionary.getOres(entry);
		oreMap.put(entry, ores);
	}

	for(ItemStack ostack : ores) {
		ItemStack cstack = ostack.copy();
		if(cstack.getItemDamage() == Short.MAX_VALUE)
			cstack.setItemDamage(stack.getItemDamage());

		if(stack.isItemEqual(cstack))
			return true;
	}

	return false;
}
 
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: ShapedOreRecipeTFC.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
ShapedOreRecipeTFC(ShapedRecipes recipe, Map<ItemStack, String> replacements)
{
	output = recipe.getRecipeOutput();
	width = recipe.recipeWidth;
	height = recipe.recipeHeight;

	input = new ArrayList<Object>(recipe.recipeItems.length);

	for(int i = 0; i < recipe.recipeItems.length; i++)
	{
		ItemStack ingredient = recipe.recipeItems[i];

		if(ingredient == null) continue;

		input.add(recipe.recipeItems[i]);

		for(Entry<ItemStack, String> replace : replacements.entrySet())
		{
			if(OreDictionary.itemMatches(replace.getKey(), ingredient, true))
			{
				input.set(i, OreDictionary.getOres(replace.getValue()));
				break;
			}
		}
	}
}
 
Example #16
Source File: BlockYuba.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@Override
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack)
{
    player.addStat(StatList.getBlockStats(this), 1);
    player.addExhaustion(0.025F);

    if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0)
    {
        this.dropYuba(worldIn, pos, state);
    }
    else
    {
        if (stack != null && OreDictionary.containsMatch(false, OreDictionary.getOres("stickWood"), new ItemStack(Items.STICK)))
        {
            this.dropYuba(worldIn, pos, state);
        }
    }
}
 
Example #17
Source File: BannerPatternHandler.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
public CachedPatternRecipe(EnumBannerPattern pattern, String[] grid, List<Object> inputs) {
	this.pattern = pattern;

	for (int y = 0; y < 3; y++)
		for (int x = 0; x < 3; x++) {
			char c = grid[y].charAt(x);
			if (c != ' ') {
				Object input = inputs.get(inputs.indexOf(c) + 1);
				if (input instanceof String)
					input = OreDictionary.getOres((String) input);
				PositionedStack stack = new PositionedStack(input, 25 + x * 18, 6 + y * 18);
				stack.setMaxSize(1);
				ingredients.add(stack);
			}
		}
}
 
Example #18
Source File: BarrelRecipes.java    From Sakura_mod with MIT License 5 votes vote down vote up
public FluidStack getResultFluidStack(FluidStack fluid, ItemStack[] inputs) {
	for (Entry<FluidStack, Map<Object[], FluidStack>> entry : RecipesList.entrySet()) {
		if(entry.getKey().isFluidEqual(fluid))
	        for(Entry<Object[], FluidStack> entry2 : entry.getValue().entrySet()){
	            boolean flg1 = true;
            	for (Object obj1 : entry2.getKey()) {
	        		boolean flg2 = false;
	        		for (ItemStack input:inputs) {
	                	if(obj1 instanceof ItemStack){
	                		ItemStack stack1 = (ItemStack) obj1;
	    	                if (ItemStack.areItemsEqual(stack1, input)) {
	    	                    flg2 = true;
	    	                    break;
	    	                }
	                    }else if(obj1 instanceof String){
	                    	NonNullList<ItemStack> ore = OreDictionary.getOres((String) obj1);
	                    	if (!ore.isEmpty()&&RecipesUtil.containsMatch(false, ore, input)) {
	                            flg2 = true;
	    	                    break;
	                        }
	                    }
	                }
	                if (!flg2) {
	                    flg1 = false;
	                    break;
	                }
	            }

	            if (flg1) {
	                return entry2.getValue();
	            }
	        }
	}

	return null;
}
 
Example #19
Source File: DyeUtils.java    From WearableBackpacks with MIT License 5 votes vote down vote up
/** Gets the dye color of the item stack by checking the ore dictionary.
 *  Return -1 if the stack is not a dye. */
public static int getDyeColor(ItemStack stack) {
	if (stack.isEmpty()) return -1;
	int[] oreIds = OreDictionary.getOreIDs(stack);
	for (int ore : oreIds) {
		String name = OreDictionary.getOreName(ore);
		Integer color = dyes.get(name);
		if (color != null) return color;
	}
	return -1;
}
 
Example #20
Source File: TreeHandler.java    From BetterChests with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected boolean isAcceptedSapling(ItemStack stack) {
	for (ItemStack other : OreDictionary.getOres("treeSapling")) {
		if (ItemUtil.areItemsSameMatching(stack, other, IItemMatchCriteria.ID, IItemMatchCriteria.WILDCARD)) {
			return true;
		}
	}
	return false;

}
 
Example #21
Source File: ShapelessRecipe.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets recipe input without the chars for the shape.
 */
Object[] getRecipeInput()
{
    return items.stream()
                .map(input -> input.isOreClass() ? OreDictionary.getOres(input.getOreClass().getOreName()) : input.getStack().getItemStack())
                .toArray();
}
 
Example #22
Source File: DistillationRecipes.java    From Sakura_mod with MIT License 5 votes vote down vote up
public FluidStack getResultFluidStack(FluidStack fluid, ItemStack[] inputs) {
	for (Entry<FluidStack, Map<Object[], FluidStack>> entry : RecipesList.entrySet()) {
		if(entry.getKey().isFluidEqual(fluid))
	        for(Entry<Object[], FluidStack> entry2 : entry.getValue().entrySet()){
	            boolean flg1 = true;
            	for (Object obj1 : entry2.getKey()) {
	        		boolean flg2 = false;
	        		for (ItemStack input:inputs) {
	                	if(obj1 instanceof ItemStack){
	                		ItemStack stack1 = (ItemStack) obj1;
	    	                if (ItemStack.areItemsEqual(stack1, input)) {
	    	                    flg2 = true;
	    	                    break;
	    	                }
	                    }else if(obj1 instanceof String){
	                    	NonNullList<ItemStack> ore = OreDictionary.getOres((String) obj1);
	                    	if (!ore.isEmpty()&&RecipesUtil.containsMatch(false, ore, input)) {
	                            flg2 = true;
	    	                    break;
	                        }
	                    }
	                }
	                if (!flg2) {
	                    flg1 = false;
	                    break;
	                }
	            }

	            if (flg1) {
	                return entry2.getValue();
	            }
	        }
	}

	return null;
}
 
Example #23
Source File: ToolTip.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
private boolean isCorrectItem(ItemStack eventStack)
{
    boolean itemEqual = eventStack.getMetadata() == OreDictionary.WILDCARD_VALUE
                        ? stack.isItemEqualIgnoreDurability(eventStack)
                        : stack.isItemEqual(eventStack);

    boolean nbtEqual = !eventStack.hasTagCompound() || ItemStack.areItemStackTagsEqual(eventStack, stack);

    return itemEqual && nbtEqual;
}
 
Example #24
Source File: ShapedArcaneRecipe.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private boolean checkItemEquals(ItemStack target, ItemStack input)
{
    if (input == null && target != null || input != null && target == null)
    {
        return false;
    }
    return (target.getItem() == input.getItem() && 
    		(!target.hasTagCompound() || ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(input,target)) &&
    		(target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage()));
}
 
Example #25
Source File: BaseRecipeRegistry.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
public static void addCarversRecipes() {
    for (int i = 0; i < OreDictionary.getOres("logWood").size(); i++) {
        woodenCarver = GameRegistry.addShapedRecipe(BaseItemStacks.woodenCarver, " X ", "YYY", 'X', Items.flint, 'Y', OreDictionary.getOres("logWood").get(i));
    }
    stoneCarver = GameRegistry.addShapedRecipe(BaseItemStacks.stoneCarver, " X ", "YYY", 'X', Items.flint, 'Y', Blocks.stone);
    ironCarver = GameRegistry.addShapedRecipe(BaseItemStacks.ironCarver, " X ", "YYY", 'X', BaseItemStacks.ironShard, 'Y', Blocks.stone);
    obsidianCarver = GameRegistry.addShapedRecipe(BaseItemStacks.obsidianCarver, " X ", "YYY", 'X', BaseItemStacks.ironShard, 'Y', Blocks.obsidian);
    diamondCarver = GameRegistry.addShapedRecipe(BaseItemStacks.ironCarver, " X ", "YYY", "ZZZ", 'X', BaseItemStacks.obsidianShard, 'Y', Items.diamond, 'Z', Blocks.obsidian);
}
 
Example #26
Source File: WandHandler.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static boolean containsMatch(boolean strict, List<ItemStack> inputs, ItemStack... targets) {
    for (ItemStack input : inputs) {
        for (ItemStack target : targets) {
            if (OreDictionary.itemMatches(input, target, strict)) {
                return true;
            }
        }
    }
    return false;
}
 
Example #27
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 #28
Source File: GTRecipeIterators.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
/** Iterates through loaded itemstacks for all mods **/
public static void postInit() {
	createMortarRecipe();
	if (GTConfig.general.addCompressorRecipesForBlocks) {
		createUniversalProcessingRecipes();
	}
	for (Item item : Item.REGISTRY) {
		NonNullList<ItemStack> items = NonNullList.create();
		item.getSubItems(CreativeTabs.SEARCH, items);
		for (ItemStack stack : items) {
			if (GTConfig.general.oreDictWroughtIron && GTHelperStack.matchOreDict(stack, "ingotWroughtIron")
					&& !GTHelperStack.matchOreDict(stack, "ingotRefinedIron")) {
				OreDictionary.registerOre("ingotRefinedIron", stack);
			}
			if (GTHelperStack.matchOreDict(stack, "ingotAluminum")
					&& !GTHelperStack.matchOreDict(stack, "ingotAluminium")) {
				OreDictionary.registerOre("ingotAluminium", stack);
			}
			if (GTHelperStack.matchOreDict(stack, "dustAluminum")
					&& !GTHelperStack.matchOreDict(stack, "dustAluminium")) {
				OreDictionary.registerOre("dustAluminium", stack);
			}
			if (GTHelperStack.matchOreDict(stack, "ingotChromium")
					&& !GTHelperStack.matchOreDict(stack, "ingotChrome")) {
				OreDictionary.registerOre("ingotChrome", stack);
			}
		}
	}
	for (Block block : Block.REGISTRY) {
		if (block.getDefaultState().getMaterial() == Material.ROCK
				&& !GTHelperStack.oreDictStartsWith(GTMaterialGen.get(block), "ore")) {
			GTItemJackHammer.rocks.add(block);
		}
	}
	GTMod.logger.info("Jack Hammer stone list populated with " + GTItemJackHammer.rocks.size() + " entries");
}
 
Example #29
Source File: ItemMetalCrackHammer.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public boolean getIsRepairable(final ItemStack intputItem, final ItemStack repairMaterial) {
	List<ItemStack> acceptableItems = OreDictionary.getOres(repairOreDictName);
	for(ItemStack i : acceptableItems ){
		if(ItemStack.areItemsEqual(i, repairMaterial)) return true;
	}
	return false;
}
 
Example #30
Source File: OreDictionaryInterface.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<OreDictionaryEntry> getOreEntries(ItemStack itemStack) {
    int[] ids = OreDictionary.getOreIDs(CraftItemStack.asNMSCopy(itemStack));

    ImmutableList.Builder<OreDictionaryEntry> builder = ImmutableList.builder();
    for (int id : ids) {
        builder.add(OreDictionaryEntry.valueOf(id));
    }

    return builder.build();
}