diff options
author | draknyte1 <draknyte1@hotmail.com> | 2016-11-03 00:16:36 +1000 |
---|---|---|
committer | draknyte1 <draknyte1@hotmail.com> | 2016-11-03 00:16:36 +1000 |
commit | c043d88a57a690b1f40cdcd997cdf00cfe06ad09 (patch) | |
tree | c141a5cc008ca5b5c79271abe96bc6e469658f24 /src | |
parent | 8f5e03f5b792738955b1578f6fd98434b566afb8 (diff) | |
download | GT5-Unofficial-c043d88a57a690b1f40cdcd997cdf00cfe06ad09.tar.gz GT5-Unofficial-c043d88a57a690b1f40cdcd997cdf00cfe06ad09.tar.bz2 GT5-Unofficial-c043d88a57a690b1f40cdcd997cdf00cfe06ad09.zip |
+ Added support for using items as input for the Matter fabricator.
Diffstat (limited to 'src')
5 files changed, 74 insertions, 28 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 73e7a5d56f..62b3aa9bcc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -21,7 +21,7 @@ public interface IGregtech_RecipeAdder { public boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType); - + /** * Adds a Matter Fabricator Recipe * @@ -32,29 +32,41 @@ public interface IGregtech_RecipeAdder { * @return true if the Recipe got added, otherwise false. */ public boolean addMatterFabricatorRecipe(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt); - - - - + /** - * Adds a Recipe for the Dehydrator. (up to 9 Outputs) - * + * Adds a Matter Fabricator Recipe + * + * @param aItemInput = ItemStack Input, can be null I assume. + * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) + * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) + * @param aDuration = Duration (must be >= 0) + * @param aEUt = EU needed for heating up (must be >= 0) + * @return true if the Recipe got added, otherwise false. + */ + public boolean addMatterFabricatorRecipe(ItemStack aItemInput, FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt); + + + + + /** + * Adds a Recipe for the Dehydrator. (up to 9 Outputs) + * * @param aInput = Input itemstack (not null, and respects StackSize) * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) * @param aOutputItems = Itemstack[] (not null, and respects StackSize) * @param aDuration = Duration (must be >= 0) * @param aEUt = EU needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. - */ + */ - public boolean addDehydratorRecipe(ItemStack aInput, FluidStack aFluid, ItemStack[] aOutputItems, int aDuration, int aEUt); + public boolean addDehydratorRecipe(ItemStack aInput, FluidStack aFluid, ItemStack[] aOutputItems, int aDuration, int aEUt); /*public boolean addDehydratorRecipe(FluidStack aFluid, FluidStack aOutputFluid, ItemStack[] aOutputItems, int aDuration, int aEUt);*/ - /*public boolean addDehydratorRecipe(ItemStack aItemA, ItemStack aItemB, ItemStack[] aOutputItems, int aDuration, int aEUt); + /*public boolean addDehydratorRecipe(ItemStack aItemA, ItemStack aItemB, ItemStack[] aOutputItems, int aDuration, int aEUt); public boolean addDehydratorRecipe(ItemStack aItemA, ItemStack aItemB, FluidStack aFluid, ItemStack[] aOutputItems, FluidStack aOutputFluid, int aDuration, int aEUt);*/ - - /** - * Adds a Recipe for the Dehydrator. (up to 9 Outputs) - * + + /** + * Adds a Recipe for the Dehydrator. (up to 9 Outputs) + * * @param aInput = ItemStack[] (not null, and respects StackSize) * @param aFluidInput = fluid Input (can be UU_Amp or null, and respects StackSize) * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) @@ -63,20 +75,20 @@ public interface IGregtech_RecipeAdder { * @param aDuration = Duration (must be >= 0) * @param aEUt = EU needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. - */ - public boolean addDehydratorRecipe(ItemStack[] aInput, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack[] aOutputItems, int[] aChances, int aDuration, int aEUt); - - - /** - * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs) - * + */ + public boolean addDehydratorRecipe(ItemStack[] aInput, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack[] aOutputItems, int[] aChances, int aDuration, int aEUt); + + + /** + * Adds a Recipe for the Alloy Blast Smelter. (up to 9 Inputs) + * * @param aInput = ItemStack[] (not null, and respects StackSize) * @param aFluidOutput = Output of the UU-Matter (not null, and respects StackSize) * @param aChances = Output Change (can be == 0) * @param aDuration = Duration (must be >= 0) * @param aEUt = EU needed for heating up (must be >= 0) * @return true if the Recipe got added, otherwise false. - */ - public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aOutput, int aChance, int aDuration, int aEUt); - + */ + public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aOutput, int aChance, int aDuration, int aEUt); + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java index 9c6fea31e6..3adc9c9022 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java @@ -31,9 +31,9 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Placeholder Casing"); //60 GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Placeholder Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Placeholder Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Incoloy Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Placeholder Casing"); //65 + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Incoloy Casing"); //65 GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Placeholder Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Placeholder Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Placeholder Casing"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java index 2c86cde5bd..8742896f2f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java @@ -31,13 +31,13 @@ public class CasingTextureHandler2 { return TexturesGtBlock.Casing_Material_Potin.getIcon(); //Broken Blue Fusion Casings case 6: - return Textures.BlockIcons.MACHINE_CASING_FUSION.getIcon(); + return TexturesGtBlock.Casing_Material_IncoloyMA956.getIcon(); //Maceration Stack Casings case 7: return TexturesGtBlock.Casing_Material_Tumbaga.getIcon(); //Broken Pink Fusion Casings case 8: - return Textures.BlockIcons.MACHINE_CASING_FUSION_2.getIcon(); + return TexturesGtBlock.Casing_Material_IncoloyDS.getIcon(); //Matter Fabricator Casings case 9: return TexturesGtBlock.Casing_Machine_Dimensional_Adv.getIcon(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java index 1f0655aaa7..626a7b5c81 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java @@ -103,6 +103,22 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo @Override public boolean checkRecipe(ItemStack aStack) { + + ArrayList<ItemStack> tInputList = getStoredInputs(); + for (int i = 0; i < tInputList.size() - 1; i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + ArrayList<FluidStack> tFluidList = getStoredFluids(); for (int i = 0; i < tFluidList.size() - 1; i++) { for (int j = i + 1; j < tFluidList.size(); j++) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index bf752c2c79..b9a8ac7a1e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -107,6 +107,24 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } @Override + public boolean addMatterFabricatorRecipe(ItemStack aInputStack, FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt) { + try { + try {if (aFluidOutput == null || aInputStack == null) {return false;}} catch (NullPointerException e){} + try{ + if (aFluidInput == null){ + Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.addRecipe(true, new ItemStack[]{aInputStack}, null, null, null, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); + } + else { + Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.addRecipe(true, new ItemStack[]{aInputStack}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); + } + RECIPEHANDLER_MatterFabricator.debug5(aFluidInput, aFluidOutput, aDuration, aEUt); + return true; + } catch (NullPointerException e){return false;} + } catch (Throwable e){return false;} + } + + + @Override public boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType) { if (aInput1 == null) { Utils.LOG_INFO("Fuel Input is Invalid."); |