diff options
author | Martin Robertz <dream-master@gmx.net> | 2021-12-12 19:09:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-12 19:09:46 +0100 |
commit | 896143b96132f5ac54aa8d8f7386f27487e5e530 (patch) | |
tree | d61c1bced93b36545873414562b1dfd80718f496 /src/Java/gtPlusPlus/nei | |
parent | 9cbfc7a1bacdbe908632e0fff9ec5ad7f119e563 (diff) | |
parent | 35585d4556d85a1a9cda33cdd39b5b257e3e5215 (diff) | |
download | GT5-Unofficial-896143b96132f5ac54aa8d8f7386f27487e5e530.tar.gz GT5-Unofficial-896143b96132f5ac54aa8d8f7386f27487e5e530.tar.bz2 GT5-Unofficial-896143b96132f5ac54aa8d8f7386f27487e5e530.zip |
Merge pull request #50 from GTNewHorizons/gtnh-milling
Milling/Nuclear Sciences revamp + Lots of minor fixes
Diffstat (limited to 'src/Java/gtPlusPlus/nei')
-rw-r--r-- | src/Java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java | 666 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java | 452 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java | 422 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/GT_NEI_LFTR.java | 118 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java | 372 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java | 422 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java | 58 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/GT_NEI_RFPP.java | 515 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/GT_NEI_VacFurnace.java | 482 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/GT_NEI_multiCentriElectroFreezer.java | 554 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/NEI_GT_Config.java | 74 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/NEI_IMC_Sender.java | 27 |
12 files changed, 1138 insertions, 3024 deletions
diff --git a/src/Java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java b/src/Java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java index 2c00010a1a..de2c29db9f 100644 --- a/src/Java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java +++ b/src/Java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java @@ -2,40 +2,73 @@ package gtPlusPlus.nei; import java.awt.Point; import java.awt.Rectangle; -import java.util.*; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; import org.lwjgl.opengl.GL11; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.guihook.IContainerInputHandler; +import codechicken.nei.guihook.IContainerTooltipHandler; +import codechicken.nei.recipe.GuiCraftingRecipe; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; import cpw.mods.fml.common.event.FMLInterModComms; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.GT_Values; import gregtech.api.enums.OrePrefixes; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.objects.ItemData; -import gregtech.api.util.*; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.guihook.IContainerTooltipHandler; -import codechicken.nei.recipe.*; -import net.minecraftforge.fluids.FluidContainerRegistry; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -public class GTPP_NEI_DefaultHandler -extends TemplateRecipeHandler { +public class GTPP_NEI_DefaultHandler extends TemplateRecipeHandler { + public static final int sOffsetX = 5; public static final int sOffsetY = 11; + private SoftReference<List<CachedDefaultRecipe>> mCachedRecipes = null; + + private static final HashMap<Integer, Pair<Integer, Integer>> mInputSlotMap = new HashMap<Integer, Pair<Integer, Integer>>(); + private static final HashMap<Integer, Pair<Integer, Integer>> mOutputSlotMap = new HashMap<Integer, Pair<Integer, Integer>>(); static { GuiContainerManager.addInputHandler(new GT_RectHandler()); GuiContainerManager.addTooltipHandler(new GT_RectHandler()); + int[] aSlotX = new int[] {12, 30, 48}; + int[] aSlotY = new int[] {5, 23, 41, 64}; + // Input slots + int aIndex = 0; + for (int y=0; y<aSlotY.length;y++) { + for (int x=0; x<aSlotX.length;x++) { + mInputSlotMap.put(aIndex++, new Pair<Integer, Integer>(aSlotX[x], aSlotY[y])); + } + } + // Output slots + aSlotX = new int[] {102, 120, 138}; + aIndex = 0; + for (int y=0; y<aSlotY.length;y++) { + for (int x=0; x<aSlotX.length;x++) { + mOutputSlotMap.put(aIndex++, new Pair<Integer, Integer>(aSlotX[x], aSlotY[y])); + } + } } protected final GT_Recipe_Map mRecipeMap; @@ -66,13 +99,28 @@ extends TemplateRecipeHandler { return result; } + public List<CachedDefaultRecipe> getCache() { + List<CachedDefaultRecipe> cache; + if (mCachedRecipes == null || (cache = mCachedRecipes.get()) == null) { + cache = mRecipeMap.mRecipeList.stream() // do not use parallel stream. This is already parallelized by NEI + .filter(r -> !r.mHidden) + .sorted() + .map(temp -> {return createCachedRecipe(temp);}) + .collect(Collectors.toList()); + // while the NEI parallelize handlers, for each individual handler it still uses sequential execution model + // so we do not need any synchronization here + mCachedRecipes = new SoftReference<>(cache); + } + return cache; + } + + public CachedDefaultRecipe createCachedRecipe(GT_Recipe aRecipe) { + return new CachedDefaultRecipe(aRecipe); + } + public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOverlayIdentifier())) { - for (GT_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - this.arecipes.add(new CachedDefaultRecipe(tRecipe)); - } - } + arecipes.addAll(getCache()); } else { super.loadCraftingRecipes(outputId, results); } @@ -81,7 +129,7 @@ extends TemplateRecipeHandler { public void loadCraftingRecipes(ItemStack aResult) { ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); + ArrayList<ItemStack> tResults = new ArrayList<>(); tResults.add(aResult); tResults.add(GT_OreDictUnificator.get(true, aResult)); if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { @@ -90,30 +138,25 @@ extends TemplateRecipeHandler { } } FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); + FluidStack tFluidStack; if (tFluid != null) { + tFluidStack = tFluid; tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } } - for (GT_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tResults) { - if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } + else tFluidStack = GT_Utility.getFluidFromDisplayStack(aResult); + if (tFluidStack != null) { + tResults.addAll(GT_Utility.getContainersFromFluid(tFluidStack)); + } + for (CachedDefaultRecipe recipe : getCache()) { + if (tResults.stream().anyMatch(stack -> recipe.contains(recipe.mOutputs, stack))) + arecipes.add(recipe); } } public void loadUsageRecipes(ItemStack aInput) { ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); + + ArrayList<ItemStack> tInputs = new ArrayList<>(); tInputs.add(aInput); tInputs.add(GT_OreDictUnificator.get(false, aInput)); if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { @@ -122,24 +165,18 @@ extends TemplateRecipeHandler { } } FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); + FluidStack tFluidStack; if (tFluid != null) { + tFluidStack = tFluid; tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } } - for (GT_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tInputs) { - if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } + else tFluidStack = GT_Utility.getFluidFromDisplayStack(aInput); + if (tFluidStack != null) { + tInputs.addAll(GT_Utility.getContainersFromFluid(tFluidStack)); + } + for (CachedDefaultRecipe recipe : getCache()) { + if (tInputs.stream().anyMatch(stack -> recipe.contains(recipe.mInputs, stack))) + arecipes.add(recipe); } } @@ -167,7 +204,6 @@ extends TemplateRecipeHandler { @Override public String getGuiTexture() { - // return "gregtech:textures/gui/" + this.mRecipeMap.mUnlocalizedName + ".png"; return this.mRecipeMap.mNEIGUIPath; } @@ -201,13 +237,13 @@ extends TemplateRecipeHandler { @Override public void drawExtras(final int aRecipeIndex) { - final int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final long tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; if (tEUt != 0) { - drawText(10, 73, "Total: " + (tDuration * tEUt) + " EU", -16777216); - drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); + drawText(10, 73, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); + drawText(10, 83, "Usage: " + MathUtils.formatNumbers(tEUt) + " EU/t", -16777216); if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 93, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU", -16777216); + drawText(10, 93, "Voltage: " + MathUtils.formatNumbers(tEUt / this.mRecipeMap.mAmperage) + " EU", -16777216); drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); } else { drawText(10, 93, "Voltage: unspecified", -16777216); @@ -215,7 +251,7 @@ extends TemplateRecipeHandler { } } if (tDuration > 0) { - drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); + drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Long.valueOf(tDuration / 20))) + " secs", -16777216); } if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); @@ -243,7 +279,7 @@ extends TemplateRecipeHandler { } public boolean canHandle(final GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); + return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI))); } @Override @@ -251,10 +287,7 @@ extends TemplateRecipeHandler { if ((this.canHandle(gui)) && (currenttip.isEmpty())) { if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { currenttip.add("Recipes"); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - }*/ - + } } return currenttip; } @@ -262,9 +295,7 @@ extends TemplateRecipeHandler { private boolean transferRect(final GuiContainer gui, final boolean usage) { if (gui instanceof GT_GUIContainer_BasicMachine) { return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { - return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); - }*/ + } return false; } @@ -357,8 +388,7 @@ extends TemplateRecipeHandler { } } - public class CachedDefaultRecipe - extends TemplateRecipeHandler.CachedRecipe { + public class CachedDefaultRecipe extends TemplateRecipeHandler.CachedRecipe { public final GT_Recipe mRecipe; public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); @@ -366,442 +396,444 @@ extends TemplateRecipeHandler { public CachedDefaultRecipe(final GT_Recipe aRecipe) { super(); this.mRecipe = aRecipe; - + handleSlots(); + } + + public void handleSlots() { int tStartIndex = 0; switch (GTPP_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) { case 0: break; case 1: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 14)); } tStartIndex++; break; case 2: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 14)); } tStartIndex++; break; case 3: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 14)); } tStartIndex++; break; case 4: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 23)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 23)); } tStartIndex++; break; case 5: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 23)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 23)); } tStartIndex++; break; case 6: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 23)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 23)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 23)); } tStartIndex++; break; case 7: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 32)); } tStartIndex++; break; case 8: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 32)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 32)); } tStartIndex++; break; default: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 32)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 32)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 32)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 32)); } tStartIndex++; } - if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + if (mRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.mSpecialItems, 120, 52)); } tStartIndex = 0; switch (GTPP_NEI_DefaultHandler.this.mRecipeMap.mUsualOutputCount) { case 0: break; case 1: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; break; case 2: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; break; case 3: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; break; case 4: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; break; case 5: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; break; case 6: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; break; case 7: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, -4, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, -4, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, -4, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 32, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; break; case 8: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, -4, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, -4, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, -4, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 32, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 32, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; break; default: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, -4, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, -4, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, -4, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, 14, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 32, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 32, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 32, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 138, 32, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; } - if ((aRecipe.mFluidInputs.length > 0) && (aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 48, 52)); - if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 52)); + if ((mRecipe.mFluidInputs.length > 0) && (mRecipe.mFluidInputs[0] != null) && (mRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[0], true), 48, 52)); + if ((mRecipe.mFluidInputs.length > 1) && (mRecipe.mFluidInputs[1] != null) && (mRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[1], true), 30, 52)); } } - if (aRecipe.mFluidOutputs.length > 1) { - if (aRecipe.mFluidOutputs[0] != null && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 120, 5)); + if (mRecipe.mFluidOutputs.length > 1) { + if (mRecipe.mFluidOutputs[0] != null && (mRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[0], true), 120, 5)); } - if (aRecipe.mFluidOutputs[1] != null && (aRecipe.mFluidOutputs[1].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 5)); + if (mRecipe.mFluidOutputs[1] != null && (mRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[1], true), 138, 5)); } - if (aRecipe.mFluidOutputs.length > 2 && aRecipe.mFluidOutputs[2] != null && (aRecipe.mFluidOutputs[2].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[2], true), 102, 23)); + if (mRecipe.mFluidOutputs.length > 2 && mRecipe.mFluidOutputs[2] != null && (mRecipe.mFluidOutputs[2].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[2], true), 102, 23)); } - if (aRecipe.mFluidOutputs.length > 3 && aRecipe.mFluidOutputs[3] != null && (aRecipe.mFluidOutputs[3].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[3], true), 120, 23)); + if (mRecipe.mFluidOutputs.length > 3 && mRecipe.mFluidOutputs[3] != null && (mRecipe.mFluidOutputs[3].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[3], true), 120, 23)); } - if (aRecipe.mFluidOutputs.length > 4 && aRecipe.mFluidOutputs[4] != null && (aRecipe.mFluidOutputs[4].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[4], true), 138, 23)); + if (mRecipe.mFluidOutputs.length > 4 && mRecipe.mFluidOutputs[4] != null && (mRecipe.mFluidOutputs[4].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[4], true), 138, 23)); } - } else if ((aRecipe.mFluidOutputs.length > 0) && (aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 52)); - } - + } else if ((mRecipe.mFluidOutputs.length > 0) && (mRecipe.mFluidOutputs[0] != null) && (mRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[0], true), 102, 52)); + } } @Override @@ -819,4 +851,92 @@ extends TemplateRecipeHandler { return this.mOutputs; } } + + public class NoCellMultiDefaultRecipe extends CachedDefaultRecipe { + + public NoCellMultiDefaultRecipe(final GT_Recipe aRecipe) { + super(aRecipe); + + } + + @Override + public void handleSlots() { + + int aInputItemsCount = this.mRecipe.mInputs.length; + int aInputFluidsCount = this.mRecipe.mFluidInputs.length; + int aOutputItemsCount = this.mRecipe.mOutputs.length; + int aOutputFluidsCount = this.mRecipe.mFluidOutputs.length; + int aInputSlotsUsed = 0; + int aOutputSlotsUsed = 0; + int aSlotToCheck = 0; + + // Special Slot + if (mRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.mSpecialItems, 120, 52)); + } + + /* + * Items + */ + + // Upto 9 Inputs Slots + if (aInputItemsCount > 0) { + if (aInputItemsCount > 9) { + aInputItemsCount = 9; + } + for (int i=0;i<aInputItemsCount;i++) { + int x = mInputSlotMap.get(aInputSlotsUsed).getKey(); + int y = mInputSlotMap.get(aInputSlotsUsed).getValue(); + ItemStack aRepStack = mRecipe.getRepresentativeInput(aSlotToCheck++); + if (aRepStack != null) { + this.mInputs.add(new FixedPositionedStack(aRepStack, x, y)); + aInputSlotsUsed++; + } + } + } + aSlotToCheck = 0; + // Upto 9 Output Slots + if (aOutputItemsCount > 0) { + if (aOutputItemsCount > 9) { + aOutputItemsCount = 9; + } + for (int i=0;i<aOutputItemsCount;i++) { + int x = mOutputSlotMap.get(aOutputSlotsUsed).getKey(); + int y = mOutputSlotMap.get(aOutputSlotsUsed).getValue(); + ItemStack aRepStack = mRecipe.getOutput(aSlotToCheck++); + if (aRepStack != null) { + this.mOutputs.add(new FixedPositionedStack(aRepStack, x, y, mRecipe.getOutputChance(aSlotToCheck))); + aOutputSlotsUsed++; + } + } + } + + /* + * Fluids + */ + + // Upto 9 Fluid Inputs Slots + aSlotToCheck = aInputSlotsUsed; + if (aInputFluidsCount > 0) { + for (int i=0;i<aInputFluidsCount;i++) { + int x = mInputSlotMap.get(aSlotToCheck).getKey(); + int y = mInputSlotMap.get(aSlotToCheck).getValue(); + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[i], true), x, y)); + aSlotToCheck++; + aInputSlotsUsed++; + } + } + // Upto 9 Fluid Outputs Slots + aSlotToCheck = aOutputSlotsUsed; + if (aOutputFluidsCount > 0) { + for (int i=0;i<aOutputFluidsCount;i++) { + int x = mOutputSlotMap.get(aSlotToCheck).getKey(); + int y = mOutputSlotMap.get(aSlotToCheck).getValue(); + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[i], true), x, y)); + aSlotToCheck++; + aOutputSlotsUsed++; + } + } + } + } } diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java b/src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java index c4eff20a27..ca12e1c740 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java @@ -1,63 +1,14 @@ package gtPlusPlus.nei; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.*; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.guihook.IContainerTooltipHandler; -import codechicken.nei.recipe.*; -import cpw.mods.fml.common.event.FMLInterModComms; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.GT_GUIContainer_BasicMachine; -import gregtech.api.objects.ItemData; -import gregtech.api.util.*; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import codechicken.nei.recipe.TemplateRecipeHandler; import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -public class GT_NEI_FlotationCell -extends TemplateRecipeHandler { - public static final int sOffsetX = 5; - public static final int sOffsetY = 11; - - static { - GuiContainerManager.addInputHandler(new GT_RectHandler()); - GuiContainerManager.addTooltipHandler(new GT_RectHandler()); - } +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; - protected GT_Recipe_Map mRecipeMap; +public class GT_NEI_FlotationCell extends GTPP_NEI_DefaultHandler { public GT_NEI_FlotationCell() { - this.mRecipeMap = GTPP_Recipe_Map.sFlotationCellRecipes; - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getRecipeMapName(), new Object[0])); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getRecipeMapName()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } - - public List<GTPP_Recipe> getSortedRecipes() { - List<GTPP_Recipe> result = new ArrayList(this.mRecipeMap.mRecipeList); - Collections.sort(result); - return result; - } - - public static void drawText(final int aX, final int aY, final String aString, final int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); + super(GTPP_Recipe_Map.sFlotationCellRecipes); } @Override @@ -66,397 +17,84 @@ extends TemplateRecipeHandler { } @Override - public void loadCraftingRecipes(final String outputId, final Object... results) { - if (outputId.equals(getRecipeMapName())) { - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - this.arecipes.add(new CachedDefaultRecipe(tRecipe)); - } - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(final ItemStack aResult) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - - ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); - tResults.add(aResult); - tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); - if (tFluid != null) { - tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tResults) { - if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public void loadUsageRecipes(ItemStack aInput) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - - ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); - tInputs.add(aInput); - tInputs.add(GT_OreDictUnificator.get(false, aInput)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); - if (tFluid != null) { - tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tInputs) { - if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public String getRecipeMapName() { - return this.mRecipeMap.mNEIName; - } - - @Override - public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; - } - - @Override - public void drawBackground(final int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); - } - - @Override - public int recipiesPerPage() { - return 1; - } - - @Override - public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); - } - - @Override - public String getGuiTexture() { - return this.mRecipeMap.mNEIGUIPath; - } - - @Override - public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { - final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if ((tObject instanceof CachedDefaultRecipe)) { - final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; - for (final PositionedStack tStack : tRecipe.mOutputs) { - if (aStack == tStack.item) { - if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { - break; - } - currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); - break; - } - } - for (final PositionedStack tStack : tRecipe.mInputs) { - if (GT_Utility.areStacksEqual(aStack, tStack.item)) { - if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || - (tStack.item.stackSize != 0)) { - break; - } - if (ItemUtils.isControlCircuit(aStack)) { - currenttip.add("Does not get consumed in the process"); - } - break; - } - } - } - return currenttip; - } - - @Override - public void drawExtras(final int aRecipeIndex) { - final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - if (tEUt != 0) { - drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); - //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); - if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); - drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); - } else { - drawText(10, 93, "Voltage: unspecified", -16777216); - drawText(10, 103, "Amperage: unspecified", -16777216); - } - } - if (tDuration > 0) { - drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); - } - //if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - //drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); - //} - } + public CachedDefaultRecipe createCachedRecipe(GT_Recipe aRecipe) { + return new FlotationCellDefaultRecipe(aRecipe); + } - public static class GT_RectHandler - implements IContainerInputHandler, IContainerTooltipHandler { - @Override - public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - if (this.canHandle(gui)) { - if (button == 0) { - return this.transferRect(gui, false); - } - if (button == 1) { - return this.transferRect(gui, true); - } - } - return false; - } + public class FlotationCellDefaultRecipe extends CachedDefaultRecipe { - @Override - public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - public boolean canHandle(final GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); + public FlotationCellDefaultRecipe(final GT_Recipe aRecipe) { + super(aRecipe); } @Override - public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) { - if ((this.canHandle(gui)) && (currenttip.isEmpty())) { - if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - }*/ + public void handleSlots() { + int tStartIndex = 0; - } - return currenttip; - } - - private boolean transferRect(final GuiContainer gui, final boolean usage) { - if (gui instanceof GT_GUIContainer_BasicMachine) { - return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { - return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); - }*/ - return false; - } - - @Override - public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) { - return currenttip; - } - - @Override - public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) { - return currenttip; - } - - @Override - public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - @Override - public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { - } - - @Override - public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - return false; - } - - @Override - public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - } - - @Override - public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { - } - } - - public class FixedPositionedStack - extends PositionedStack { - public final int mChance; - public boolean permutated = false; - - public FixedPositionedStack(final Object object, final int x, final int y) { - this(object, x, y, 0); - } - - public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { - super(object, x, y, true); - this.mChance = aChance; - } - - @Override - public void generatePermutations() { - if (this.permutated) { - return; - } - final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); - for (final ItemStack tStack : this.items) { - if (GT_Utility.isStackValid(tStack)) { - if (tStack.getItemDamage() == 32767) { - final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); - if (!permutations.isEmpty()) { - ItemStack stack; - for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { - stack = i$.next(); - } - } else { - final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); - base.stackTagCompound = tStack.stackTagCompound; - tDisplayStacks.add(base); - } - } else { - tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); - } - } - } - this.items = (tDisplayStacks.toArray(new ItemStack[0])); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; - } - this.permutated = true; - this.setPermutationToRender(0); - } - } - - public class CachedDefaultRecipe - extends TemplateRecipeHandler.CachedRecipe { - public final GT_Recipe mRecipe; - public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); - public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); - - public CachedDefaultRecipe(final GT_Recipe aRecipe) { - super(); - this.mRecipe = aRecipe; - - int tStartIndex = 0; - - - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 5)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 23)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 23)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 23)); } tStartIndex++; - if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + if (mRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.mSpecialItems, 120, 52)); } tStartIndex = 0; //Four Output Slots - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if ((aRecipe.mFluidInputs.length > 0) && (aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 30, 52)); - if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 48, 52)); + if ((mRecipe.mFluidInputs.length > 0) && (mRecipe.mFluidInputs[0] != null) && (mRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[0], true), 30, 52)); + if ((mRecipe.mFluidInputs.length > 1) && (mRecipe.mFluidInputs[1] != null) && (mRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[1], true), 48, 52)); } } - if (aRecipe.mFluidOutputs.length > 0) { - if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 52)); + if (mRecipe.mFluidOutputs.length > 0) { + if ((mRecipe.mFluidOutputs[0] != null) && (mRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[0], true), 102, 52)); } - if ((aRecipe.mFluidOutputs.length > 1) && (aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 120, 52)); + if ((mRecipe.mFluidOutputs.length > 1) && (mRecipe.mFluidOutputs[1] != null) && (mRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[1], true), 120, 52)); } } } - - @Override - public List<PositionedStack> getIngredients() { - return this.getCycledIngredients(GT_NEI_FlotationCell.this.cycleticks / 10, this.mInputs); - } - - @Override - public PositionedStack getResult() { - return null; - } - - @Override - public List<PositionedStack> getOtherStacks() { - return this.mOutputs; - } + } } diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java index 213d022478..7ef76f68b2 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -1,72 +1,21 @@ package gtPlusPlus.nei; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; import java.util.List; -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.guihook.IContainerTooltipHandler; -import codechicken.nei.recipe.GuiCraftingRecipe; import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.GuiUsageRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; -import cpw.mods.fml.common.event.FMLInterModComms; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.GT_GUIContainer_BasicMachine; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gregtech.api.util.GTPP_Recipe; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -public class GT_NEI_FluidReactor -extends TemplateRecipeHandler { - public static final int sOffsetX = 5; - public static final int sOffsetY = 11; - static { - GuiContainerManager.addInputHandler(new GT_RectHandler()); - GuiContainerManager.addTooltipHandler(new GT_RectHandler()); - } - - protected GTPP_Recipe_Map mRecipeMap; +public class GT_NEI_FluidReactor extends GTPP_NEI_DefaultHandler { public GT_NEI_FluidReactor() { - this.mRecipeMap = GTPP_Recipe_Map.sChemicalPlantRecipes; - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getRecipeMapName(), new Object[0])); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getRecipeMapName()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } - - public List<GTPP_Recipe> getSortedRecipes() { - List<GTPP_Recipe> result = new ArrayList(this.mRecipeMap.mRecipeList); - Collections.sort(result); - return result; - } - - public static void drawText(final int aX, final int aY, final String aString, final int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); + super(GTPP_Recipe_Map.sChemicalPlantRecipes); } @Override @@ -75,125 +24,15 @@ extends TemplateRecipeHandler { } @Override - public void loadCraftingRecipes(final String outputId, final Object... results) { - if (outputId.equals(getRecipeMapName())) { - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - this.arecipes.add(new CachedDefaultRecipe(tRecipe)); - } - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(final ItemStack aResult) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - - ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); - tResults.add(aResult); - tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); - if (tFluid != null) { - tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tResults) { - if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public void loadUsageRecipes(ItemStack aInput) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - - ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); - tInputs.add(aInput); - tInputs.add(GT_OreDictUnificator.get(false, aInput)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); - if (tFluid != null) { - tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tInputs) { - if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public String getRecipeMapName() { - return this.mRecipeMap.mNEIName; - } - - @Override - public String getOverlayIdentifier() { - //return this.mRecipeMap.mNEIName; - return ""; - } - - @Override - public void drawBackground(final int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); - } - - @Override - public int recipiesPerPage() { - return 1; - } - - @Override - public String getRecipeName() { - //return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); - return " Chem Plant"; - } - - @Override - public String getGuiTexture() { - return CORE.MODID+":textures/gui/FluidReactor.png"; - } + public CachedDefaultRecipe createCachedRecipe(GT_Recipe aRecipe) { + return new ChemPlantDefaultRecipe(aRecipe); + } @Override public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if ((tObject instanceof CachedDefaultRecipe)) { - final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + if ((tObject instanceof ChemPlantDefaultRecipe)) { + final ChemPlantDefaultRecipe tRecipe = (ChemPlantDefaultRecipe) tObject; for (final PositionedStack tStack : tRecipe.mOutputs) { if (aStack == tStack.item) { if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { @@ -225,13 +64,13 @@ extends TemplateRecipeHandler { @Override public void drawExtras(final int aRecipeIndex) { - final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + final long tEUt = ((ChemPlantDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final int tDuration = ((ChemPlantDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; if (tEUt != 0) { - drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); + drawText(10, 73, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); + drawText(10, 83, "Voltage: " + MathUtils.formatNumbers((tEUt / this.mRecipeMap.mAmperage)) + " EU/t", -16777216); drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); } else { drawText(10, 93, "Voltage: unspecified", -16777216); @@ -239,10 +78,10 @@ extends TemplateRecipeHandler { } } if (tDuration > 0) { - drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); + drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Integer.valueOf(tDuration / 20))) + " secs", -16777216); } if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - int aTier = (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue); + int aTier = (((ChemPlantDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue); String aTierMaterial = " - "; if (aTier <= 0) { aTierMaterial += "Bronze"; @@ -269,239 +108,88 @@ extends TemplateRecipeHandler { aTierMaterial += "Botmium"; } - drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + aTierMaterial, -16777216); + drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((ChemPlantDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + aTierMaterial, -16777216); } } - public static class GT_RectHandler - implements IContainerInputHandler, IContainerTooltipHandler { - @Override - public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - if (this.canHandle(gui)) { - if (button == 0) { - return this.transferRect(gui, false); - } - if (button == 1) { - return this.transferRect(gui, true); - } - } - return false; - } + public class ChemPlantDefaultRecipe extends CachedDefaultRecipe { - @Override - public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; + public ChemPlantDefaultRecipe(final GT_Recipe aRecipe) { + super(aRecipe); } - - public boolean canHandle(final GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); - } - - @Override - public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) { - if ((this.canHandle(gui)) && (currenttip.isEmpty())) { - if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - }*/ - - } - return currenttip; - } - - private boolean transferRect(final GuiContainer gui, final boolean usage) { - if (gui instanceof GT_GUIContainer_BasicMachine) { - return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { - return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); - }*/ - return false; - } - - @Override - public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) { - return currenttip; - } - - @Override - public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) { - return currenttip; - } - + @Override - public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - @Override - public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { - } - - @Override - public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - return false; - } - - @Override - public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - } - - @Override - public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { - } - } - - public class FixedPositionedStack - extends PositionedStack { - public final int mChance; - public boolean permutated = false; - - public FixedPositionedStack(final Object object, final int x, final int y) { - this(object, x, y, 0); - } - - public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { - super(object, x, y, true); - this.mChance = aChance; - } - - @Override - public void generatePermutations() { - if (this.permutated) { - return; - } - final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); - for (final ItemStack tStack : this.items) { - if (GT_Utility.isStackValid(tStack)) { - if (tStack.getItemDamage() == 32767) { - final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); - if (!permutations.isEmpty()) { - ItemStack stack; - for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { - stack = i$.next(); - } - } else { - final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); - base.stackTagCompound = tStack.stackTagCompound; - tDisplayStacks.add(base); - } - } else { - tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); - } - } - } - this.items = (tDisplayStacks.toArray(new ItemStack[0])); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; - } - this.permutated = true; - this.setPermutationToRender(0); - } - } - - public class CachedDefaultRecipe - extends TemplateRecipeHandler.CachedRecipe { - public final GT_Recipe mRecipe; - public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); - public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); - - public CachedDefaultRecipe(final GT_Recipe aRecipe) { - super(); - this.mRecipe = aRecipe; - - int tStartIndex = 0; + public void handleSlots() { + int tStartIndex = 0; // Four Input Slots - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 3, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 3, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 21, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 21, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 39, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 39, -4)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 57, -4)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 57, -4)); } tStartIndex++; - if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + if (mRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.mSpecialItems, 120, 52)); } tStartIndex = 0; //Four Output Slots - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; //New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for outputs an the code above for 9 input slots.) - if (aRecipe.mFluidInputs.length >= 1) { - if ((aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 3, 31)); + if (mRecipe.mFluidInputs.length >= 1) { + if ((mRecipe.mFluidInputs[0] != null) && (mRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[0], true), 3, 31)); } - if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 21, 31)); + if ((mRecipe.mFluidInputs.length > 1) && (mRecipe.mFluidInputs[1] != null) && (mRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[1], true), 21, 31)); } - if ((aRecipe.mFluidInputs.length > 2) && (aRecipe.mFluidInputs[2] != null) && (aRecipe.mFluidInputs[2].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 39, 31)); + if ((mRecipe.mFluidInputs.length > 2) && (mRecipe.mFluidInputs[2] != null) && (mRecipe.mFluidInputs[2].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[2], true), 39, 31)); } - if ((aRecipe.mFluidInputs.length > 3) && (aRecipe.mFluidInputs[3] != null) && (aRecipe.mFluidInputs[3].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 57, 31)); + if ((mRecipe.mFluidInputs.length > 3) && (mRecipe.mFluidInputs[3] != null) && (mRecipe.mFluidInputs[3].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[3], true), 57, 31)); } } - if (aRecipe.mFluidOutputs.length > 0) { - if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 138, 5)); + if (mRecipe.mFluidOutputs.length > 0) { + if ((mRecipe.mFluidOutputs[0] != null) && (mRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[0], true), 138, 5)); } - if ((aRecipe.mFluidOutputs.length > 1) && (aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 23)); + if ((mRecipe.mFluidOutputs.length > 1) && (mRecipe.mFluidOutputs[1] != null) && (mRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[1], true), 138, 23)); } } - } - - @Override - public List<PositionedStack> getIngredients() { - return this.getCycledIngredients(GT_NEI_FluidReactor.this.cycleticks / 10, this.mInputs); - } - - @Override - public PositionedStack getResult() { - return null; - } - - @Override - public List<PositionedStack> getOtherStacks() { - return this.mOutputs; + } } } diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_LFTR.java b/src/Java/gtPlusPlus/nei/GT_NEI_LFTR.java new file mode 100644 index 0000000000..dd7338eccd --- /dev/null +++ b/src/Java/gtPlusPlus/nei/GT_NEI_LFTR.java @@ -0,0 +1,118 @@ +package gtPlusPlus.nei; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.recipe.TemplateRecipeHandler; +import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.util.math.MathUtils; + +public class GT_NEI_LFTR extends GTPP_NEI_DefaultHandler { + + public GT_NEI_LFTR() { + super(GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes); + } + + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_LFTR(); + } + + @Override + public CachedDefaultRecipe createCachedRecipe(GT_Recipe aRecipe) { + return new LFTRDefaultRecipe(aRecipe); + } + + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 89); + } + + @Override + public void drawExtras(final int aRecipeIndex) { + final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + drawText(10, 83, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Integer.valueOf(tDuration / 20))) + " secs", -16777216); + drawText(10, 93, this.mRecipeMap.mNEISpecialValuePre + MathUtils.formatNumbers((((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)) + this.mRecipeMap.mNEISpecialValuePost, -16777216); + drawText(10, 103, "Dynamo: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); + drawText(10, 113, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt * 4)) + " EU", -16777216); + } + + public class LFTRDefaultRecipe extends CachedDefaultRecipe { + + public LFTRDefaultRecipe(final GT_Recipe aRecipe) { + super(aRecipe); + } + + @Override + public void handleSlots() { + int tStartIndex = 0; + if (mRecipe.mFluidInputs.length > 0) { + if ((mRecipe.mFluidInputs[0] != null) && (mRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[0], true), 12, 5)); + } + if ((mRecipe.mFluidInputs.length > 1) && (mRecipe.mFluidInputs[1] != null) && (mRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[1], true), 30, 5)); + } + if ((mRecipe.mFluidInputs.length > 2) && (mRecipe.mFluidInputs[2] != null) && (mRecipe.mFluidInputs[2].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[2], true), 48, 5)); + } + if ((mRecipe.mFluidInputs.length > 3) && (mRecipe.mFluidInputs[3] != null) && (mRecipe.mFluidInputs[3].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[3], true), 12, 23)); + } + if ((mRecipe.mFluidInputs.length > 4) && (mRecipe.mFluidInputs[4] != null) && (mRecipe.mFluidInputs[4].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[4], true), 30, 23)); + } + if ((mRecipe.mFluidInputs.length > 5) && (mRecipe.mFluidInputs[5] != null) && (mRecipe.mFluidInputs[5].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[5], true), 48, 23)); + } + if ((mRecipe.mFluidInputs.length > 6) && (mRecipe.mFluidInputs[6] != null) && (mRecipe.mFluidInputs[6].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[6], true), 12, 41)); + } + if ((mRecipe.mFluidInputs.length > 7) && (mRecipe.mFluidInputs[7] != null) && (mRecipe.mFluidInputs[7].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[7], true), 30, 41)); + } + if ((mRecipe.mFluidInputs.length > 8) && (mRecipe.mFluidInputs[8] != null) && (mRecipe.mFluidInputs[8].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[8], true), 48, 41)); + } + } + + tStartIndex = 0; + if (mRecipe.mFluidOutputs.length > 0) { + if ((mRecipe.mFluidOutputs[0] != null) && (mRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[0], true), 102, 5, mRecipe.getOutputChance(tStartIndex++))); + } + if ((mRecipe.mFluidOutputs.length > 1) && (mRecipe.mFluidOutputs[1] != null) && (mRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[1], true), 120, 5, mRecipe.getOutputChance(tStartIndex++))); + } + if ((mRecipe.mFluidOutputs.length > 2) && (mRecipe.mFluidOutputs[2] != null) && (mRecipe.mFluidOutputs[2].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[2], true), 138, 5, mRecipe.getOutputChance(tStartIndex++))); + } + if ((mRecipe.mFluidOutputs.length > 3) && (mRecipe.mFluidOutputs[3] != null) && (mRecipe.mFluidOutputs[3].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[3], true), 102, 23, mRecipe.getOutputChance(tStartIndex++))); + } + if ((mRecipe.mFluidOutputs.length > 4) && (mRecipe.mFluidOutputs[4] != null) && (mRecipe.mFluidOutputs[4].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[4], true), 120, 23, mRecipe.getOutputChance(tStartIndex++))); + } + if ((mRecipe.mFluidOutputs.length > 5) && (mRecipe.mFluidOutputs[5] != null) && (mRecipe.mFluidOutputs[5].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[5], true), 138, 23, mRecipe.getOutputChance(tStartIndex++))); + } + if ((mRecipe.mFluidOutputs.length > 6) && (mRecipe.mFluidOutputs[6] != null) && (mRecipe.mFluidOutputs[6].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[6], true), 102, 41, mRecipe.getOutputChance(tStartIndex++))); + } + if ((mRecipe.mFluidOutputs.length > 7) && (mRecipe.mFluidOutputs[7] != null) && (mRecipe.mFluidOutputs[7].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[7], true), 120, 41, mRecipe.getOutputChance(tStartIndex++))); + } + if ((mRecipe.mFluidOutputs.length > 8) && (mRecipe.mFluidOutputs[8] != null) && (mRecipe.mFluidOutputs[8].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[8], true), 138, 41, mRecipe.getOutputChance(tStartIndex++))); + } + } + + } + + } +} diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java b/src/Java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java new file mode 100644 index 0000000000..c9f9f0722a --- /dev/null +++ b/src/Java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java @@ -0,0 +1,372 @@ +package gtPlusPlus.nei; + +import java.awt.Rectangle; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.GuiCraftingRecipe; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; +import cpw.mods.fml.common.event.FMLInterModComms; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.objects.ItemData; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.GasSpargingRecipe; +import gregtech.api.util.GasSpargingRecipeMap; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class GT_NEI_LFTR_Sparging extends TemplateRecipeHandler { + + public static final String mNEIName = GasSpargingRecipeMap.mNEIDisplayName; + private SoftReference<List<GasSpargingRecipeNEI>> mCachedRecipes = null; + + public GT_NEI_LFTR_Sparging() { + this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getOverlayIdentifier(), new Object[0])); + if (!NEI_GT_Config.sIsAdded) { + FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } + + public String getRecipeName() { + return mNEIName; + } + + public String getGuiTexture() { + return GasSpargingRecipeMap.mNEIGUIPath; + } + + public String getOverlayIdentifier() { + return gregtech.api.util.GasSpargingRecipeMap.mUnlocalizedName; + } + + public int recipiesPerPage() { + return 1; + } + + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 68); + } + + public void loadTransferRects() { + this.transferRects.add(new RecipeTransferRect(new Rectangle(72, 14, 22, 16), getRecipeName(), new Object[0])); + } + + public List<GasSpargingRecipeNEI> getCache() { + List<GasSpargingRecipeNEI> cache; + if (mCachedRecipes == null || (cache = mCachedRecipes.get()) == null) { + cache = GasSpargingRecipeMap.mRecipes.stream() // do not use parallel stream. This is already parallelized by NEI + .sorted() + .map(temp -> {return createCachedRecipe(temp);}) + .collect(Collectors.toList()); + // while the NEI parallelize handlers, for each individual handler it still uses sequential execution model + // so we do not need any synchronization here + mCachedRecipes = new SoftReference<>(cache); + } + return cache; + } + + public GasSpargingRecipeNEI createCachedRecipe(GasSpargingRecipe aRecipe) { + return new GasSpargingRecipeNEI(aRecipe); + } + + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier())) { + arecipes.addAll(getCache()); + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + public void loadCraftingRecipes(ItemStack aResult) { + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); + + ArrayList<ItemStack> tResults = new ArrayList<>(); + tResults.add(aResult); + tResults.add(GT_OreDictUnificator.get(true, aResult)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); + FluidStack tFluidStack; + if (tFluid != null) { + tFluidStack = tFluid; + tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + } + else tFluidStack = GT_Utility.getFluidFromDisplayStack(aResult); + if (tFluidStack != null) { + tResults.addAll(GT_Utility.getContainersFromFluid(tFluidStack)); + } + for (GasSpargingRecipeNEI recipe : getCache()) { + if (tResults.stream().anyMatch(stack -> recipe.contains(recipe.mOutputs, stack))) + arecipes.add(recipe); + } + } + + public void loadUsageRecipes(ItemStack aInput) { + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); + + ArrayList<ItemStack> tInputs = new ArrayList<>(); + tInputs.add(aInput); + tInputs.add(GT_OreDictUnificator.get(false, aInput)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); + FluidStack tFluidStack; + if (tFluid != null) { + tFluidStack = tFluid; + tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + } + else tFluidStack = GT_Utility.getFluidFromDisplayStack(aInput); + if (tFluidStack != null) { + tInputs.addAll(GT_Utility.getContainersFromFluid(tFluidStack)); + } + for (GasSpargingRecipeNEI recipe : getCache()) { + if (tInputs.stream().anyMatch(stack -> recipe.contains(recipe.mInputs, stack))) + arecipes.add(recipe); + } + } + + public void drawExtras(int aRecipeIndex) { + final long tEUt = ((GasSpargingRecipeNEI) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final long tDuration = ((GasSpargingRecipeNEI) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + GT_NEI_LFTR.drawText(10, 73, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); + GT_NEI_LFTR.drawText(10, 83, "Usage: " + MathUtils.formatNumbers(tEUt) + " EU/t", -16777216); + GT_NEI_LFTR.drawText(10, 93, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Long.valueOf(tDuration / 20))) + " secs", -16777216); + GT_NEI_LFTR.drawText(10, 103, "Gas not used to sparge is", -16777216); + GT_NEI_LFTR.drawText(10, 113, "returned alongside outputs.", -16777216); + } + + @Override + public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { + final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if ((tObject instanceof GasSpargingRecipeNEI)) { + final GasSpargingRecipeNEI tRecipe = (GasSpargingRecipeNEI) tObject; + ItemStack aSpargeInput = tRecipe.mOutputs.get(0).item; + ItemStack aSpentFuel = tRecipe.mOutputs.get(1).item; + for (final PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if (ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) { + if (GT_Utility.areStacksEqual(aStack, aSpentFuel, true)) { + break; + } + if (GT_Utility.areStacksEqual(aStack, aSpargeInput, true)) { + currenttip.add("The amount returned is the remainder after all other outputs."); + } + currenttip.add("Maximum Output: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "L"); + break; + } + break; + } + } + for (final PositionedStack tStack : tRecipe.mInputs) { + if (GT_Utility.areStacksEqual(aStack, tStack.item)) { + if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || + (tStack.item.stackSize != 0)) { + break; + } + if (ItemUtils.isControlCircuit(aStack)) { + currenttip.add("Does not get consumed in the process"); + } + break; + } + } + } + return currenttip; + } + + public class FixedPositionedStack + extends PositionedStack { + public final int mChance; + public boolean permutated = false; + + public FixedPositionedStack(final Object object, final int x, final int y) { + this(object, x, y, 0); + } + + public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { + super(object, x, y, true); + this.mChance = aChance; + } + + @Override + public void generatePermutations() { + if (this.permutated) { + return; + } + final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); + for (final ItemStack tStack : this.items) { + if (GT_Utility.isStackValid(tStack)) { + if (tStack.getItemDamage() == 32767) { + final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + if (!permutations.isEmpty()) { + ItemStack stack; + for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { + stack = i$.next(); + } + } else { + final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); + base.stackTagCompound = tStack.stackTagCompound; + tDisplayStacks.add(base); + } + } else { + tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); + } + } + } + this.items = (tDisplayStacks.toArray(new ItemStack[0])); + if (this.items.length == 0) { + this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; + } + this.permutated = true; + this.setPermutationToRender(0); + } + } + + public class GasSpargingRecipeNEI extends CachedRecipe implements Comparable<CachedRecipe> { + + public final GasSpargingRecipe mRecipe; + public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); + public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); + + public GasSpargingRecipeNEI(GasSpargingRecipe tRecipe) { + super(); + this.mRecipe = tRecipe; + int tStartIndex = 0; + if (tRecipe.mFluidInputs.length > 0) { + if ((tRecipe.mFluidInputs[0] != null) && (tRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[0], true), 30, 5)); + } + if ((tRecipe.mFluidInputs.length > 1) && (tRecipe.mFluidInputs[1] != null) && (tRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[1], true), 12, 5)); + } + if ((tRecipe.mFluidInputs.length > 2) && (tRecipe.mFluidInputs[2] != null) && (tRecipe.mFluidInputs[2].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[2], true), 48, 5)); + } + if ((tRecipe.mFluidInputs.length > 3) && (tRecipe.mFluidInputs[3] != null) && (tRecipe.mFluidInputs[3].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[3], true), 12, 23)); + } + if ((tRecipe.mFluidInputs.length > 4) && (tRecipe.mFluidInputs[4] != null) && (tRecipe.mFluidInputs[4].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[4], true), 30, 23)); + } + if ((tRecipe.mFluidInputs.length > 5) && (tRecipe.mFluidInputs[5] != null) && (tRecipe.mFluidInputs[5].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[5], true), 48, 23)); + } + if ((tRecipe.mFluidInputs.length > 6) && (tRecipe.mFluidInputs[6] != null) && (tRecipe.mFluidInputs[6].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[6], true), 12, 41)); + } + if ((tRecipe.mFluidInputs.length > 7) && (tRecipe.mFluidInputs[7] != null) && (tRecipe.mFluidInputs[7].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[7], true), 30, 41)); + } + if ((tRecipe.mFluidInputs.length > 8) && (tRecipe.mFluidInputs[8] != null) && (tRecipe.mFluidInputs[8].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[8], true), 48, 41)); + } + } + + tStartIndex = 0; + if (tRecipe.mFluidOutputs.length > 0) { + if ((tRecipe.mFluidOutputs[0] != null) && (tRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[0], false), 120, 5, tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 1) && (tRecipe.mFluidOutputs[1] != null) && (tRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[1], true), 102, 5, tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 2) && (tRecipe.mFluidOutputs[2] != null) && (tRecipe.mFluidOutputs[2].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[2], false), 138, 5, tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 3) && (tRecipe.mFluidOutputs[3] != null) && (tRecipe.mFluidOutputs[3].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[3], false), 102, 23, tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 4) && (tRecipe.mFluidOutputs[4] != null) && (tRecipe.mFluidOutputs[4].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[4], false), 120, 23, tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 5) && (tRecipe.mFluidOutputs[5] != null) && (tRecipe.mFluidOutputs[5].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[5], false), 138, 23, tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 6) && (tRecipe.mFluidOutputs[6] != null) && (tRecipe.mFluidOutputs[6].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[6], false), 102, 41, tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 7) && (tRecipe.mFluidOutputs[7] != null) && (tRecipe.mFluidOutputs[7].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[7], false), 120, 41, tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 8) && (tRecipe.mFluidOutputs[8] != null) && (tRecipe.mFluidOutputs[8].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[8], false), 138, 41, tRecipe.getMaxOutput(tStartIndex++))); + } + } + } + + @Override + public int compareTo(CachedRecipe o) { + boolean b = GasSpargingRecipeNEI.class.isInstance(o); + if (b) { + GasSpargingRecipeNEI p = (GasSpargingRecipeNEI) o; + if (p.mOutputs.size() > this.mOutputs.size()) { + return 1; + } else if (p.mOutputs.size() == this.mOutputs.size()) { + return 0; + } else { + return -1; + } + } + return 0; + } + + @Override + public boolean equals(Object obj) { + if (obj != null) { + if (GasSpargingRecipeNEI.class.isInstance(obj)) { + GasSpargingRecipeNEI p = (GasSpargingRecipeNEI) obj; + if (p != null) { + if (GT_Utility.areStacksEqual(p.mInputs.get(0).item, this.mInputs.get(0).item, true)) { + if (p.mOutputs.size() == this.mOutputs.size()) { + return true; + } + } + } + } + } + return false; + } + + @Override + public List<PositionedStack> getIngredients() { + return this.getCycledIngredients(GT_NEI_LFTR_Sparging.this.cycleticks / 10, this.mInputs); + } + + @Override + public PositionedStack getResult() { + return null; + } + + @Override + public List<PositionedStack> getOtherStacks() { + return this.mOutputs; + } + + + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java b/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java index 8aea87b6d4..5d09b9003f 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_MillingMachine.java @@ -1,73 +1,20 @@ package gtPlusPlus.nei; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; import java.util.List; -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.guihook.IContainerTooltipHandler; -import codechicken.nei.recipe.GuiCraftingRecipe; import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.GuiUsageRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; -import cpw.mods.fml.common.event.FMLInterModComms; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.GT_GUIContainer_BasicMachine; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; -import gregtech.api.util.GTPP_Recipe; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -public class GT_NEI_MillingMachine -extends TemplateRecipeHandler { - public static final int sOffsetX = 5; - public static final int sOffsetY = 11; - - static { - GuiContainerManager.addInputHandler(new GT_RectHandler()); - GuiContainerManager.addTooltipHandler(new GT_RectHandler()); - } - - protected GT_Recipe_Map mRecipeMap; +public class GT_NEI_MillingMachine extends GTPP_NEI_DefaultHandler { public GT_NEI_MillingMachine() { - this.mRecipeMap = GTPP_Recipe_Map.sOreMillRecipes; - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getRecipeMapName(), new Object[0])); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getRecipeMapName()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } - - public List<GTPP_Recipe> getSortedRecipes() { - List<GTPP_Recipe> result = new ArrayList(this.mRecipeMap.mRecipeList); - Collections.sort(result); - return result; - } - - public static void drawText(final int aX, final int aY, final String aString, final int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); + super(GTPP_Recipe_Map.sOreMillRecipes); } @Override @@ -76,118 +23,10 @@ extends TemplateRecipeHandler { } @Override - public void loadCraftingRecipes(final String outputId, final Object... results) { - if (outputId.equals(getRecipeMapName())) { - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - this.arecipes.add(new CachedDefaultRecipe(tRecipe)); - } - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(final ItemStack aResult) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - - ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); - tResults.add(aResult); - tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); - if (tFluid != null) { - tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tResults) { - if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public void loadUsageRecipes(ItemStack aInput) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - - ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); - tInputs.add(aInput); - tInputs.add(GT_OreDictUnificator.get(false, aInput)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); - if (tFluid != null) { - tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tInputs) { - if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public String getRecipeMapName() { - return this.mRecipeMap.mNEIName; - } - - @Override - public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; - } - - @Override - public void drawBackground(final int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); - } - - @Override - public int recipiesPerPage() { - return 1; - } - - @Override - public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); - } - - @Override - public String getGuiTexture() { - return this.mRecipeMap.mNEIGUIPath; - } - + public CachedDefaultRecipe createCachedRecipe(GT_Recipe aRecipe) { + return new MillingDefaultRecipe(aRecipe); + } + @Override public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); @@ -221,252 +60,77 @@ extends TemplateRecipeHandler { return currenttip; } - @Override - public void drawExtras(final int aRecipeIndex) { - final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - if (tEUt != 0) { - drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); - //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); - if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); - drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); - } else { - drawText(10, 93, "Voltage: unspecified", -16777216); - drawText(10, 103, "Amperage: unspecified", -16777216); - } - } - if (tDuration > 0) { - drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); - } - if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); - } - } - - public static class GT_RectHandler - implements IContainerInputHandler, IContainerTooltipHandler { - @Override - public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - if (this.canHandle(gui)) { - if (button == 0) { - return this.transferRect(gui, false); - } - if (button == 1) { - return this.transferRect(gui, true); - } - } - return false; - } - - @Override - public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - public boolean canHandle(final GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); - } - - @Override - public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) { - if ((this.canHandle(gui)) && (currenttip.isEmpty())) { - if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - }*/ - - } - return currenttip; - } - - private boolean transferRect(final GuiContainer gui, final boolean usage) { - if (gui instanceof GT_GUIContainer_BasicMachine) { - return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { - return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); - }*/ - return false; - } - - @Override - public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) { - return currenttip; - } - - @Override - public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) { - return currenttip; - } - - @Override - public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - @Override - public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { - } - - @Override - public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } + public class MillingDefaultRecipe extends CachedDefaultRecipe { - @Override - public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - return false; + public MillingDefaultRecipe(final GT_Recipe aRecipe) { + super(aRecipe); } - + @Override - public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - } - - @Override - public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { - } - } - - public class FixedPositionedStack - extends PositionedStack { - public final int mChance; - public boolean permutated = false; - - public FixedPositionedStack(final Object object, final int x, final int y) { - this(object, x, y, 0); - } - - public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { - super(object, x, y, true); - this.mChance = aChance; - } - - @Override - public void generatePermutations() { - if (this.permutated) { - return; - } - final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); - for (final ItemStack tStack : this.items) { - if (GT_Utility.isStackValid(tStack)) { - if (tStack.getItemDamage() == 32767) { - final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); - if (!permutations.isEmpty()) { - ItemStack stack; - for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { - stack = i$.next(); - } - } else { - final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); - base.stackTagCompound = tStack.stackTagCompound; - tDisplayStacks.add(base); - } - } else { - tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); - } - } - } - this.items = (tDisplayStacks.toArray(new ItemStack[0])); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; - } - this.permutated = true; - this.setPermutationToRender(0); - } - } + public void handleSlots() { + int tStartIndex = 0; - public class CachedDefaultRecipe - extends TemplateRecipeHandler.CachedRecipe { - public final GT_Recipe mRecipe; - public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); - public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); - - public CachedDefaultRecipe(final GT_Recipe aRecipe) { - super(); - this.mRecipe = aRecipe; - - int tStartIndex = 0; - - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 12, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 30, 14)); } tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + if (mRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.getRepresentativeInput(tStartIndex), 48, 14)); } tStartIndex++; - if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + if (mRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.mSpecialItems, 120, 52)); } tStartIndex = 0; //Four Output Slots - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 5, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 102, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + if (mRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(mRecipe.getOutput(tStartIndex), 120, 23, mRecipe.getOutputChance(tStartIndex))); } tStartIndex++; //New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for outputs an the code above for 9 input slots.) - if (aRecipe.mFluidInputs.length >= 1) { - if ((aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 3, 31)); + if (mRecipe.mFluidInputs.length >= 1) { + if ((mRecipe.mFluidInputs[0] != null) && (mRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[0], true), 3, 31)); } - if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 21, 31)); + if ((mRecipe.mFluidInputs.length > 1) && (mRecipe.mFluidInputs[1] != null) && (mRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[1], true), 21, 31)); } - if ((aRecipe.mFluidInputs.length > 2) && (aRecipe.mFluidInputs[2] != null) && (aRecipe.mFluidInputs[2].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 39, 31)); + if ((mRecipe.mFluidInputs.length > 2) && (mRecipe.mFluidInputs[2] != null) && (mRecipe.mFluidInputs[2].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[2], true), 39, 31)); } - if ((aRecipe.mFluidInputs.length > 3) && (aRecipe.mFluidInputs[3] != null) && (aRecipe.mFluidInputs[3].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 57, 31)); + if ((mRecipe.mFluidInputs.length > 3) && (mRecipe.mFluidInputs[3] != null) && (mRecipe.mFluidInputs[3].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[3], true), 57, 31)); } } - if (aRecipe.mFluidOutputs.length > 0) { - if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 138, 5)); + if (mRecipe.mFluidOutputs.length > 0) { + if ((mRecipe.mFluidOutputs[0] != null) && (mRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[0], true), 138, 5)); } - if ((aRecipe.mFluidOutputs.length > 1) && (aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 23)); + if ((mRecipe.mFluidOutputs.length > 1) && (mRecipe.mFluidOutputs[1] != null) && (mRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidOutputs[1], true), 138, 23)); } } } - - @Override - public List<PositionedStack> getIngredients() { - return this.getCycledIngredients(GT_NEI_MillingMachine.this.cycleticks / 10, this.mInputs); - } - - @Override - public PositionedStack getResult() { - return null; - } - - @Override - public List<PositionedStack> getOtherStacks() { - return this.mOutputs; - } } } diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java b/src/Java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java new file mode 100644 index 0000000000..f4f69589b6 --- /dev/null +++ b/src/Java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java @@ -0,0 +1,58 @@ +package gtPlusPlus.nei; + +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.recipe.TemplateRecipeHandler; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.util.math.MathUtils; + +public class GT_NEI_MultiNoCell extends GTPP_NEI_DefaultHandler { + + public GT_NEI_MultiNoCell(GT_Recipe_Map aMap) { + super(aMap); + } + + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_MultiNoCell(mRecipeMap); + } + + @Override + public CachedDefaultRecipe createCachedRecipe(GT_Recipe aRecipe) { + return new NoCellMultiDefaultRecipe(aRecipe); + } + + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 89); + } + + @Override + public String getGuiTexture() { + return RES_PATH_GUI + "basicmachines/FissionFuel.png"; + } + + @Override + public void drawExtras(final int aRecipeIndex) { + final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + if (tEUt != 0) { + drawText(10, 90, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); + drawText(10, 100, "Usage: " + MathUtils.formatNumbers(tEUt) + " EU/t", -16777216); + } + if (tDuration > 0) { + drawText(10, 110, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Integer.valueOf(tDuration / 20))) + " secs", -16777216); + } + if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { + drawText(10, 120, this.mRecipeMap.mNEISpecialValuePre + MathUtils.formatNumbers((((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)) + this.mRecipeMap.mNEISpecialValuePost, -16777216); + } + } + +} diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_RFPP.java b/src/Java/gtPlusPlus/nei/GT_NEI_RFPP.java deleted file mode 100644 index 93ad7a775b..0000000000 --- a/src/Java/gtPlusPlus/nei/GT_NEI_RFPP.java +++ /dev/null @@ -1,515 +0,0 @@ -package gtPlusPlus.nei; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.*; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.guihook.IContainerTooltipHandler; -import codechicken.nei.recipe.*; -import cpw.mods.fml.common.event.FMLInterModComms; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.GT_GUIContainer_BasicMachine; -import gregtech.api.objects.ItemData; -import gregtech.api.util.*; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map_Internal; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -public class GT_NEI_RFPP -extends TemplateRecipeHandler { - public static final int sOffsetX = 5; - public static final int sOffsetY = 11; - - static { - GuiContainerManager.addInputHandler(new GT_RectHandler()); - GuiContainerManager.addTooltipHandler(new GT_RectHandler()); - } - - protected GTPP_Recipe_Map_Internal mRecipeMap; - - public GT_NEI_RFPP() { - this.mRecipeMap = GTPP_Recipe.GTPP_Recipe_Map.sFissionFuelProcessing; - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getRecipeMapName(), new Object[0])); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getRecipeMapName()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } - - public List<GTPP_Recipe> getSortedRecipes() { - List<GTPP_Recipe> result = new ArrayList(this.mRecipeMap.mRecipeList); - Collections.sort(result); - return result; - } - - public static void drawText(final int aX, final int aY, final String aString, final int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_RFPP(); - } - - @Override - public void loadCraftingRecipes(final String outputId, final Object... results) { - if (outputId.equals(getRecipeMapName())) { - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - this.arecipes.add(new CachedDefaultRecipe(tRecipe)); - } - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(final ItemStack aResult) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - - ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); - tResults.add(aResult); - tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); - if (tFluid != null) { - tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tResults) { - if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public void loadUsageRecipes(ItemStack aInput) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - - ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); - tInputs.add(aInput); - tInputs.add(GT_OreDictUnificator.get(false, aInput)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); - if (tFluid != null) { - tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tInputs) { - if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public String getRecipeMapName() { - return this.mRecipeMap.mNEIName; - } - - @Override - public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; - } - - @Override - public void drawBackground(final int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); - } - - @Override - public int recipiesPerPage() { - return 1; - } - - @Override - public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); - } - - @Override - public String getGuiTexture() { - return this.mRecipeMap.mNEIGUIPath; - } - - @Override - public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { - final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if ((tObject instanceof CachedDefaultRecipe)) { - final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; - for (final PositionedStack tStack : tRecipe.mOutputs) { - if (aStack == tStack.item) { - if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { - break; - } - currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); - break; - } - } - for (final PositionedStack tStack : tRecipe.mInputs) { - if (GT_Utility.areStacksEqual(aStack, tStack.item)) { - if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || - (tStack.item.stackSize != 0)) { - break; - } - if (ItemUtils.isControlCircuit(aStack)) { - currenttip.add("Does not get consumed in the process"); - } - break; - } - } - } - return currenttip; - } - - @Override - public void drawExtras(final int aRecipeIndex) { - final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - if (tEUt != 0) { - drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); - //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); - if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); - drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); - } else { - drawText(10, 93, "Voltage: unspecified", -16777216); - drawText(10, 103, "Amperage: unspecified", -16777216); - } - } - if (tDuration > 0) { - drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); - } - //if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - //drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); - //} - } - - public static class GT_RectHandler - implements IContainerInputHandler, IContainerTooltipHandler { - @Override - public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - if (this.canHandle(gui)) { - if (button == 0) { - return this.transferRect(gui, false); - } - if (button == 1) { - return this.transferRect(gui, true); - } - } - return false; - } - - @Override - public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - public boolean canHandle(final GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); - } - - @Override - public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) { - if ((this.canHandle(gui)) && (currenttip.isEmpty())) { - if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - }*/ - - } - return currenttip; - } - - private boolean transferRect(final GuiContainer gui, final boolean usage) { - if (gui instanceof GT_GUIContainer_BasicMachine) { - return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { - return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); - }*/ - return false; - } - - @Override - public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) { - return currenttip; - } - - @Override - public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) { - return currenttip; - } - - @Override - public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - @Override - public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { - } - - @Override - public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - return false; - } - - @Override - public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - } - - @Override - public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { - } - } - - public class FixedPositionedStack - extends PositionedStack { - public final int mChance; - public boolean permutated = false; - - public FixedPositionedStack(final Object object, final int x, final int y) { - this(object, x, y, 0); - } - - public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { - super(object, x, y, true); - this.mChance = aChance; - } - - @Override - public void generatePermutations() { - if (this.permutated) { - return; - } - final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); - for (final ItemStack tStack : this.items) { - if (GT_Utility.isStackValid(tStack)) { - if (tStack.getItemDamage() == 32767) { - final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); - if (!permutations.isEmpty()) { - ItemStack stack; - for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { - stack = i$.next(); - } - } else { - final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); - base.stackTagCompound = tStack.stackTagCompound; - tDisplayStacks.add(base); - } - } else { - tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); - } - } - } - this.items = (tDisplayStacks.toArray(new ItemStack[0])); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; - } - this.permutated = true; - this.setPermutationToRender(0); - } - } - - public class CachedDefaultRecipe - extends TemplateRecipeHandler.CachedRecipe { - public final GT_Recipe mRecipe; - public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); - public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); - - public CachedDefaultRecipe(final GT_Recipe aRecipe) { - super(); - this.mRecipe = aRecipe; - - int tStartIndex = 0; - - - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 23)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); - } - tStartIndex++; - - if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); - } - tStartIndex = 0; - - //Four Output Slots - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - - //New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for outputs an the code above for 9 input slots.) - if (aRecipe.mFluidInputs.length > 2) { - if ((aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 12, 5)); - } - if ((aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 5)); - } - if ((aRecipe.mFluidInputs.length > 2) && (aRecipe.mFluidInputs[2] != null) && (aRecipe.mFluidInputs[2].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 48, 5)); - } - if ((aRecipe.mFluidInputs.length > 3) && (aRecipe.mFluidInputs[3] != null) && (aRecipe.mFluidInputs[3].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 12, 23)); - } - if ((aRecipe.mFluidInputs.length > 4) && (aRecipe.mFluidInputs[4] != null) && (aRecipe.mFluidInputs[4].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[4], true), 30, 23)); - } - if ((aRecipe.mFluidInputs.length > 5) && (aRecipe.mFluidInputs[5] != null) && (aRecipe.mFluidInputs[5].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[5], true), 48, 23)); - } - if ((aRecipe.mFluidInputs.length > 6) && (aRecipe.mFluidInputs[6] != null) && (aRecipe.mFluidInputs[6].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[6], true), 12, 41)); - } - if ((aRecipe.mFluidInputs.length > 7) && (aRecipe.mFluidInputs[7] != null) && (aRecipe.mFluidInputs[7].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[7], true), 30, 41)); - } - if ((aRecipe.mFluidInputs.length > 8) && (aRecipe.mFluidInputs[8] != null) && (aRecipe.mFluidInputs[8].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[8], true), 48, 41)); - } - } - //Returns to old behaviour if fluid inputs < 3 - else if ((aRecipe.mFluidInputs.length > 0) && (aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 48, 52)); - if ((aRecipe.mFluidInputs.length == 2) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 52)); - } - } - - if (aRecipe.mFluidOutputs.length > 1) { - if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 5)); - } - if ((aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 120, 5)); - } - if ((aRecipe.mFluidOutputs.length > 2) && (aRecipe.mFluidOutputs[2] != null) && (aRecipe.mFluidOutputs[2].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[2], true), 138, 5)); - } - if ((aRecipe.mFluidOutputs.length > 3) && (aRecipe.mFluidOutputs[3] != null) && (aRecipe.mFluidOutputs[3].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[3], true), 102, 23)); - } - if ((aRecipe.mFluidOutputs.length > 4) && (aRecipe.mFluidOutputs[4] != null) && (aRecipe.mFluidOutputs[4].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[4], true), 120, 23)); - } - if ((aRecipe.mFluidOutputs.length > 5) && (aRecipe.mFluidOutputs[5] != null) && (aRecipe.mFluidOutputs[5].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[5], true), 138, 23)); - } - if ((aRecipe.mFluidOutputs.length > 6) && (aRecipe.mFluidOutputs[6] != null) && (aRecipe.mFluidOutputs[6].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[6], true), 102, 41)); - } - if ((aRecipe.mFluidOutputs.length > 7) && (aRecipe.mFluidOutputs[7] != null) && (aRecipe.mFluidOutputs[7].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[7], true), 120, 41)); - } - if ((aRecipe.mFluidOutputs.length > 8) && (aRecipe.mFluidOutputs[8] != null) && (aRecipe.mFluidOutputs[8].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[8], true), 138, 41)); - } - } else if ((aRecipe.mFluidOutputs.length > 0) && (aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 5)); - } - } - - @Override - public List<PositionedStack> getIngredients() { - return this.getCycledIngredients(GT_NEI_RFPP.this.cycleticks / 10, this.mInputs); - } - - @Override - public PositionedStack getResult() { - return null; - } - - @Override - public List<PositionedStack> getOtherStacks() { - return this.mOutputs; - } - } -} diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_VacFurnace.java b/src/Java/gtPlusPlus/nei/GT_NEI_VacFurnace.java deleted file mode 100644 index e17bc6b15e..0000000000 --- a/src/Java/gtPlusPlus/nei/GT_NEI_VacFurnace.java +++ /dev/null @@ -1,482 +0,0 @@ -package gtPlusPlus.nei; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.*; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.guihook.IContainerTooltipHandler; -import codechicken.nei.recipe.*; -import cpw.mods.fml.common.event.FMLInterModComms; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.GT_GUIContainer_BasicMachine; -import gregtech.api.objects.ItemData; -import gregtech.api.util.*; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -public class GT_NEI_VacFurnace -extends TemplateRecipeHandler { - public static final int sOffsetX = 5; - public static final int sOffsetY = 11; - - static { - GuiContainerManager.addInputHandler(new GT_RectHandler()); - GuiContainerManager.addTooltipHandler(new GT_RectHandler()); - } - - protected GT_Recipe_Map mRecipeMap; - - public GT_NEI_VacFurnace() { - this.mRecipeMap = GTPP_Recipe_Map.sVacuumFurnaceRecipes; - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getRecipeMapName(), new Object[0])); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getRecipeMapName()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } - - public List<GTPP_Recipe> getSortedRecipes() { - List<GTPP_Recipe> result = new ArrayList(this.mRecipeMap.mRecipeList); - Collections.sort(result); - return result; - } - - public static void drawText(final int aX, final int aY, final String aString, final int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_VacFurnace(); - } - - @Override - public void loadCraftingRecipes(final String outputId, final Object... results) { - if (outputId.equals(getRecipeMapName())) { - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - this.arecipes.add(new CachedDefaultRecipe(tRecipe)); - } - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(final ItemStack aResult) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - - ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); - tResults.add(aResult); - tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); - if (tFluid != null) { - tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tResults) { - if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public void loadUsageRecipes(ItemStack aInput) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - - ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); - tInputs.add(aInput); - tInputs.add(GT_OreDictUnificator.get(false, aInput)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); - if (tFluid != null) { - tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tInputs) { - if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public String getRecipeMapName() { - return this.mRecipeMap.mNEIName; - } - - @Override - public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; - } - - @Override - public void drawBackground(final int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); - } - - @Override - public int recipiesPerPage() { - return 1; - } - - @Override - public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); - } - - @Override - public String getGuiTexture() { - return GTPP_Recipe.GTPP_Recipe_Map.sFissionFuelProcessing.mNEIGUIPath; - } - - @Override - public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { - final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if ((tObject instanceof CachedDefaultRecipe)) { - final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; - for (final PositionedStack tStack : tRecipe.mOutputs) { - if (aStack == tStack.item) { - if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { - break; - } - currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); - break; - } - } - for (final PositionedStack tStack : tRecipe.mInputs) { - if (GT_Utility.areStacksEqual(aStack, tStack.item)) { - if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || - (tStack.item.stackSize != 0)) { - break; - } - if (ItemUtils.isControlCircuit(aStack)) { - currenttip.add("Does not get consumed in the process"); - } - break; - } - } - } - return currenttip; - } - - @Override - public void drawExtras(final int aRecipeIndex) { - final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - if (tEUt != 0) { - drawText(10, 88, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); - drawText(10, 98, "Usage: " + tEUt + " EU/t", -16777216); - /*if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); - drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); - } else { - drawText(10, 93, "Voltage: unspecified", -16777216); - drawText(10, 103, "Amperage: unspecified", -16777216); - }*/ - } - if (tDuration > 0) { - drawText(10, 108, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); - } - if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - drawText(10, 118, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); - } - } - - public static class GT_RectHandler - implements IContainerInputHandler, IContainerTooltipHandler { - @Override - public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - if (this.canHandle(gui)) { - if (button == 0) { - return this.transferRect(gui, false); - } - if (button == 1) { - return this.transferRect(gui, true); - } - } - return false; - } - - @Override - public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - public boolean canHandle(final GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); - } - - @Override - public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) { - if ((this.canHandle(gui)) && (currenttip.isEmpty())) { - if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - }*/ - - } - return currenttip; - } - - private boolean transferRect(final GuiContainer gui, final boolean usage) { - if (gui instanceof GT_GUIContainer_BasicMachine) { - return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { - return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); - }*/ - return false; - } - - @Override - public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) { - return currenttip; - } - - @Override - public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) { - return currenttip; - } - - @Override - public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - @Override - public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { - } - - @Override - public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - return false; - } - - @Override - public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - } - - @Override - public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { - } - } - - public class FixedPositionedStack - extends PositionedStack { - public final int mChance; - public boolean permutated = false; - - public FixedPositionedStack(final Object object, final int x, final int y) { - this(object, x, y, 0); - } - - public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { - super(object, x, y, true); - this.mChance = aChance; - } - - @Override - public void generatePermutations() { - if (this.permutated) { - return; - } - final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); - for (final ItemStack tStack : this.items) { - if (GT_Utility.isStackValid(tStack)) { - if (tStack.getItemDamage() == 32767) { - final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); - if (!permutations.isEmpty()) { - ItemStack stack; - for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { - stack = i$.next(); - } - } else { - final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); - base.stackTagCompound = tStack.stackTagCompound; - tDisplayStacks.add(base); - } - } else { - tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); - } - } - } - this.items = (tDisplayStacks.toArray(new ItemStack[0])); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; - } - this.permutated = true; - this.setPermutationToRender(0); - } - } - - public class CachedDefaultRecipe - extends TemplateRecipeHandler.CachedRecipe { - public final GT_Recipe mRecipe; - public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); - public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); - - public CachedDefaultRecipe(final GT_Recipe aRecipe) { - super(); - this.mRecipe = aRecipe; - - int tStartIndex = 0; - - - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 23)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); - } - tStartIndex++; - - if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); - } - tStartIndex = 0; - - //9 Output Slots - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 101, 4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 119, 4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 137, 4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 101, 22, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 119, 22, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 137, 22, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 101, 40, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 119, 40, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 137, 40, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - - if ((aRecipe.mFluidInputs.length > 0) && (aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 12, 60)); - if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 60)); - } - } - - if (aRecipe.mFluidOutputs.length > 0) { - if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 101, 60)); - } - if ((aRecipe.mFluidOutputs.length > 1) && (aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 119, 60)); - } - } - } - - @Override - public List<PositionedStack> getIngredients() { - return this.getCycledIngredients(GT_NEI_VacFurnace.this.cycleticks / 10, this.mInputs); - } - - @Override - public PositionedStack getResult() { - return null; - } - - @Override - public List<PositionedStack> getOtherStacks() { - return this.mOutputs; - } - } -} diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_multiCentriElectroFreezer.java b/src/Java/gtPlusPlus/nei/GT_NEI_multiCentriElectroFreezer.java deleted file mode 100644 index a8c77094cd..0000000000 --- a/src/Java/gtPlusPlus/nei/GT_NEI_multiCentriElectroFreezer.java +++ /dev/null @@ -1,554 +0,0 @@ -package gtPlusPlus.nei; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.*; - -import org.lwjgl.opengl.GL11; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.guihook.IContainerTooltipHandler; -import codechicken.nei.recipe.*; -import cpw.mods.fml.common.event.FMLInterModComms; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.GT_GUIContainer_BasicMachine; -import gregtech.api.objects.ItemData; -import gregtech.api.util.*; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map_Internal; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -public class GT_NEI_multiCentriElectroFreezer -extends TemplateRecipeHandler { - public static final int sOffsetX = 5; - public static final int sOffsetY = 11; - - static { - GuiContainerManager.addInputHandler(new GT_RectHandler()); - GuiContainerManager.addTooltipHandler(new GT_RectHandler()); - } - - protected GTPP_Recipe_Map_Internal mRecipeMap; - - public GT_NEI_multiCentriElectroFreezer(GTPP_Recipe_Map_Internal aMap) { - this.mRecipeMap = aMap; - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getRecipeMapName(), new Object[0])); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getRecipeMapName()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } - - public static void logRecipeError(GT_Recipe aRecipe) { - if (aRecipe == null) { - Logger.INFO("Tried to handle null recipe. :("); - } - else { - ItemStack[] aInputs = aRecipe.mInputs; - ItemStack[] aOutputs = aRecipe.mOutputs; - FluidStack[] aFluidInputs = aRecipe.mFluidInputs; - FluidStack[] aFluidOutputs = aRecipe.mFluidOutputs; - int aEU = aRecipe.mEUt; - int aTime = aRecipe.mDuration; - int aSpecialValue = aRecipe.mSpecialValue; - String aInputitems = ItemUtils.getArrayStackNames(aInputs); - String aOutputitems = ItemUtils.getArrayStackNames(aOutputs); - String aInputFluids = ItemUtils.getArrayStackNames(aFluidInputs); - String aOutputFluids = ItemUtils.getArrayStackNames(aFluidOutputs); - Logger.INFO("Logging Broken Recipe Details:"); - Logger.INFO("Input Items - "+aInputitems); - Logger.INFO("Output Items - "+aOutputitems); - Logger.INFO("Input Fluids - "+aInputFluids); - Logger.INFO("Output Fluids - "+aOutputFluids); - Logger.INFO("EU/t - "+aEU); - Logger.INFO("Duration - "+aTime); - Logger.INFO("Special Value - "+aSpecialValue); - } - } - - public List<GTPP_Recipe> getSortedRecipes() { - List<GTPP_Recipe> result = new ArrayList(this.mRecipeMap.mRecipeList); - Collections.sort(result); - return result; - } - - public static void drawText(final int aX, final int aY, final String aString, final int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_multiCentriElectroFreezer(mRecipeMap); - } - - @Override - public void loadCraftingRecipes(final String outputId, final Object... results) { - if (outputId.equals(getRecipeMapName())) { - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = getCachedRecipe(tRecipe); - if (tNEIRecipe == null) { - continue; - } - this.arecipes.add(tNEIRecipe); - } - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(final ItemStack aResult) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - - ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); - tResults.add(aResult); - tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); - if (tFluid != null) { - tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = getCachedRecipe(tRecipe); - if (tNEIRecipe == null) { - continue; - } - for (ItemStack tStack : tResults) { - if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public void loadUsageRecipes(ItemStack aInput) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - - ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); - tInputs.add(aInput); - tInputs.add(GT_OreDictUnificator.get(false, aInput)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); - if (tFluid != null) { - tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GTPP_Recipe tRecipe : getSortedRecipes()) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = getCachedRecipe(tRecipe); - if (tNEIRecipe == null) { - continue; - } - for (ItemStack tStack : tInputs) { - if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - //CachedDefaultRecipe tNEIRecipe; - } - - public String getRecipeMapName() { - return this.mRecipeMap.mNEIName; - } - - @Override - public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; - } - - @Override - public void drawBackground(final int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); - } - - @Override - public int recipiesPerPage() { - return 1; - } - - @Override - public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); - } - - @Override - public String getGuiTexture() { - return this.mRecipeMap.mNEIGUIPath; - } - - @Override - public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { - final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if ((tObject instanceof CachedDefaultRecipe)) { - final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; - for (final PositionedStack tStack : tRecipe.mOutputs) { - if (aStack == tStack.item) { - if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { - break; - } - currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); - break; - } - } - for (final PositionedStack tStack : tRecipe.mInputs) { - if (aStack == tStack.item) { - if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || - (tStack.item.stackSize != 0)) { - break; - } - currenttip.add("Does not get consumed in the process"); - break; - } - } - } - return currenttip; - } - - @Override - public void drawExtras(final int aRecipeIndex) { - final int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - if (tEUt != 0) { - drawText(10, 83, "Total: " + (tDuration * tEUt) + " EU", -16777216); - drawText(10, 93, "Usage: " + tEUt + " EU/t", -16777216); - if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 103, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU", -16777216); - drawText(10, 113, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); - } else { - drawText(10, 103, "Voltage: unspecified", -16777216); - drawText(10, 113, "Amperage: unspecified", -16777216); - } - } - if (tDuration > 0) { - drawText(10, 123, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); - } - if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - drawText(10, 133, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); - } - } - - public static class GT_RectHandler - implements IContainerInputHandler, IContainerTooltipHandler { - @Override - public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - if (this.canHandle(gui)) { - if (button == 0) { - return this.transferRect(gui, false); - } - if (button == 1) { - return this.transferRect(gui, true); - } - } - return false; - } - - @Override - public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - public boolean canHandle(final GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); - } - - @Override - public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) { - if ((this.canHandle(gui)) && (currenttip.isEmpty())) { - if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - }*/ - - } - return currenttip; - } - - private boolean transferRect(final GuiContainer gui, final boolean usage) { - if (gui instanceof GT_GUIContainer_BasicMachine) { - return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { - return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); - }*/ - return false; - } - - @Override - public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) { - return currenttip; - } - - @Override - public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) { - return currenttip; - } - - @Override - public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { - return false; - } - - @Override - public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { - } - - @Override - public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { - } - - @Override - public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - return false; - } - - @Override - public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { - } - - @Override - public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { - } - } - - public class FixedPositionedStack - extends PositionedStack { - public final int mChance; - public boolean permutated = false; - - public FixedPositionedStack(final Object object, final int x, final int y) { - this(object, x, y, 0); - } - - public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { - super(object, x, y, true); - this.mChance = aChance; - } - - @Override - public void generatePermutations() { - if (this.permutated) { - return; - } - final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); - for (final ItemStack tStack : this.items) { - if (GT_Utility.isStackValid(tStack)) { - if (tStack.getItemDamage() == 32767) { - final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); - if (!permutations.isEmpty()) { - ItemStack stack; - for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { - stack = i$.next(); - } - } else { - final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); - base.stackTagCompound = tStack.stackTagCompound; - tDisplayStacks.add(base); - } - } else { - tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); - } - } - } - this.items = (tDisplayStacks.toArray(new ItemStack[0])); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; - } - this.permutated = true; - this.setPermutationToRender(0); - } - } - private static final HashMap<Integer, Pair<Integer, Integer>> mInputSlotMap = new HashMap<Integer, Pair<Integer, Integer>>(); - private static final HashMap<Integer, Pair<Integer, Integer>> mOutputSlotMap = new HashMap<Integer, Pair<Integer, Integer>>(); - - static { - int aSlotX_1 = 12; - int aSlotX_2 = 30; - int aSlotX_3 = 48; - int aSlotY_1 = 5; - int aSlotY_2 = 23; - int aSlotY_3 = 41; - int aSlotY_10 = 65; // Only if 9 input items and a FLuid - mInputSlotMap.put(0, new Pair<Integer, Integer>(aSlotX_1, aSlotY_1)); - mInputSlotMap.put(1, new Pair<Integer, Integer>(aSlotX_2, aSlotY_1)); - mInputSlotMap.put(2, new Pair<Integer, Integer>(aSlotX_3, aSlotY_1)); - mInputSlotMap.put(3, new Pair<Integer, Integer>(aSlotX_1, aSlotY_2)); - mInputSlotMap.put(4, new Pair<Integer, Integer>(aSlotX_2, aSlotY_2)); - mInputSlotMap.put(5, new Pair<Integer, Integer>(aSlotX_3, aSlotY_2)); - mInputSlotMap.put(6, new Pair<Integer, Integer>(aSlotX_1, aSlotY_3)); - mInputSlotMap.put(7, new Pair<Integer, Integer>(aSlotX_2, aSlotY_3)); - mInputSlotMap.put(8, new Pair<Integer, Integer>(aSlotX_3, aSlotY_3)); - mInputSlotMap.put(9, new Pair<Integer, Integer>(aSlotX_1, aSlotY_10)); - mInputSlotMap.put(10, new Pair<Integer, Integer>(aSlotX_2, aSlotY_10)); - mInputSlotMap.put(11, new Pair<Integer, Integer>(aSlotX_3, aSlotY_10)); - aSlotX_1 = 102; - aSlotX_2 = 120; - aSlotX_3 = 138; - mOutputSlotMap.put(0, new Pair<Integer, Integer>(aSlotX_1, aSlotY_1)); - mOutputSlotMap.put(1, new Pair<Integer, Integer>(aSlotX_2, aSlotY_1)); - mOutputSlotMap.put(2, new Pair<Integer, Integer>(aSlotX_3, aSlotY_1)); - mOutputSlotMap.put(3, new Pair<Integer, Integer>(aSlotX_1, aSlotY_2)); - mOutputSlotMap.put(4, new Pair<Integer, Integer>(aSlotX_2, aSlotY_2)); - mOutputSlotMap.put(5, new Pair<Integer, Integer>(aSlotX_3, aSlotY_2)); - mOutputSlotMap.put(6, new Pair<Integer, Integer>(aSlotX_1, aSlotY_3)); - mOutputSlotMap.put(7, new Pair<Integer, Integer>(aSlotX_2, aSlotY_3)); - mOutputSlotMap.put(8, new Pair<Integer, Integer>(aSlotX_3, aSlotY_3)); - mOutputSlotMap.put(9, new Pair<Integer, Integer>(aSlotX_1, aSlotY_10)); - mOutputSlotMap.put(10, new Pair<Integer, Integer>(aSlotX_2, aSlotY_10)); - mOutputSlotMap.put(11, new Pair<Integer, Integer>(aSlotX_3, aSlotY_10)); - } - - private CachedDefaultRecipe getCachedRecipe(GT_Recipe aRecipe) { - try { - return new CachedDefaultRecipe(aRecipe); - } - catch(Throwable e) { - logRecipeError(aRecipe); - } - return null; - } - - public class CachedDefaultRecipe - extends TemplateRecipeHandler.CachedRecipe { - - - public final GT_Recipe mRecipe; - public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); - public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); - - public CachedDefaultRecipe(final GT_Recipe aRecipe) { - super(); - this.mRecipe = aRecipe; - int aInputItemsCount = this.mRecipe.mInputs.length; - int aInputFluidsCount = this.mRecipe.mFluidInputs.length; - int aOutputItemsCount = this.mRecipe.mOutputs.length; - int aOutputFluidsCount = this.mRecipe.mFluidOutputs.length; - int aInputSlotsUsed = 0; - int aOutputSlotsUsed = 0; - int aSlotToCheck = 0; - - // Special Slot - if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); - } - - /* - * Items - */ - - // Upto 9 Inputs Slots - if (aInputItemsCount > 0) { - if (aInputItemsCount > 9) { - aInputItemsCount = 9; - } - for (int i=0;i<aInputItemsCount;i++) { - int x = mInputSlotMap.get(aSlotToCheck).getKey(); - int y = mInputSlotMap.get(aSlotToCheck).getValue(); - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(aSlotToCheck), x, y)); - aSlotToCheck++; - aInputSlotsUsed++; - } - } - aSlotToCheck = 0; - // Upto 9 Output Slots - if (aOutputItemsCount > 0) { - if (aOutputItemsCount > 9) { - aOutputItemsCount = 9; - } - for (int i=0;i<aOutputItemsCount;i++) { - int x = mOutputSlotMap.get(aSlotToCheck).getKey(); - int y = mOutputSlotMap.get(aSlotToCheck).getValue(); - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(aSlotToCheck), x, y, aRecipe.getOutputChance(aSlotToCheck))); - aSlotToCheck++; - aOutputSlotsUsed++; - } - } - - /* - * Fluids - */ - - // Upto 9 Fluid Inputs Slots - aSlotToCheck = aInputSlotsUsed; - if (aInputFluidsCount > 0) { - for (int i=0;i<aInputFluidsCount;i++) { - int x = mInputSlotMap.get(aSlotToCheck).getKey(); - int y = mInputSlotMap.get(aSlotToCheck).getValue(); - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[i], true), x, y)); - aSlotToCheck++; - aInputSlotsUsed++; - } - } - // Upto 9 Fluid Outputs Slots - aSlotToCheck = aOutputSlotsUsed; - if (aOutputFluidsCount > 0) { - for (int i=0;i<aOutputFluidsCount;i++) { - int x = mOutputSlotMap.get(aSlotToCheck).getKey(); - int y = mOutputSlotMap.get(aSlotToCheck).getValue(); - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[i], true), x, y)); - aSlotToCheck++; - aOutputSlotsUsed++; - } - } - - } - - @Override - public List<PositionedStack> getIngredients() { - return this.getCycledIngredients(GT_NEI_multiCentriElectroFreezer.this.cycleticks / 10, this.mInputs); - } - - @Override - public PositionedStack getResult() { - return null; - } - - @Override - public List<PositionedStack> getOtherStacks() { - return this.mOutputs; - } - } -} diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index 07bd7ef46c..0b3cf8e66e 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -2,11 +2,13 @@ package gtPlusPlus.nei; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; -import gregtech.api.util.GTPP_Recipe; import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; +import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map_Internal; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; public class NEI_GT_Config implements IConfigureNEI { @@ -18,7 +20,8 @@ implements IConfigureNEI { @Override public synchronized void loadConfig() { - mUniqueRecipeMapHandling.add(GTPP_Recipe.GTPP_Recipe_Map.sFissionFuelProcessing.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sFissionFuelProcessing.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mUnlocalizedName); mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sChemicalPlantRecipes.mUnlocalizedName); mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sOreMillRecipes.mUnlocalizedName); mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sFlotationCellRecipes.mUnlocalizedName); @@ -28,27 +31,11 @@ implements IConfigureNEI { mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mUnlocalizedName); mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mUnlocalizedName); mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mUnlocalizedName); - - // Custom Recipe Maps - /*Logger.INFO("NEI Registration: "+CustomRecipeMap.sMappings.size()+" CustomRecipeMaps"); - for (final CustomRecipeMap tMap : CustomRecipeMap.sMappings) { - if (tMap.mNEIAllowed) { - if (!mUniqueRecipeMapHandling.contains(tMap.mUnlocalizedName)) { - Logger.INFO("NEI Registration: Registering NEI handler for "+tMap.mNEIName); - new GTPP_NEI_CustomMapHandler(tMap); - } - else { - Logger.INFO("NEI Registration: Not allowed to register NEI handler for "+tMap.mNEIName); - } - } - else { - Logger.INFO("NEI Registration: Not allowed to register NEI handler for "+tMap.mNEIName); - } - }*/ + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mUnlocalizedName); // Standard GT Recipe Maps - Logger.INFO("NEI Registration: "+GTPP_Recipe.GTPP_Recipe_Map_Internal.sMappingsEx.size()+" sMappingEx"); - for (final GT_Recipe_Map tMap : GTPP_Recipe.GTPP_Recipe_Map_Internal.sMappingsEx) { + Logger.INFO("NEI Registration: "+GTPP_Recipe_Map_Internal.sMappingsEx.size()+" sMappingEx"); + for (final GT_Recipe_Map tMap : GTPP_Recipe_Map_Internal.sMappingsEx) { if (tMap.mNEIAllowed) { if (!mUniqueRecipeMapHandling.contains(tMap.mUnlocalizedName)) { Logger.INFO("NEI Registration: Registering NEI handler for "+tMap.mNEIName); @@ -62,29 +49,42 @@ implements IConfigureNEI { Logger.INFO("NEI Registration: Skipping registration of NEI handler for "+tMap.mNEIName); } } - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlantRecipes.mNEIName); + + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sChemicalPlantRecipes.mNEIName); new GT_NEI_FluidReactor(); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe.GTPP_Recipe_Map.sOreMillRecipes.mNEIName); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sOreMillRecipes.mNEIName); new GT_NEI_MillingMachine(); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe.GTPP_Recipe_Map.sFlotationCellRecipes.mNEIName); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sFlotationCellRecipes.mNEIName); new GT_NEI_FlotationCell(); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe.GTPP_Recipe_Map.sVacuumFurnaceRecipes.mNEIName); - new GT_NEI_VacFurnace(); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe.GTPP_Recipe_Map.sFissionFuelProcessing.mNEIName); - new GT_NEI_RFPP(); - - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mNEIName); - new GT_NEI_multiCentriElectroFreezer(GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mNEIName); - new GT_NEI_multiCentriElectroFreezer(GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mNEIName); - new GT_NEI_multiCentriElectroFreezer(GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe.GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mNEIName); - new GT_NEI_multiCentriElectroFreezer(GTPP_Recipe.GTPP_Recipe_Map.sMultiblockMixerRecipes_GT); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mNEIName); + new GT_NEI_LFTR(); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sFissionFuelProcessing.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sFissionFuelProcessing); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sVacuumFurnaceRecipes.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sVacuumFurnaceRecipes); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAdvFreezerRecipes_GT); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockMixerRecipes_GT); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes); Logger.INFO("NEI Registration: Registering NEI handler for "+DecayableRecipeHandler.mNEIName); API.registerRecipeHandler(new DecayableRecipeHandler()); API.registerUsageHandler(new DecayableRecipeHandler()); + + Logger.INFO("NEI Registration: Registering NEI handler for "+GT_NEI_LFTR_Sparging.mNEIName); + new GT_NEI_LFTR_Sparging(); + + // Hide Flasks + if (Utils.isClient()) { + codechicken.nei.api.API.addItemListEntry(GregtechItemList.VOLUMETRIC_FLASK_8k.get(1)); + codechicken.nei.api.API.addItemListEntry(GregtechItemList.VOLUMETRIC_FLASK_32k.get(1)); + } sIsAdded = true; } diff --git a/src/Java/gtPlusPlus/nei/NEI_IMC_Sender.java b/src/Java/gtPlusPlus/nei/NEI_IMC_Sender.java index 461678dd7a..7bc2316a04 100644 --- a/src/Java/gtPlusPlus/nei/NEI_IMC_Sender.java +++ b/src/Java/gtPlusPlus/nei/NEI_IMC_Sender.java @@ -5,30 +5,37 @@ import net.minecraft.nbt.NBTTagCompound; public class NEI_IMC_Sender { public static void IMCSender() { - setNBTInfoAndSendIt("gtpp.recipe.alloyblastsmelter", "gregtech:gt.blockmachines:810"); + setNBTInfoAndSendIt("gtpp.recipe.alloyblastsmelter", "gregtech:gt.blockmachines:810", 1); setNBTInfoAndSendIt("gtpp.recipe.rocketenginefuel", "gregtech:gt.blockmachines:793"); setNBTInfoAndSendIt("gtpp.recipe.cyclotron", "gregtech:gt.blockmachines:828"); - setNBTInfoAndSendIt("gtpp.recipe.chemicaldehydrator", "gregtech:gt.blockmachines:911"); + setNBTInfoAndSendIt("gtpp.recipe.chemicaldehydrator", "gregtech:gt.blockmachines:911", 1); setNBTInfoAndSendIt("gtpp.recipe.slowfusionreactor", "gregtech:gt.blockmachines:31015"); setNBTInfoAndSendIt("gtpp.recipe.RTGgenerators", "gregtech:gt.blockmachines:869"); setNBTInfoAndSendIt("gtpp.recipe.cokeoven", "gregtech:gt.blockmachines:791"); setNBTInfoAndSendIt("gtpp.recipe.semifluidgeneratorfuels", "gregtech:gt.blockmachines:837"); - setNBTInfoAndSendIt("gtpp.recipe.fishpond", "gregtech:gt.blockmachines:829"); + setNBTInfoAndSendIt("gtpp.recipe.fishpond", "gregtech:gt.blockmachines:829", 1); setNBTInfoAndSendIt("gtpp.recipe.multimixer", "gregtech:gt.blockmachines:811"); setNBTInfoAndSendIt("gtpp.recipe.advanced.mixer", "gregtech:gt.blockmachines:811"); setNBTInfoAndSendIt("gtpp.recipe.cryogenicfreezer", "gregtech:gt.blockmachines:910"); - setNBTInfoAndSendIt("gtpp.recipe.fissionfuel", "gregtech:gt.blockmachines:835"); setNBTInfoAndSendIt("gtpp.recipe.geothermalfuel", "gregtech:gt.blockmachines:830"); - setNBTInfoAndSendIt("gtpp.recipe.lftr", "gregtech:gt.blockmachines:751"); - setNBTInfoAndSendIt("gtpp.recipe.lftr.2", "gregtech:gt.blockmachines:751"); setNBTInfoAndSendIt("gtpp.recipe.matterfab2", "gregtech:gt.blockmachines:799"); - setNBTInfoAndSendIt("gtpp.recipe.multicentrifuge", "gregtech:gt.blockmachines:790"); - setNBTInfoAndSendIt("gtpp.recipe.multielectro", "gregtech:gt.blockmachines:796"); + setNBTInfoAndSendIt("gtpp.recipe.multicentrifuge", "gregtech:gt.blockmachines:790", 1); + setNBTInfoAndSendIt("gtpp.recipe.multielectro", "gregtech:gt.blockmachines:796", 1); setNBTInfoAndSendIt("gtpp.recipe.simplewasher", "gregtech:gt.blockmachines:767"); - setNBTInfoAndSendIt("gtpp.recipe.vacfurnace", "gregtech:gt.blockmachines:995"); + setNBTInfoAndSendIt("gtpp.recipe.vacfurnace", "gregtech:gt.blockmachines:995", 1); + setNBTInfoAndSendIt("gtpp.recipe.fissionfuel", "gregtech:gt.blockmachines:835", 1); + setNBTInfoAndSendIt("gtpp.recipe.lftr", "gregtech:gt.blockmachines:751", 1); + setNBTInfoAndSendIt("gtpp.recipe.lftr.sparging", "gregtech:gt.blockmachines:31035", 1); + setNBTInfoAndSendIt("gtpp.recipe.coldtrap", "gregtech:gt.blockmachines:31034"); + setNBTInfoAndSendIt("gtpp.recipe.reactorprocessingunit", "gregtech:gt.blockmachines:31032"); } + private static void setNBTInfoAndSendIt(String aRecipeName, String aBlock) { + setNBTInfoAndSendIt(aRecipeName, aBlock, 2); + } + + private static void setNBTInfoAndSendIt(String aRecipeName, String aBlock, int aRecipesPerPage) { NBTTagCompound aNBT = new NBTTagCompound(); aNBT.setString("handler", aRecipeName); aNBT.setString("modName", "GT++"); @@ -38,7 +45,7 @@ public class NEI_IMC_Sender { aNBT.setInteger("yShift", 6); aNBT.setInteger("handlerHeight", 135); aNBT.setInteger("handlerWidth", 166); - aNBT.setInteger("maxRecipesPerPage", 2); + aNBT.setInteger("maxRecipesPerPage", aRecipesPerPage); FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", aNBT); } } |