Java Code Examples for net.minecraftforge.oredict.OreDictionary#doesOreNameExist()
The following examples show how to use
net.minecraftforge.oredict.OreDictionary#doesOreNameExist() .
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: OreDictUtil.java From AgriCraft with MIT License | 6 votes |
/** * 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 2
Source File: GTHelperStack.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
public static ItemStack getStackFromOreDict(String entry) { ItemStack stack = null; if (OreDictionary.doesOreNameExist(entry)) { NonNullList<ItemStack> list = OreDictionary.getOres(entry, false); if (!list.isEmpty()) { stack = list.get(0); } } return stack; }
Example 3
Source File: JEIIntegration.java From EmergingTechnology with MIT License | 4 votes |
public static boolean doesOreExist(String key) { return OreDictionary.doesOreNameExist(key) && OreDictionary.getOres(key).stream().anyMatch(s -> s.getItem() instanceof ItemBlock); }
Example 4
Source File: GTRecipeIterators.java From GT-Classic with GNU Lesser General Public License v3.0 | 4 votes |
/** Ran post init **/ public static void createUniversalProcessingRecipes() { String[] oreDict = OreDictionary.getOreNames(); int oreDictSize = oreDict.length; for (int i = 0; i < oreDictSize; ++i) { String id = oreDict[i]; String dust; NonNullList<ItemStack> list; // block to dust iterator if (id.startsWith("block")) { dust = "dust" + id.substring(5); if (OreDictionary.doesOreNameExist(dust)) { list = OreDictionary.getOres(dust, false); if (!list.isEmpty() && !id.contains("Chromium") && !id.contains("Aluminum") && !id.contains("Coal") && !id.contains("Charcoal") && !id.contains("Quartz") && !id.contains("Prismarine")) { TileEntityMacerator.addRecipe((String) id, 1, GTHelperStack.copyWithSize((ItemStack) list.get(0), 9), 0.1F); } } } // ingot to block iterator String block; if (id.startsWith("ingot")) { block = "block" + id.substring(5); if (OreDictionary.doesOreNameExist(block)) { list = OreDictionary.getOres(block, false); if (!list.isEmpty() && !id.contains("Copper") && !id.contains("Chromium") && !id.contains("Aluminum")) { TileEntityCompressor.addRecipe((String) id, 9, GTHelperStack.copyWithSize((ItemStack) list.get(0), 1), 0.1F); } } } else // gems to block iterator if (id.startsWith("gem")) { block = "block" + id.substring(3); if (OreDictionary.doesOreNameExist(block)) { list = OreDictionary.getOres(block, false); if (!list.isEmpty() && !id.contains("Coal") && !id.contains("Quartz")) { TileEntityCompressor.addRecipe((String) id, 9, GTHelperStack.copyWithSize((ItemStack) list.get(0), 1), 0.1F); } } } } }