From 0427ab89f1753a44b30cbc35ce021cbbdc845109 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Thu, 10 Aug 2017 18:52:45 +0300 Subject: fix missing source folder --- .../ihl/nei_integration/MachineRecipeHandler.java | 413 --------------------- 1 file changed, 413 deletions(-) delete mode 100644 main/java/ihl/nei_integration/MachineRecipeHandler.java (limited to 'main/java/ihl/nei_integration/MachineRecipeHandler.java') diff --git a/main/java/ihl/nei_integration/MachineRecipeHandler.java b/main/java/ihl/nei_integration/MachineRecipeHandler.java deleted file mode 100644 index eba0855..0000000 --- a/main/java/ihl/nei_integration/MachineRecipeHandler.java +++ /dev/null @@ -1,413 +0,0 @@ -package ihl.nei_integration; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler; -import ic2.api.recipe.IRecipeInput; -import ihl.interfaces.IWire; -import ihl.recipes.IRecipeInputFluid; -import ihl.recipes.RecipeOutputItemStack; -import ihl.recipes.UniversalRecipeInput; -import ihl.recipes.UniversalRecipeOutput; -import ihl.utils.IHLUtils; -import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fluids.BlockFluidBase; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; - -public abstract class MachineRecipeHandler extends TemplateRecipeHandler { - protected int ticks; - - @Override - public String getRecipeName() { - return StatCollector.translateToLocal(getRecipeId()); - } - - public abstract String getRecipeId(); - - @Override - public abstract String getGuiTexture(); - - @Override - public abstract String getOverlayIdentifier(); - - public abstract Map getRecipeList(); - - @Override - public void drawBackground(int i) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 140, 65); - } - - @Override - public void drawExtras(int recipeNumber) { - MachineRecipeHandler.CachedIORecipe recipe = (CachedIORecipe) this.arecipes.get(recipeNumber); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - for (PositionedStack stack : recipe.ingredients) { - if (stack.item.stackSize == 0) { - GuiDraw.fontRenderer.drawStringWithShadow("0.001", stack.relx + 3, stack.rely + 9, 16777215); - } - if (stack instanceof IHLPositionedStack) - drawFormattedString((IHLPositionedStack) stack); - - } - for (PositionedStack stack : recipe.otherStacks) { - if (stack instanceof IHLPositionedStack) - drawFormattedString((IHLPositionedStack) stack); - } - if (recipe.output instanceof IHLPositionedStack) { - IHLPositionedStack rOutput = (IHLPositionedStack) recipe.output; - drawFormattedString(rOutput); - } - GuiDraw.changeTexture(this.getGuiTexture()); - } - - public void drawFormattedString(IHLPositionedStack rOutput) { - if (Math.abs(rOutput.sQuantity - Math.round(rOutput.sQuantity)) < 0.01f) { - if (Math.round(rOutput.sQuantity) != 1) { - GuiDraw.fontRenderer.drawStringWithShadow(String.format("%d", Math.round(rOutput.sQuantity)), - rOutput.relx + 11, rOutput.rely + 9, 16777215); - } - } else { - GuiDraw.fontRenderer.drawStringWithShadow(String.format("%.1f", rOutput.sQuantity), rOutput.relx + 3, - rOutput.rely + 9, 16777215); - } - } - - @Override - public void onUpdate() { - super.onUpdate(); - ++this.ticks; - } - - @Override - public void loadTransferRects() { - // this.transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, - // 25, 16), this.getRecipeId(), new Object[0])); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(this.getRecipeId())) { - Iterator> i$ = this.getRecipeList().entrySet() - .iterator(); - - while (i$.hasNext()) { - Entry entry = i$.next(); - this.arecipes.add(new MachineRecipeHandler.CachedIORecipe(entry.getKey(), entry.getValue(), - getAdditionalIngredients())); - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) { - Iterator> i$ = this.getRecipeList().entrySet().iterator(); - FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(result); - if (fluidStack == null && result.getItem() instanceof IFluidContainerItem) { - IFluidContainerItem ifc = (IFluidContainerItem) result.getItem(); - fluidStack = ifc.getFluid(result); - } else if (result.getItem() instanceof ItemBlock) { - Block blockfluid = ((ItemBlock) result.getItem()).field_150939_a; - if (blockfluid instanceof BlockFluidBase) { - Fluid fluid = ((BlockFluidBase) blockfluid).getFluid(); - if (fluid != null) { - fluidStack = new FluidStack(fluid, 1000); - } - } - } - if (fluidStack != null) { - while (i$.hasNext()) { - Entry entry = i$.next(); - Iterator i$1 = ((UniversalRecipeOutput) entry.getValue()).getFluidOutputs().iterator(); - while (i$1.hasNext()) { - FluidStack output = i$1.next(); - if (output != null && output.getFluid() == fluidStack.getFluid()) { - this.arecipes.add(new MachineRecipeHandler.CachedIORecipe((UniversalRecipeInput) entry.getKey(), - (UniversalRecipeOutput) entry.getValue(), getAdditionalIngredients())); - break; - } - } - } - } else { - while (i$.hasNext()) { - Entry entry = i$.next(); - Iterator i$1 = (entry.getValue()).getItemOutputs().iterator(); - - while (i$1.hasNext()) { - RecipeOutputItemStack output = i$1.next(); - - if (NEIServerUtils.areStacksSameTypeCrafting(output.itemStack, result) - || IHLUtils.isItemsHaveSameOreDictionaryEntry(output.itemStack, result)) { - this.arecipes.add(new MachineRecipeHandler.CachedIORecipe(entry.getKey(), entry.getValue(), - getAdditionalIngredients())); - break; - } - } - } - } - } - - public List getAdditionalIngredients() { - return null; - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - Iterator> i$ = this.getRecipeList().entrySet().iterator(); - FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(ingredient); - if (fluidStack == null && ingredient.getItem() instanceof IFluidContainerItem) { - IFluidContainerItem ifc = (IFluidContainerItem) ingredient.getItem(); - fluidStack = ifc.getFluid(ingredient); - } else if (ingredient.getItem() instanceof ItemBlock) { - Block blockfluid = ((ItemBlock) ingredient.getItem()).field_150939_a; - if (blockfluid instanceof BlockFluidBase) { - Fluid fluid = ((BlockFluidBase) blockfluid).getFluid(); - if (fluid != null) { - fluidStack = new FluidStack(fluid, 1000); - } - } - } - - if (fluidStack != null && fluidStack.getFluid() != null) { - while (i$.hasNext()) { - Entry entry = i$.next(); - if (((UniversalRecipeInput) entry.getKey()).containFluidStack(fluidStack)) { - this.arecipes.add(new MachineRecipeHandler.CachedIORecipe(entry.getKey(), entry.getValue(), - getAdditionalIngredients())); - } - } - } else { - while (i$.hasNext()) { - Entry entry = i$.next(); - if (((UniversalRecipeInput) entry.getKey()).containItemStack(ingredient)) { - this.arecipes.add(new MachineRecipeHandler.CachedIORecipe(entry.getKey(), entry.getValue(), - getAdditionalIngredients())); - } - } - } - } - - protected int[] getFluidInputPosX() { - return null; - } - - protected int[] getFluidInputPosY() { - return null; - } - - protected int[] getFluidOutputPosX() { - return null; - } - - protected int[] getFluidOutputPosY() { - return null; - } - - protected abstract int[] getInputPosX(); - - protected abstract int[] getInputPosY(); - - protected abstract int[] getOutputPosX(); - - protected abstract int[] getOutputPosY(); - - public class CachedIORecipe extends CachedRecipe { - private final List ingredients = new ArrayList(); - public PositionedStack output; - public final List otherStacks = new ArrayList(); - public boolean specialConditions = false; - public UniversalRecipeInput urInput; - public UniversalRecipeOutput urOutput; - - @Override - public List getIngredients() { - return this.getCycledIngredients(MachineRecipeHandler.this.cycleticks / 20, this.ingredients); - } - - @Override - public PositionedStack getResult() { - return this.output; - } - - @Override - public List getOtherStacks() { - return this.otherStacks; - } - - public CachedIORecipe(UniversalRecipeInput input, UniversalRecipeOutput output1, - List additionalIngredients) { - super(); - if (input == null) { - throw new NullPointerException("Input must not be null (recipe " + input + " -> " + output1 + ")."); - } else if (output1 == null) { - throw new NullPointerException("Output must not be null (recipe " + input + " -> " + output1 + ")."); - } else if ((output1.getFluidOutputs() == null || output1.getFluidOutputs().isEmpty()) - && (output1.getItemOutputs() == null || output1.getItemOutputs().isEmpty())) { - throw new NullPointerException("Output must not be null (recipe " + input + " -> " + output1 + ")."); - } else { - this.urInput = input; - this.urOutput = output1; - specialConditions = output1.specialConditions; - ArrayList> items = new ArrayList>(); - ArrayList> fluidItems = new ArrayList>(); - if (input.getFluidInputs() != null && !input.getFluidInputs().isEmpty()) { - Iterator i = input.getFluidInputs().iterator(); - while (i.hasNext()) { - IRecipeInputFluid fstackRI = (IRecipeInputFluid) i.next(); - List fstackList = fstackRI.getInputs(); - fluidItems.add(fstackList); - } - } - - if (input.getItemInputs() != null && !input.getItemInputs().isEmpty()) { - Iterator i = input.getItemInputs().iterator(); - while (i.hasNext()) { - IRecipeInput rInput = (IRecipeInput) i.next(); - Iterator rInputsi = rInput.getInputs().iterator(); - List itemInputs = new ArrayList(); - while (rInputsi.hasNext()) { - ItemStack stack = rInputsi.next().copy(); - if (!(stack.getItem() instanceof IWire)) { - stack.stackSize = rInput.getAmount(); - } - itemInputs.add(stack); - } - items.add(itemInputs); - } - } - - int var7 = 0; - int var8 = 0; - boolean skipOneFluidOutput = false; - if (output1.getItemOutputs() != null && !output1.getItemOutputs().isEmpty()) { - int x = MachineRecipeHandler.this.getOutputPosX()[0], - y = MachineRecipeHandler.this.getOutputPosY()[0]; - if (output1.getItemOutputs().get(0) != null) - this.output = new IHLPositionedStack(output1.getItemOutputs().get(0), x, y); - Iterator i = output1.getItemOutputs().iterator(); - i.next(); - while (i.hasNext()) { - RecipeOutputItemStack rOut = i.next(); - var7++; - if (var7 < MachineRecipeHandler.this.getOutputPosX().length) { - x = MachineRecipeHandler.this.getOutputPosX()[var7]; - } - if (var7 < MachineRecipeHandler.this.getOutputPosY().length) { - y = MachineRecipeHandler.this.getOutputPosY()[var7]; - } - if (rOut != null) { - this.otherStacks.add(new IHLPositionedStack(rOut, x, y)); - } - } - } else { - if (MachineRecipeHandler.this.getFluidOutputPosX() != null) { - this.output = new IHLPositionedStack(output1.getFluidOutputs().get(0), - MachineRecipeHandler.this.getFluidOutputPosX()[0], - MachineRecipeHandler.this.getFluidOutputPosY()[0]); - } else { - this.output = new IHLPositionedStack(output1.getFluidOutputs().get(0), MachineRecipeHandler.this.getOutputPosX()[0], - MachineRecipeHandler.this.getOutputPosY()[0]); - } - skipOneFluidOutput = true; - var8++; - } - - if (output1.getFluidOutputs() != null && !output1.getFluidOutputs().isEmpty()) { - int x = MachineRecipeHandler.this.getOutputPosX()[0], - y = MachineRecipeHandler.this.getOutputPosY()[0]; - if (MachineRecipeHandler.this.getFluidOutputPosX() != null) { - x = MachineRecipeHandler.this.getFluidOutputPosX()[0]; - y = MachineRecipeHandler.this.getFluidOutputPosY()[0]; - } - Iterator i = output1.getFluidOutputs().iterator(); - if (skipOneFluidOutput) { - i.next(); - } - while (i.hasNext()) { - FluidStack fstack = (FluidStack) i.next(); - var7++; - if (MachineRecipeHandler.this.getFluidOutputPosX() != null) { - if (var8 < MachineRecipeHandler.this.getFluidOutputPosX().length) { - x = MachineRecipeHandler.this.getFluidOutputPosX()[var8]; - } - if (var8 < MachineRecipeHandler.this.getFluidOutputPosY().length) { - y = MachineRecipeHandler.this.getFluidOutputPosY()[var8]; - } - var8++; - } else { - if (var7 < MachineRecipeHandler.this.getOutputPosX().length) { - x = MachineRecipeHandler.this.getOutputPosX()[var7]; - } - if (var7 < MachineRecipeHandler.this.getOutputPosY().length) { - y = MachineRecipeHandler.this.getOutputPosY()[var7]; - } - } - this.otherStacks.add(new IHLPositionedStack(fstack, x, y)); - } - } - - if (MachineRecipeHandler.this.getFluidInputPosX() != null) { - int x = MachineRecipeHandler.this.getFluidInputPosX()[0], - y = MachineRecipeHandler.this.getFluidInputPosY()[0]; - for (int i = 0; i < fluidItems.size(); i++) { - if (i < MachineRecipeHandler.this.getFluidInputPosX().length) { - x = MachineRecipeHandler.this.getFluidInputPosX()[i]; - } - if (i < MachineRecipeHandler.this.getFluidInputPosY().length) { - y = MachineRecipeHandler.this.getFluidInputPosY()[i]; - } - this.ingredients.add(new IHLPositionedStack(fluidItems.get(i), x, y)); - } - x = MachineRecipeHandler.this.getInputPosX()[0]; - y = MachineRecipeHandler.this.getInputPosY()[0]; - for (int i = 0; i < items.size(); i++) { - if (i < MachineRecipeHandler.this.getInputPosX().length) { - x = MachineRecipeHandler.this.getInputPosX()[i]; - } - if (i < MachineRecipeHandler.this.getInputPosY().length) { - y = MachineRecipeHandler.this.getInputPosY()[i]; - } - this.ingredients.add(new PositionedStack(items.get(i), x, y)); - } - } else { - int x = MachineRecipeHandler.this.getInputPosX()[0], - y = MachineRecipeHandler.this.getInputPosY()[0]; - for (int i = 0; i < fluidItems.size() + items.size(); i++) { - if (i < MachineRecipeHandler.this.getInputPosX().length) { - x = MachineRecipeHandler.this.getInputPosX()[i]; - } - if (i < MachineRecipeHandler.this.getInputPosY().length) { - y = MachineRecipeHandler.this.getInputPosY()[i]; - } - if (i < fluidItems.size()) { - this.ingredients.add(new IHLPositionedStack(fluidItems.get(i), x, y)); - } else { - this.ingredients.add(new PositionedStack(items.get(i - fluidItems.size()), x, y)); - } - } - } - if (additionalIngredients != null) { - this.ingredients.addAll(additionalIngredients); - } - } - } - } -} -- cgit v1.2.3