Skip to content

Util Class

MCE626 edited this page May 4, 2019 · 3 revisions

Util has some, well, useful stuff to use for anyone who wants to use it!

Data Types

String[] dyes

The array string dyes contains a list of strings that have the dye color names in it. Used for dye items and color stuff.

public static String[] dyes = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White" };

You can loop through and get the values by doing dyes[i]. Example can be seen on the EnumDyeColorHelper page.

EnumDyeColor[] enumDyes

Similar to the string array dyes, this one contains a list of EnumDyeColor values.

public static EnumDyeColor[] enumDyes = { EnumDyeColor.BLACK, EnumDyeColor.RED, EnumDyeColor.GREEN, EnumDyeColor.BROWN, EnumDyeColor.BLUE, EnumDyeColor.PURPLE, EnumDyeColor.CYAN, EnumDyeColor.SILVER, EnumDyeColor.GRAY, EnumDyeColor.PINK, EnumDyeColor.LIME, EnumDyeColor.YELLOW, EnumDyeColor.LIGHT_BLUE, EnumDyeColor.MAGENTA, EnumDyeColor.ORANGE, EnumDyeColor.WHITE };

Methods

itemStacksEqualWithWildcard(ItemStack, ItemStack)

This method takes in two item stacks and compares them if they're the same, item damage doesn't matter. Returns a boolean.

getBlockFromMod(String, String)

This method takes in two strings. First one for the mod id, and the second of the block registry name. Then returns the boolean if it finds that it exists in the forge registries.

getItemFromMod(String, String)

This method takes in two strings. First one for the mod id, and the second of the item registry name. Then returns the boolean if it finds that it exists in the forge registries.

doesMethodExist(Class<?>, String)

This method takes in a class and a string. It will look into the class, and get a list of methods and compares the name of the methods in the class to the string you provided. Returns boolean.