public class OreDictionary
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
OreDictionary.OreRegisterEvent |
Modifier and Type | Field and Description |
---|---|
private static boolean |
DEBUG |
static NonNullList<ItemStack> |
EMPTY_LIST |
private static boolean |
hasInit |
private static java.util.List<java.lang.String> |
idToName |
private static java.util.List<NonNullList<ItemStack>> |
idToStack |
private static java.util.List<NonNullList<ItemStack>> |
idToStackUn |
private static java.util.Map<java.lang.String,java.lang.Integer> |
nameToId |
private static java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> |
stackToId |
static int |
WILDCARD_VALUE
Minecraft changed from -1 to Short.MAX_VALUE in 1.5 release for the "block wildcard".
|
Constructor and Description |
---|
OreDictionary() |
Modifier and Type | Method and Description |
---|---|
private static boolean |
containsMatch(boolean strict,
ItemStack[] inputs,
ItemStack... targets) |
static boolean |
containsMatch(boolean strict,
NonNullList<ItemStack> inputs,
ItemStack... targets) |
static boolean |
doesOreNameExist(java.lang.String name)
Returns whether or not an oreName exists in the dictionary.
|
static int |
getOreID(java.lang.String name)
Gets the integer ID for the specified ore name.
|
static int[] |
getOreIDs(ItemStack stack)
Gets all the integer ID for the ores that the specified item stack is registered to.
|
static java.lang.String |
getOreName(int id)
Reverse of getOreID, will not create new entries.
|
static java.lang.String[] |
getOreNames()
Retrieves a list of all unique ore names that are already registered.
|
private static NonNullList<ItemStack> |
getOres(int id)
Retrieves the List of items that are registered to this ore type.
|
static NonNullList<ItemStack> |
getOres(java.lang.String name)
Retrieves the ArrayList of items that are registered to this ore type.
|
static NonNullList<ItemStack> |
getOres(java.lang.String name,
boolean alwaysCreateEntry)
Retrieves the List of items that are registered to this ore type at this instant.
|
private static void |
initVanillaEntries() |
static boolean |
itemMatches(ItemStack target,
ItemStack input,
boolean strict) |
static void |
rebakeMap() |
static void |
registerOre(java.lang.String name,
Block ore) |
static void |
registerOre(java.lang.String name,
Item ore) |
static void |
registerOre(java.lang.String name,
ItemStack ore) |
private static void |
registerOreImpl(java.lang.String name,
ItemStack ore)
Registers a ore item into the dictionary.
|
private static final boolean DEBUG
private static boolean hasInit
private static java.util.List<java.lang.String> idToName
private static java.util.Map<java.lang.String,java.lang.Integer> nameToId
private static java.util.List<NonNullList<ItemStack>> idToStack
private static java.util.List<NonNullList<ItemStack>> idToStackUn
private static java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> stackToId
public static final NonNullList<ItemStack> EMPTY_LIST
public static final int WILDCARD_VALUE
private static void initVanillaEntries()
public static int getOreID(java.lang.String name)
name
- The unique name for this ore 'oreIron', 'ingotIron', etc..public static java.lang.String getOreName(int id)
id
- The ID to translate to a stringpublic static int[] getOreIDs(@Nonnull ItemStack stack)
stack
- The item stack of the ore.public static NonNullList<ItemStack> getOres(java.lang.String name)
name
- The ore name, directly calls getOreIDpublic static NonNullList<ItemStack> getOres(java.lang.String name, boolean alwaysCreateEntry)
name
- The ore name, directly calls getOreID if the flag is TRUEalwaysCreateEntry
- Flag - should a new entry be created if emptypublic static boolean doesOreNameExist(java.lang.String name)
name
- The ore namepublic static java.lang.String[] getOreNames()
private static NonNullList<ItemStack> getOres(int id)
id
- The ore ID, see getOreIDprivate static boolean containsMatch(boolean strict, ItemStack[] inputs, @Nonnull ItemStack... targets)
public static boolean containsMatch(boolean strict, NonNullList<ItemStack> inputs, @Nonnull ItemStack... targets)
public static boolean itemMatches(@Nonnull ItemStack target, @Nonnull ItemStack input, boolean strict)
public static void registerOre(java.lang.String name, Item ore)
public static void registerOre(java.lang.String name, Block ore)
public static void registerOre(java.lang.String name, @Nonnull ItemStack ore)
private static void registerOreImpl(java.lang.String name, @Nonnull ItemStack ore)
name
- The name of the oreore
- The ore's ItemStackpublic static void rebakeMap()