public abstract class TemplateRecipeHandler extends java.lang.Object implements ICraftingHandler, IUsageHandler
| Modifier and Type | Class and Description |
|---|---|
class |
TemplateRecipeHandler.CachedRecipe
This Recipe Handler runs on this internal class
Fill the recipe array with subclasses of this to make transforming the different types of recipes out there into a nice format for NEI a much easier job.
|
static class |
TemplateRecipeHandler.RecipeTransferRect
The Rectangle is an region of the gui relative to the corner of the recipe that will activate the recipe with the corresponding outputId apon being clicked.
|
static class |
TemplateRecipeHandler.RecipeTransferRectHandler |
| Modifier and Type | Field and Description |
|---|---|
java.util.ArrayList<TemplateRecipeHandler.CachedRecipe> |
arecipes
The list of matching recipes
|
int |
cycleticks
Internal tick counter, initialised to random value and incremented every tick.
|
java.util.LinkedList<TemplateRecipeHandler.RecipeTransferRect> |
transferRects
A list of transferRects that apon when clicked or R is pressed will open a new recipe.
|
| Constructor and Description |
|---|
TemplateRecipeHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
drawBackground(int recipe)
Draw the background of this recipe handler (basically the slot layout image).
|
void |
drawExtras(int recipe)
Extension point for drawing progress bars and other overlays
|
void |
drawForeground(int recipe)
Draw the foreground of this recipe handler (for things like progress bars).
|
void |
drawProgressBar(int x,
int y,
int tx,
int ty,
int w,
int h,
float completion,
int direction)
Draws a texture rectangle that changes size with time.
|
void |
drawProgressBar(int x,
int y,
int tx,
int ty,
int w,
int h,
int ticks,
int direction)
Draws a texture rectangle that changes size with time.
|
java.lang.Class<? extends net.minecraft.client.gui.inventory.GuiContainer> |
getGuiClass() |
abstract java.lang.String |
getGuiTexture() |
java.util.List<PositionedStack> |
getIngredientStacks(int recipe) |
java.util.List<PositionedStack> |
getOtherStacks(int recipe) |
IOverlayHandler |
getOverlayHandler(net.minecraft.client.gui.inventory.GuiContainer gui,
int recipe) |
java.lang.String |
getOverlayIdentifier()
Simply works with the
DefaultOverlayRenderer
If the current container has been registered with this identifier, the question mark appears and an overlay guide can be drawn. |
IRecipeOverlayRenderer |
getOverlayRenderer(net.minecraft.client.gui.inventory.GuiContainer gui,
int recipe) |
ICraftingHandler |
getRecipeHandler(java.lang.String outputId,
java.lang.Object... results) |
java.util.List<java.lang.Class<? extends net.minecraft.client.gui.inventory.GuiContainer>> |
getRecipeTransferRectGuis() |
PositionedStack |
getResultStack(int recipe) |
IUsageHandler |
getUsageHandler(java.lang.String inputId,
java.lang.Object... ingredients) |
java.util.List<java.lang.String> |
handleItemTooltip(GuiRecipe gui,
ItemStack stack,
java.util.List<java.lang.String> currenttip,
int recipe) |
java.util.List<java.lang.String> |
handleTooltip(GuiRecipe gui,
java.util.List<java.lang.String> currenttip,
int recipe) |
boolean |
hasOverlay(net.minecraft.client.gui.inventory.GuiContainer gui,
java.awt.Container container,
int recipe) |
boolean |
keyTyped(GuiRecipe gui,
char keyChar,
int keyCode,
int recipe) |
void |
loadCraftingRecipes(ItemStack result)
Simplified wrapper, implement this and fill the empty recipe array with recipes
|
void |
loadCraftingRecipes(java.lang.String outputId,
java.lang.Object... results)
In this function you need to fill up the empty recipe array with recipes.
|
void |
loadTransferRects()
Add all RecipeTransferRects to the transferRects list during this call.
|
void |
loadUsageRecipes(ItemStack ingredient)
Simplified wrapper, implement this and fill the empty recipe array with recipes
|
void |
loadUsageRecipes(java.lang.String inputId,
java.lang.Object... ingredients)
In this function you need to fill up the empty recipe array with recipes
The default passes it to a cleaner handler if inputId is an item
|
boolean |
mouseClicked(GuiRecipe gui,
int button,
int recipe) |
TemplateRecipeHandler |
newInstance() |
int |
numRecipes() |
void |
onUpdate()
A tick function called for updating progress bars and cycling damage items.
|
int |
recipiesPerPage() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetRecipeNamepublic int cycleticks
public java.util.ArrayList<TemplateRecipeHandler.CachedRecipe> arecipes
public java.util.LinkedList<TemplateRecipeHandler.RecipeTransferRect> transferRects
public void loadTransferRects()
public void loadCraftingRecipes(java.lang.String outputId,
java.lang.Object... results)
outputId - A String identifier representing the type of output produced. Eg. {"item", "fuel"}results - Objects representing the results that matching recipes must produce.public void loadCraftingRecipes(ItemStack result)
result - The result the recipes must output.public void loadUsageRecipes(java.lang.String inputId,
java.lang.Object... ingredients)
inputId - A String identifier representing the type of ingredients used. Eg. {"item", "fuel"}ingredients - Objects representing the ingredients that matching recipes must contain.public void loadUsageRecipes(ItemStack ingredient)
ingredient - The ingredient the recipes must contain.public abstract java.lang.String getGuiTexture()
public java.lang.String getOverlayIdentifier()
DefaultOverlayRenderer
If the current container has been registered with this identifier, the question mark appears and an overlay guide can be drawn.public void drawExtras(int recipe)
recipe - The recipeIndex being drawnpublic void drawProgressBar(int x,
int y,
int tx,
int ty,
int w,
int h,
int ticks,
int direction)
x - X position on screeny - Y position on screentx - Texture X positionty - Texture Y positionw - Texture widthh - Texture heightticks - The amount of ticks for the bar to completedirection - 0 right, 1 down, 2 left, 3 up. If bit 3 is set the bar will shrink rather extendpublic void drawProgressBar(int x,
int y,
int tx,
int ty,
int w,
int h,
float completion,
int direction)
x - X position on screeny - Y position on screentx - Texture X positionty - Texture Y positionw - Texture widthh - Texture heightcompletion - the percentage of progress bar completion, 0-1direction - 0 right, 1 down, 2 left, 3 up. If bit 3 is set the bar will shrink rather extendpublic java.util.List<java.lang.Class<? extends net.minecraft.client.gui.inventory.GuiContainer>> getRecipeTransferRectGuis()
public java.lang.Class<? extends net.minecraft.client.gui.inventory.GuiContainer> getGuiClass()
public TemplateRecipeHandler newInstance()
public ICraftingHandler getRecipeHandler(java.lang.String outputId, java.lang.Object... results)
getRecipeHandler in interface ICraftingHandleroutputId - A String identifier representing the type of output produced. Eg. {"item", "fuel"}results - Objects representing the results that matching recipes must produce.ICraftingHandler configured with a list of recipes that produce matching output.public IUsageHandler getUsageHandler(java.lang.String inputId, java.lang.Object... ingredients)
getUsageHandler in interface IUsageHandlerinputId - A String identifier representing the type of ingredients used. Eg. {"item", "fuel"}ingredients - Objects representing the ingredients that matching recipes must contain.IUsageHandler configured with a list of recipes that contain matching inputpublic int numRecipes()
numRecipes in interface IRecipeHandlerpublic void drawBackground(int recipe)
IRecipeHandlerdrawBackground in interface IRecipeHandlerrecipe - The recipe index to draw at this position.public void drawForeground(int recipe)
IRecipeHandlerdrawForeground in interface IRecipeHandlerrecipe - The recipe index to draw at this position.public java.util.List<PositionedStack> getIngredientStacks(int recipe)
getIngredientStacks in interface IRecipeHandlerrecipe - The recipe index to get items for.PositionedStacks in this recipe relative to the top left corner of your recipe drawing space.public PositionedStack getResultStack(int recipe)
getResultStack in interface IRecipeHandlerrecipe - The recipe index to get the result for.PositionedStack relative to the top left corner of your recipe drawing space.public java.util.List<PositionedStack> getOtherStacks(int recipe)
getOtherStacks in interface IRecipeHandlerPositionedStacks in this recipe relative to the top left corner of your recipe drawing space. For example fuel in furnaces.public void onUpdate()
IRecipeHandleronUpdate in interface IRecipeHandlerpublic boolean hasOverlay(net.minecraft.client.gui.inventory.GuiContainer gui,
java.awt.Container container,
int recipe)
hasOverlay in interface IRecipeHandlergui - The GUI to overlay.container - The container of the GUI.recipe - The recipe index to check for.public IRecipeOverlayRenderer getOverlayRenderer(net.minecraft.client.gui.inventory.GuiContainer gui, int recipe)
getOverlayRenderer in interface IRecipeHandlerrecipe - The recipe index to get the overlay renderer for.IRecipeOverlayRenderer to be used for rendering the overlay of this specific recipe.public IOverlayHandler getOverlayHandler(net.minecraft.client.gui.inventory.GuiContainer gui, int recipe)
getOverlayHandler in interface IRecipeHandlerrecipe - The recipe index to get the overlay renderer for.IOverlayHandler to be used for rendering the overlay of this specific recipe.public int recipiesPerPage()
recipiesPerPage in interface IRecipeHandlerpublic java.util.List<java.lang.String> handleTooltip(GuiRecipe gui, java.util.List<java.lang.String> currenttip, int recipe)
handleTooltip in interface IRecipeHandlergui - An instance of the currentscreencurrenttip - The current tooltip, will contain item name and inforecipe - The recipe index being handledpublic java.util.List<java.lang.String> handleItemTooltip(GuiRecipe gui, ItemStack stack, java.util.List<java.lang.String> currenttip, int recipe)
handleItemTooltip in interface IRecipeHandlergui - An instance of the currentscreenrecipe - The recipe index being handledpublic boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe)
keyTyped in interface IRecipeHandlergui - An instance of the currentscreenkeyChar - The character representing the keyPresskeyCode - The KeyCode as defined in Keyboardpublic boolean mouseClicked(GuiRecipe gui, int button, int recipe)
mouseClicked in interface IRecipeHandlergui - An instance of the currentscreenbutton - The button index being pressed, {0 = Left Click, 1 = Right Click, 2 = Middle Click}