@Override public void getSubItems(int id, CreativeTabs tab, List list) { for (OreWrapper ore : OreHandler.INSTANCE.getRegisteredOres()) { if (ore.getGrinding() != null) { list.add(ore.getGrinding()); } } }
private int getColorFromOre(String oreTag) { if (oreTag.equals("NULL")) { return 0xFFFFFF; } if (!oreColorCache.containsKey(oreTag)) { List<Color> colors = new ArrayList<Color>(); int oreID = OreHandler.INSTANCE.getOre(oreTag).getOreBlocks()[0].itemID; if (oreID > 4095) { return 0xFFFFFF; // FortuneOres... :| } Block ore = Block.blocksList[oreID]; try { BufferedImage oreImage = ImageIO.read(UtilIcon.getResource(UtilIcon.getLocation(ore)).getInputStream()); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { Color pixel = new Color(oreImage.getRGB(i, j)); if (!pixel.grayscale()) { colors.add(pixel); } } } oreColorCache.put(oreTag, Color.average(colors.toArray(new Color[colors.size()]))); } catch (IOException e) { e.printStackTrace(); } } Color myColor = oreColorCache.get(oreTag); return myColor.toInt(); }