Java Code Examples for net.minecraftforge.oredict.OreDictionary#getOreNames()
The following examples show how to use
net.minecraftforge.oredict.OreDictionary#getOreNames() .
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: OreDictUnifier.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
public static void init() { for (String registeredOreName : OreDictionary.getOreNames()) { NonNullList<ItemStack> theseOres = OreDictionary.getOres(registeredOreName); for (ItemStack itemStack : theseOres) { onItemRegistration(new OreRegisterEvent(registeredOreName, itemStack)); } } MinecraftForge.EVENT_BUS.register(OreDictUnifier.class); }
Example 2
Source File: RecipeHandlerOreDictionary.java From NEI-Integration with MIT License | 5 votes |
public List<String> getOreNames() { List<String> oreNames = new LinkedList<String>(); for (String oreName : OreDictionary.getOreNames()) { if (oreName != null) { oreNames.add(oreName); } } Collections.sort(oreNames); return oreNames; }
Example 3
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); } } } } }
Example 4
Source File: SatelliteOreMapping.java From AdvancedRocketry with MIT License | 4 votes |
/** * Note: array returned will be [radius/blocksPerPixel][radius/blocksPerPixel] * @param world * @param offsetX * @param offsetY * @param radius in blocks * @param blocksPerPixel number of blocks squared (n*n) that take up one pixel * @return array of ore vs other block values */ public static int[][] scanChunk(World world, int offsetX, int offsetZ, int radius, int blocksPerPixel) { blocksPerPixel = Math.max(blocksPerPixel, 1); int[][] ret = new int[(radius*2)/blocksPerPixel][(radius*2)/blocksPerPixel]; Chunk chunk = world.getChunkFromChunkCoords(offsetX << 4, offsetZ << 4); IChunkProvider provider = world.getChunkProvider(); if(oreList.isEmpty()) { String[] strings = OreDictionary.getOreNames(); for(String str : strings) { if(str.startsWith("ore") || str.startsWith("dust") || str.startsWith("gem")) oreList.add(OreDictionary.getOreID(str)); } } for(int z = -radius; z < radius; z+=blocksPerPixel){ for(int x = -radius; x < radius; x+=blocksPerPixel) { int oreCount = 0, otherCount = 0; for(int y = world.getHeight(); y > 0; y--) { for(int deltaY = 0; deltaY < blocksPerPixel; deltaY++) { for(int deltaZ = 0; deltaZ < blocksPerPixel; deltaZ++) { BlockPos pos = new BlockPos(x + offsetX, y, z + offsetZ); if(world.isAirBlock(pos)) continue; boolean exists = false; out: for(int i : oreList) { List<ItemStack> itemlist = OreDictionary.getOres(OreDictionary.getOreName(i)); for(ItemStack item : itemlist) { if(item.getItem() == Item.getItemFromBlock(world.getBlockState(pos).getBlock())) { exists = true; break out; } } } if(exists) oreCount++; else otherCount++; } } } oreCount /= Math.pow(blocksPerPixel,2); otherCount /= Math.pow(blocksPerPixel,2); if(Thread.interrupted()) return null; ret[(x+radius)/blocksPerPixel][(z+radius)/blocksPerPixel] = (int)((oreCount/(float)Math.max(otherCount,1))*0xFFFF); } } return ret; }