OreEntry
An OreEntry is a material like Gold, Diamond, Coal, Redstone and so on.
You can use this to get several OreDictEntries, IItemStacks, ILiquidStacks.
Methods
In general, the methods take a string parameter that is a prefix to be used.
For example, an OreEntry for "Gold"
, called with the prefix "dust"
will return Gold Dust.
For these examples, we will assume this was declared:
The comments after the example calls will state what the method call can return (unless in the extra category).
val oreEntry = mods.jaopca.JAOPCA.getOre("Gold");
Get entry properties
You can get these properties:
oreEntry.energyModifier; //1.0 as doubleoreEntry.rarity; //1.0 as doubleoreEntry.oreType; //"INGOT" as string
Get OreName or OreNameSynonyms
The ore name is essentialy how it is registered and what you use in a getOre to retrieve it.
The ore name synonyms are synonyms that mods or pack authors can register to combine two or more oreEntries (e.g. “Aluminum” and “Aluminium”). Most oreEntries will probably have nothing registered, though. The synonyms getter will return a list containing all the synonyms as strings.
oreEntry.oreName; //"Gold"oreEntry.oreNameSynonyms; //[]
Get IOreDictEntry
Returns a new IOreDictEntry with the given prefix.
oreEntry.getOreDictEntry("dust"); //<ore:dustGold>
Get IItemStack
Returns a new IItemStacks that matches the given prefix.
You can provide an alternate fallback prefix to be used if no matching Item is found.
If no matching item is found and no matching item is found using the fallback prefix (if provided), it will return null
.
//oreEntry.getItemStack(prefix);oreEntry.getItemStack("coin"); //<jaopca:item_coingold>oreEntry.getItemStack("invalid"); //null
//oreEntry.getItemStack(prefix, fallback);oreEntry.getItemStack("invalid", "coin"); //<jaopca:item_coingold>oreEntry.getItemStack("invalid", "faulty"); //null
Get ILiquidStack
Returns a new ILiquidStacks that matches the given prefix.
You can provide an alternate fallback prefix to be used if no matching Liquid is found.
If no matching liquid is found and no matching liquid is found using the fallback prefix (if provided), it will return null
.
//oreEntry.getLiquidStack(prefix);oreEntry.getLiquidStack("molten"); //<liquid:gold>oreEntry.getLiquidStack("invalid"); //null
//oreEntry.getLiquidStack(prefix, fallback);oreEntry.getLiquidStack("invalid", "molten"); //<liquid:gold>oreEntry.getLiquidStack("invalid", "faulty"); //null
Get Extra
An Entry can have an extra registered. An extra can for example be a secondary output when pulverizing a matching ore.
You can either check if an entry has an extra, get the extra (or null
if not present) or the extraName.
You can also use the same methods as above (getOreDictEntry
, getLiquidStack
and getItemStack
).
There are up to 3 extras that can be registered. For the sake of simplicity there won’t be examples for the equivalent methods, they will only be stated
//First extraoreEntry.hasExtra; //true or falseoreEntry.extra; //matching oreEntry or nulloreEntry.extraName; //the name or null
//Methods for first extraoreEntry.getOreDictEntryExtra(prefix);oreEntry.getItemStackExtra(prefix);oreEntry.getItemStackExtra(prefix, fallback);oreEntry.getLiquidStackExtra(prefix);oreEntry.getLiquidStackExtra(prefix, fallback);
//Second extraoreEntry.hasSecondExtra; //true or falseoreEntry.secondExtra; //matching oreEntry or nulloreEntry.secondExtraName; //the name or null
//Methods for second extraoreEntry.getOreDictEntrySecondExtra(prefix);oreEntry.getItemStackSecondExtra(prefix);oreEntry.getItemStackSecondExtra(prefix, fallback);oreEntry.getLiquidStackSecondExtra(prefix);oreEntry.getLiquidStackSecondExtra(prefix, fallback);
//Third extraoreEntry.hasThirdExtra; //true or falseoreEntry.thirdExtra; //matching oreEntry or nulloreEntry.thirdExtraName; //the name or null
//Methods for third extraoreEntry.getOreDictEntryThirdExtra(prefix);oreEntry.getItemStackThirdExtra(prefix);oreEntry.getItemStackThirdExtra(prefix, fallback);oreEntry.getLiquidStackThirdExtra(prefix);oreEntry.getLiquidStackThirdExtra(prefix, fallback);