Simple Modding Q&As

Discussion in 'Mod Development' started by Strikingwolf, Sep 17, 2014.

  1. chbachman

    chbachman Guest

    Please, try harder to google. This was from the second result.

    Wavebrother and SatanicSanta like this.
  2. Wavebrother

    Wavebrother New Member

    I must have searched the wrong thing. Oops. Thanks though! It works! now I can get back to coding.
    Last edited: Sep 28, 2014
  3. SatanicSanta

    SatanicSanta New Member

    Oh OreDict, lovely messy OreDict.

    Anyone know how to deal with this crap? Basically, I need to change all usage of the getOreID and getOres (int version, because now it uses strings) to the updated versions. Also for some reason toArray(ItemStack) is being mean as well, not sure what's goin on there. There is also that annoying "type parameters of T cannot be determined" thing, which all of the Stackoverflow things I read were not helpful >.>

    Relevant classes:
  4. squeek502

    squeek502 New Member

    I'm not terribly knowledgeable about the ore dictionary, but from what I know, getOreID isn't reliable because a given ItemStack can be registered under multiple OreDictionary entries (meaning your current code could easily misbehave and give you the wrong ore ID if the item is registered under multiple entries). Using only non-deprecated methods:
    int[] firstLiquidOreIDs = OreDictionary.getOreIDs(formula.liquid1.ingot);
    int firstLiquidOreID;
    if (firstLiquidOreIDs.length > 1)
        // need to resolve the ore id in this case, or perhaps concat ore lists?
    else if (firstLiquidOreIDs.length > 0)
        firstLiquidOreID = firstLiquidOreIDs[0];
       // bad news
    item1 = OreDictionary.getOres(OreDictionary.getOreName(firstLiquidOreID)).toArray(new ItemStack[0]);
    The ideal would probably be to just store the oredict name whenever possible rather than have to get it from an ItemStack each time, as it seems like you're counting on oredict entries existing anyway.

    EDIT: Oh, and you can get around getOres(int) being private by explicity using getOres(Integer), if you don't mind using deprecated methods:
    int oreID = 1;
    ArrayList<ItemStack> ores = OreDictionary.getOres(Integer.valueOf(oreID));
    Last edited: Oct 5, 2014

Share This Page