コード例 #1
0
 // Register a new universal item
 // Cant be called after post-init
 public static void addODName(String entry) {
   if (!allowNewODNamesAfterPostInit) {
     return;
   }
   regODNames.add(entry);
   LogProjectU.info("Added ODName entry: " + entry);
 }
コード例 #2
0
  /*
   * Called during post-init
   * Find all the matching OreDictionary names and register them as replaced by the mod's items
   */
  public static void finishODLoading() {
    LogProjectU.info("Finishing loading of the OreDictionary Unifier");

    allowNewODNamesAfterPostInit = false;
    for (String str : regODNames) {
      Item item = GameRegistry.findItem(Reference.MOD_ID, str);
      for (ItemStack is : OreDictionary.getOres(str)) {
        if (!(is.getItem()
            instanceof
            ItemUniversalItem)) // Don't want to convert the mod's items into... themselves ! (it
                                // would probably have no effect)
        {
          conversionTable.put(is, new ItemStack(item));
        }
      }
    }
  }