2014-09-19 13:58:12 +02:00
|
|
|
package tconstruct.plugins.nei;
|
|
|
|
|
|
2022-09-22 19:51:23 +01:00
|
|
|
import codechicken.lib.gui.GuiDraw;
|
|
|
|
|
import codechicken.nei.NEIServerUtils;
|
|
|
|
|
import codechicken.nei.PositionedStack;
|
2014-09-19 13:58:12 +02:00
|
|
|
import java.awt.Rectangle;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2014-10-22 22:40:58 +02:00
|
|
|
import net.minecraft.util.StatCollector;
|
2022-09-22 19:51:23 +01:00
|
|
|
import org.lwjgl.opengl.GL11;
|
2014-09-19 13:58:12 +02:00
|
|
|
import tconstruct.library.crafting.DryingRackRecipes;
|
|
|
|
|
import tconstruct.library.crafting.DryingRackRecipes.DryingRecipe;
|
|
|
|
|
|
2022-09-22 19:51:23 +01:00
|
|
|
public class RecipeHandlerDryingRack extends RecipeHandlerBase {
|
2014-09-19 13:58:12 +02:00
|
|
|
|
2022-09-22 19:51:23 +01:00
|
|
|
public class CachedDryingRackRecipe extends CachedBaseRecipe {
|
2014-09-19 13:58:12 +02:00
|
|
|
|
|
|
|
|
public PositionedStack input;
|
|
|
|
|
public PositionedStack output;
|
|
|
|
|
public int time;
|
|
|
|
|
|
2022-09-22 19:51:23 +01:00
|
|
|
public CachedDryingRackRecipe(DryingRecipe drying) {
|
2014-09-19 13:58:12 +02:00
|
|
|
this.input = new PositionedStack(drying.input, 44, 18);
|
|
|
|
|
this.output = new PositionedStack(drying.result, 98, 18);
|
|
|
|
|
this.time = drying.time;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public PositionedStack getIngredient() {
|
2014-09-19 13:58:12 +02:00
|
|
|
return this.input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public PositionedStack getResult() {
|
2014-09-19 13:58:12 +02:00
|
|
|
return this.output;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public String getRecipeName() {
|
2014-10-22 22:40:58 +02:00
|
|
|
return StatCollector.translateToLocal("tconstruct.nei.dryingrack");
|
2014-09-19 13:58:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public String getRecipeID() {
|
2014-09-19 13:58:12 +02:00
|
|
|
return "tconstruct.dryingrack";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public void loadTransferRects() {
|
|
|
|
|
this.transferRects.add(
|
2023-01-25 23:50:09 +01:00
|
|
|
new RecipeTransferRect(new Rectangle(68, 20, 22, 15), this.getRecipeID()));
|
2014-09-19 13:58:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public String getGuiTexture() {
|
2014-09-19 13:58:12 +02:00
|
|
|
return "tinker:textures/gui/nei/dryingrack.png";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public void drawBackground(int recipe) {
|
2014-09-19 13:58:12 +02:00
|
|
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
|
|
|
GuiDraw.changeTexture(this.getGuiTexture());
|
|
|
|
|
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 160, 65);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public void drawExtras(int recipe) {
|
2014-09-19 13:58:12 +02:00
|
|
|
int time = ((CachedDryingRackRecipe) this.arecipes.get(recipe)).time;
|
|
|
|
|
int seconds = time / 20;
|
|
|
|
|
GuiDraw.drawStringC(time + " ticks (" + seconds + " secs)", 81, 40, 0x808080, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public void loadCraftingRecipes(String outputId, Object... results) {
|
|
|
|
|
if (outputId.equals(this.getRecipeID())) {
|
|
|
|
|
for (DryingRecipe drying : DryingRackRecipes.recipes) {
|
2014-09-19 13:58:12 +02:00
|
|
|
this.arecipes.add(new CachedDryingRackRecipe(drying));
|
|
|
|
|
}
|
2022-09-22 19:51:23 +01:00
|
|
|
} else {
|
2014-09-19 13:58:12 +02:00
|
|
|
super.loadCraftingRecipes(outputId, results);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public void loadCraftingRecipes(ItemStack result) {
|
|
|
|
|
for (DryingRecipe drying : DryingRackRecipes.recipes) {
|
|
|
|
|
if (NEIServerUtils.areStacksSameTypeCrafting(drying.result, result)) {
|
2014-09-19 13:58:12 +02:00
|
|
|
this.arecipes.add(new CachedDryingRackRecipe(drying));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public void loadUsageRecipes(ItemStack ingred) {
|
|
|
|
|
for (DryingRecipe drying : DryingRackRecipes.recipes) {
|
|
|
|
|
if (NEIServerUtils.areStacksSameTypeCrafting(drying.input, ingred)) {
|
2014-09-19 13:58:12 +02:00
|
|
|
this.arecipes.add(new CachedDryingRackRecipe(drying));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|