Java Code Examples for net.minecraftforge.oredict.OreDictionary

The following examples show how to use net.minecraftforge.oredict.OreDictionary. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: TofuCraftReload   Source File: BlockYuba.java    License: 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 2
/**
 * 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 Project: Sakura_mod   Source File: SakuraRecipeRegister.java    License: 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 Project: GardenCollection   Source File: UniqueMetaIdentifier.java    License: 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 Project: AgriCraft   Source File: OreDictUtil.java    License: 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
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 Project: GardenCollection   Source File: ModItems.java    License: 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
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 Project: GardenCollection   Source File: InfusionEnchantmentRecipe.java    License: 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 Project: Et-Futurum   Source File: BannerPatternHandler.java    License: 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 11
Source Project: customstuff4   Source File: ItemHelper.java    License: 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 12
Source Project: customstuff4   Source File: ShapedRecipe.java    License: 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 13
Source Project: GardenCollection   Source File: UniqueMetaRegistry.java    License: 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 14
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 15
Source Project: Cyberware   Source File: TileEntityEngineeringTable.java    License: 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 16
Source Project: TFC2   Source File: ShapedOreRecipeTFC.java    License: 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 17
Source Project: GardenCollection   Source File: InfusionRecipe.java    License: 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 18
Source Project: TofuCraftReload   Source File: TofuOreDictLoader.java    License: MIT License 5 votes vote down vote up
public TofuOreDictLoader() {
	OreDictionary.registerOre("seedRice",ItemLoader.riceseed);
	OreDictionary.registerOre("cropRice",ItemLoader.rice);
    OreDictionary.registerOre("listAllgrain", ItemLoader.rice);
	OreDictionary.registerOre("cropLeek", new ItemStack(ItemLoader.material,1,16));
    OreDictionary.registerOre("dustSalt", new ItemStack(ItemLoader.material,1,0));
    OreDictionary.registerOre("itemSalt", new ItemStack(ItemLoader.material,1,0));
    
    OreDictionary.registerOre("listAlltofu", new ItemStack(ItemLoader.tofu_food,1,0));
    OreDictionary.registerOre("listAlltofu", new ItemStack(ItemLoader.tofu_food,1,1));
    
    OreDictionary.registerOre("foodZunda", new ItemStack(ItemLoader.material,1,4));
    
    OreDictionary.registerOre("listAlltofuBlock", new ItemStack(BlockLoader.MOMENTOFU));
    OreDictionary.registerOre("listAlltofuBlock", new ItemStack(BlockLoader.KINUTOFU));
    
    OreDictionary.registerOre("cropChilipepper", new ItemStack(ItemLoader.material,1,31));
    OreDictionary.registerOre("cropLemon", new ItemStack(ItemLoader.material,1,30));
    
    OreDictionary.registerOre("cropSoybean", new ItemStack(ItemLoader.soybeans));
    OreDictionary.registerOre("cropAlmond", new ItemStack(ItemLoader.material,1,9));
    
    OreDictionary.registerOre("foodSoysauce", Soysauce);
    OreDictionary.registerOre("foodOliveoil", Soyoil);
    OreDictionary.registerOre("foodMayo", Mayonnaise);
       OreDictionary.registerOre("foodApricotjelly", ApricotJerry);
       OreDictionary.registerOre("foodStrawberryjelly", StrawberryJam);
    
}
 
Example 19
Source Project: Sakura_mod   Source File: BarrelRecipes.java    License: 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 20
Source Project: Sakura_mod   Source File: DistillationRecipes.java    License: 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 21
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 22
@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 23
public ShapelessArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
{
    output = result.copy();
    this.research = research;
    this.aspects = aspects;
    for (Object in : recipe)
    {
        if (in instanceof ItemStack)
        {
            input.add(((ItemStack)in).copy());
        }
        else if (in instanceof Item)
        {
            input.add(new ItemStack((Item)in));
        }
        else if (in instanceof Block)
        {
            input.add(new ItemStack((Block)in));
        }
        else if (in instanceof String)
        {
            input.add(OreDictionary.getOres((String)in));
        }
        else
        {
            String ret = "Invalid shapeless ore recipe: ";
            for (Object tmp :  recipe)
            {
                ret += tmp + ", ";
            }
            ret += output;
            throw new RuntimeException(ret);
        }
    }
}
 
Example 24
public static void register(Item item, RegistryEvent.Register<Item> event, String... oreNames) {
    ShootingStar.registerModel(new ModelCompound(RoutiductConstants.MOD_ID, item));
    event.getRegistry().register(item);
    for (String oreName : oreNames) {
        OreDictionary.registerOre(oreName, item);
    }
}
 
Example 25
@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 26
public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict)
{
    if (input == null && target != null || input != null && target == null)
    {
        return false;
    }
    return (target.getItem() == input.getItem() && 
    		((target.getItemDamage() == OreDictionary.WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
}
 
Example 27
@SubscribeEvent
public void onOreRegister(OreDictionary.OreRegisterEvent event) {
	ItemDictionary novaItemDictionary = Game.itemDictionary();

	Item item = ItemConverter.instance().getNovaItem(event.Ore);
	if (!novaItemDictionary.get(event.Name).contains(item)) {
		novaItemDictionary.add(event.Name, item);
	}
}
 
Example 28
Source Project: OpenPeripheral-Integration   Source File: OreDictMetaProvider.java    License: MIT License 5 votes vote down vote up
@Override
public Object getMeta(Item target, ItemStack stack) {
	int[] oreIds = OreDictionary.getOreIDs(stack);

	Map<String, Boolean> result = Maps.newHashMap();

	for (int oreId : oreIds)
		result.put(OreDictionary.getOreName(oreId), true);

	return result;
}
 
Example 29
@SubscribeEvent
public void onOreRegister(OreDictionary.OreRegisterEvent event) {
	ItemDictionary novaItemDictionary = Game.itemDictionary();

	Item item = ItemConverter.instance().getNovaItem(event.getOre());
	if (!novaItemDictionary.get(event.getName()).contains(item)) {
		novaItemDictionary.add(event.getName(), item);
	}
}
 
Example 30
protected static Set<Block> getBlocksMatching(String name) {
	Set<Block> set = new HashSet<>();
	for (ItemStack stack : OreDictionary.getOres(name)) {
		Block block = Block.getBlockFromItem(stack.getItem());
		if (block != Blocks.AIR) {
			set.add(block);
		}
	}
	return set;
}