From 70c1354a4a96698758a88c032866288f79de6f5a Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sat, 24 Aug 2024 08:16:37 -0400 Subject: Initial commit --- .../jp/plusplus/fbs/nei/PotteryCraftHandler.java | 143 +++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.java (limited to 'src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.java') diff --git a/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.java b/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.java new file mode 100644 index 0000000..3c94acc --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/nei/PotteryCraftHandler.java @@ -0,0 +1,143 @@ +package jp.plusplus.fbs.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.NEIClientUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import jp.plusplus.fbs.FBS; +import jp.plusplus.fbs.Registry; +import jp.plusplus.fbs.pottery.GuiPottersWheel; +import jp.plusplus.fbs.item.ItemCore; +import jp.plusplus.fbs.pottery.PotteryRegistry; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Iterator; + +/** + * Created by pluslus_F on 2015/06/24. + */ +public class PotteryCraftHandler extends TemplateRecipeHandler { + + @Override + public int recipiesPerPage(){ + return 1; + } + + @Override + public void loadTransferRects() { + this.transferRects.add(new RecipeTransferRect(new Rectangle(106, 53, 22, 15), "fbs.pottery", new Object[0])); + } + + @Override + public String getOverlayIdentifier() { + return "fbs.pottery"; + } + + @Override + public Class getGuiClass() { + return GuiPottersWheel.class; + } + + @Override + public void drawBackground(int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 162-5, 102); + } + @Override + public void drawExtras(int recipe) {} + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if(outputId.equals("fbs.pottery") && this.getClass() == PotteryCraftHandler.class) { + Iterator i$ = PotteryRegistry.GetPotteryCrafting().iterator(); + + while(i$.hasNext()) { + PotteryRegistry.PotteryPair r=(PotteryRegistry.PotteryPair)i$.next(); + arecipes.add(new CachedPottery(r)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + Iterator i$ = PotteryRegistry.GetPotteryCrafting().iterator(); + + while(i$.hasNext()) { + PotteryRegistry.PotteryPair rp=(PotteryRegistry.PotteryPair)i$.next(); + if(rp.product.isItemEqual(result)) arecipes.add(new CachedPottery(rp)); + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + Iterator i$ = PotteryRegistry.GetPotteryCrafting().iterator(); + + while(i$.hasNext()) { + PotteryRegistry.PotteryPair rp=(PotteryRegistry.PotteryPair)i$.next(); + + boolean flag=false; + for(int i=0;i ingredients=new ArrayList(); + public PositionedStack result; + public CachedPottery(PotteryRegistry.PotteryPair rp){ + for(int i=0;i getIngredients() { + return getCycledIngredients(PotteryCraftHandler.this.cycleticks / 20, ingredients); + } + + @Override + public PositionedStack getResult() { + return result; + } + + } +} -- cgit v1.2.3