mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Moved NEI handlers to plugins package, added drying rack handler
This commit is contained in:
1 parent
9e7eec8215
commit
66a45e0145
15 files changed
+249
-124
No files matched your search
@@ -0,0 +1,126 @@
|
||||
package tconstruct.plugins.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.crafting.DryingRackRecipes;
|
||||
import tconstruct.library.crafting.DryingRackRecipes.DryingRecipe;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class RecipeHandlerDryingRack extends RecipeHandlerBase
|
||||
{
|
||||
|
||||
public class CachedDryingRackRecipe extends CachedBaseRecipe
|
||||
{
|
||||
|
||||
public PositionedStack input;
|
||||
public PositionedStack output;
|
||||
public int time;
|
||||
|
||||
public CachedDryingRackRecipe(DryingRecipe drying)
|
||||
{
|
||||
this.input = new PositionedStack(drying.input, 44, 18);
|
||||
this.output = new PositionedStack(drying.result, 98, 18);
|
||||
this.time = drying.time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient ()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult ()
|
||||
{
|
||||
return this.output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName ()
|
||||
{
|
||||
return "Drying Rack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID ()
|
||||
{
|
||||
return "tconstruct.dryingrack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects ()
|
||||
{
|
||||
this.transferRects.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 15), this.getRecipeID(), new Object[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture ()
|
||||
{
|
||||
return "tinker:textures/gui/nei/dryingrack.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground (int recipe)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(this.getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 160, 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras (int recipe)
|
||||
{
|
||||
int time = ((CachedDryingRackRecipe) this.arecipes.get(recipe)).time;
|
||||
int seconds = time / 20;
|
||||
GuiDraw.drawStringC(time + " ticks (" + seconds + " secs)", 81, 40, 0x808080, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes (String outputId, Object... results)
|
||||
{
|
||||
if (outputId.equals(this.getRecipeID()))
|
||||
{
|
||||
for (DryingRecipe drying : DryingRackRecipes.recipes)
|
||||
{
|
||||
this.arecipes.add(new CachedDryingRackRecipe(drying));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes (ItemStack result)
|
||||
{
|
||||
for (DryingRecipe drying : DryingRackRecipes.recipes)
|
||||
{
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(drying.result, result))
|
||||
{
|
||||
this.arecipes.add(new CachedDryingRackRecipe(drying));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes (ItemStack ingred)
|
||||
{
|
||||
for (DryingRecipe drying : DryingRackRecipes.recipes)
|
||||
{
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(drying.input, ingred))
|
||||
{
|
||||
this.arecipes.add(new CachedDryingRackRecipe(drying));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user