package uristqwerty.CraftGuide.api;
import java.util.List;
import net.minecraft.item.ItemStack;
/**
* Contains a number of methods that implement common functionality
* that would otherwise need to be implemented by everyone who uses
* the API, or that relies on parts of CraftGuide not included in
* the API.
*/
public abstract class Util
{
/**
* An instance of Util, containing the method implementations.
*
* It is set during CraftGuide's {@literal @PreInit}.
*/
public static Util instance;
/**
* Causes CraftGuide to clear its list of recipes, and reload them with
* exactly the same process that was originally used to build the list.
*/
public abstract void reloadRecipes();
/**
* Converts the passed ItemStack's name and information into a List
* of Strings for display, similar to how GuiContainer does it.
* Additionally, contains logic to try an alternative if given a stack
* with a damage of -1 which produces an unusable name and information,
* if CraftGuide is set to always show item IDs it will insert the item's
* ID and damage value as the second line. If an exception is thrown
* at any time during the process, it will log it to CraftGuide.log and
* generate an error text to display that at least shows the item ID and
* damage.
* @param stack
* @return
*/
public abstract List getItemStackText(ItemStack stack);
/**
* Gets a standard {@link ItemFilter} for any of the common types:
* ItemStack
* List of ItemStacks
* String
*
* @param item
* @return
*/
public abstract ItemFilter getCommonFilter(Object item);
/**
* Gets a texture usable with {@link Renderer#renderRect}
* from a String identifier.
* If the texture does not exist in the current theme, nothing will be drawn.
*
* In addition to anything defined by the
* currently-active theme, converts the following aliases to the equivalent
* name used in theme files for backwards compatibility:
*
* "ItemStack-Any": ItemStack overlay indicating that any metadata value
* matches
* "ItemStack-OreDict": ItemStack overlay indicating that any one of a
* list of ItemStacks are acceptable.
* "ItemStack-OreDict-Single": Used in place of ItemStack-OreDict when
* the list of ItemStacks is exactly one element long.
* "ItemStack-Background": Image used as background for GUI slots
* "TextFilter": Icon used in place of an ItemStack when searching for
* a String
* "Error": Displayed in place of an ItemStack when an error prevents
* that stack from being rendered.
*
* @param identifier
* @return
*/
public abstract NamedTexture getTexture(String identifier);
/**
* Returns the number of partial ticks for this frame. I don't know
* quite what they do, but it's the third parameter to
* {@link net.minecraft.src.GuiScreen#drawScreen}, so I'm assuming
* that at least something needs it. Rather than pass it as an
* extra argument to every drawing method, it is stored at the
* start of rendering the GUI, and can be retrieved with this method.
* @return
*/
public abstract float getPartialTicks();
}