diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java
index 65727013..6a8a599b 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -1,5 +1,21 @@
package gregtech.api.util;
+import static gregtech.api.enums.GT_Values.D1;
+import static gregtech.api.enums.GT_Values.D2;
+import static gregtech.api.enums.GT_Values.E;
+import static gregtech.api.enums.GT_Values.L;
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+import static gregtech.api.enums.GT_Values.W;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import codechicken.nei.PositionedStack;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.ItemList;
@@ -11,19 +27,17 @@ import gregtech.api.objects.GT_FluidStack;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.ItemData;
import gregtech.api.objects.MaterialStack;
+import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
-import java.util.*;
-
-import static gregtech.api.enums.GT_Values.*;
-
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
*
@@ -76,7 +90,7 @@ public class GT_Recipe implements Comparable {
* Used for describing recipes that do not fit the default recipe pattern (for example Large Boiler Fuels)
*/
private String[] neiDesc = null;
-
+
private GT_Recipe(GT_Recipe aRecipe) {
mInputs = GT_Utility.copyStackArray((Object[]) aRecipe.mInputs);
mOutputs = GT_Utility.copyStackArray((Object[]) aRecipe.mOutputs);
@@ -449,6 +463,22 @@ public class GT_Recipe implements Comparable {
this.neiDesc = neiDesc;
}
+ /**
+ * Overriding this method and getOutputPositionedStacks allows for custom NEI stack placement
+ * @return A list of input stacks
+ */
+ public ArrayList getInputPositionedStacks(){
+ return null;
+ }
+
+ /**
+ * Overriding this method and getInputPositionedStacks allows for custom NEI stack placement
+ * @return A list of output stacks
+ */
+ public ArrayList getOutputPositionedStacks(){
+ return null;
+ }
+
public static class GT_Recipe_AssemblyLine {
public static final ArrayList sAssemblylineRecipes = new ArrayList();
@@ -520,6 +550,7 @@ public class GT_Recipe implements Comparable {
public static final GT_Recipe_Map sImplosionRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.implosioncompressor", "Implosion Compressor", null, RES_PATH_GUI + "basicmachines/Default", 2, 2, 2, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sVacuumRecipes = new GT_Recipe_Map(new HashSet(100), "gt.recipe.vacuumfreezer", "Vacuum Freezer", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sChemicalRecipes = new GT_Recipe_Map(new HashSet(100), "gt.recipe.chemicalreactor", "Chemical Reactor", null, RES_PATH_GUI + "basicmachines/ChemicalReactor", 2, 2, 1, 0, 1, E, 1, E, true, true);
+ public static final GT_Recipe_Map sMultiblockChemicalRecipes = new GT_Recipe_Map_LargeChemicalReactor();
public static final GT_Recipe_Map sDistillationRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.distillationtower", "Distillation Tower", null, RES_PATH_GUI + "basicmachines/Default", 2, 4, 0, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sCrakingRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.craker", "Oil Cracker", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 1, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sPyrolyseRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.pyro", "Pyrolyse Oven", null, RES_PATH_GUI + "basicmachines/Default", 2, 1, 1, 0, 1, E, 1, E, true, true);
@@ -546,7 +577,7 @@ public class GT_Recipe implements Comparable {
public static final GT_Recipe_Map_Fuel sSmallNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.smallnaquadahreactor", "Small Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
public static final GT_Recipe_Map_Fuel sLargeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.largenaquadahreactor", "Large Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
public static final GT_Recipe_Map_Fuel sFluidNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.fluidnaquadahreactor", "Fluid Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
- public static final GT_Recipe_Map_Large_Boiler_Fake_Fuels sLargeBoilerFakeFuels = new GT_Recipe_Map_Large_Boiler_Fake_Fuels();
+ public static final GT_Recipe_Map_LargeBoilerFakeFuels sLargeBoilerFakeFuels = new GT_Recipe_Map_LargeBoilerFakeFuels();
/**
* HashMap of Recipes based on their Items
@@ -1379,9 +1410,9 @@ public class GT_Recipe implements Comparable {
}
}
- public static class GT_Recipe_Map_Large_Boiler_Fake_Fuels extends GT_Recipe_Map {
+ public static class GT_Recipe_Map_LargeBoilerFakeFuels extends GT_Recipe_Map {
- public GT_Recipe_Map_Large_Boiler_Fake_Fuels() {
+ public GT_Recipe_Map_LargeBoilerFakeFuels() {
super(new HashSet(30), "gt.recipe.largeboilerfakefuels", "Large Boiler", null, RES_PATH_GUI + "basicmachines/Default", 1, 0, 1, 0, 1, E, 1, E, true, true);
GT_Recipe explanatoryRecipe = new GT_Recipe(true, new ItemStack[]{}, new ItemStack[]{}, null, null, null, null, 1, 1, 1);
explanatoryRecipe.setNeiDesc("Not all solid fuels are listed.", "Any item that burns in a", "vanilla furnace will burn in", "a Large Boiler.");
@@ -1422,4 +1453,109 @@ public class GT_Recipe implements Comparable {
return super.addRecipe(recipe);
}
}
+
+ public static class GT_Recipe_Map_LargeChemicalReactor extends GT_Recipe_Map{
+ private static int INPUT_COUNT = 2;
+ private static int OUTPUT_COUNT = 2;
+ private static int FLUID_INPUT_COUNT = 3;
+ private static int FLUID_OUTPUT_COUNT = 3;
+
+ public GT_Recipe_Map_LargeChemicalReactor() {
+ super(new HashSet(200), "gt.recipe.largechemicalreactor", "Large Chemical Reactor", null, RES_PATH_GUI + "basicmachines/Default", INPUT_COUNT, OUTPUT_COUNT, 0, 0, 1, E, 1, E, true, true);
+ }
+
+ @Override
+ public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) {
+ aOptimize = false;
+ ArrayList adjustedInputs = new ArrayList();
+ ArrayList adjustedOutputs = new ArrayList();
+ ArrayList adjustedFluidInputs = new ArrayList();
+ ArrayList adjustedFluidOutputs = new ArrayList();
+
+ for (ItemStack input : aInputs) {
+ FluidStack inputFluidContent = FluidContainerRegistry.getFluidForFilledItem(input);
+ if (inputFluidContent != null) {
+ inputFluidContent.amount *= input.stackSize;
+ adjustedFluidInputs.add(inputFluidContent);
+ } else {
+ ItemData itemData = GT_OreDictUnificator.getItemData(input);
+ if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mMaterial.mMaterial == Materials.Empty) {
+ continue;
+ } else {
+ adjustedInputs.add(input);
+ }
+ }
+ }
+ for (FluidStack fluidInput : aFluidInputs) {
+ adjustedFluidInputs.add(fluidInput);
+ }
+ aInputs = adjustedInputs.toArray(new ItemStack[adjustedInputs.size()]);
+ aFluidInputs = adjustedFluidInputs.toArray(new FluidStack[adjustedFluidInputs.size()]);
+
+ for (ItemStack output : aOutputs) {
+ FluidStack outputFluidContent = FluidContainerRegistry.getFluidForFilledItem(output);
+ if (outputFluidContent != null) {
+ outputFluidContent.amount *= output.stackSize;
+ adjustedFluidOutputs.add(outputFluidContent);
+ } else {
+ ItemData itemData = GT_OreDictUnificator.getItemData(output);
+ if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mMaterial.mMaterial == Materials.Empty) {
+ continue;
+ } else {
+ adjustedOutputs.add(output);
+ }
+ }
+ }
+ for (FluidStack fluidOutput : aFluidOutputs) {
+ adjustedFluidOutputs.add(fluidOutput);
+ }
+ aOutputs = adjustedOutputs.toArray(new ItemStack[adjustedOutputs.size()]);
+ aFluidOutputs = adjustedFluidOutputs.toArray(new FluidStack[adjustedFluidOutputs.size()]);
+
+ return addRecipe(new GT_Recipe_LargeChemicalReactor(aOptimize, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue));
+ }
+
+ private static class GT_Recipe_LargeChemicalReactor extends GT_Recipe{
+
+ protected GT_Recipe_LargeChemicalReactor(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) {
+ super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue);
+ }
+
+ @Override
+ public ArrayList getInputPositionedStacks() {
+ int itemLimit = Math.min(mInputs.length, INPUT_COUNT);
+ int fluidLimit = Math.min(mFluidInputs.length, FLUID_INPUT_COUNT);
+ ArrayList inputStacks = new ArrayList(itemLimit + fluidLimit);
+
+ for (int i = 0; i < itemLimit; i++) {
+ inputStacks.add(new FixedPositionedStack(this.getRepresentativeInput(i), 48 - i * 18, 5));
+ }
+
+ for (int i = 0; i < fluidLimit; i++) {
+ inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(this.mFluidInputs[i], true), 48 - i * 18, 23));
+ }
+
+ return inputStacks;
+ }
+
+ @Override
+ public ArrayList getOutputPositionedStacks() {
+ int itemLimit = Math.min(mOutputs.length, OUTPUT_COUNT);
+ int fluidLimit = Math.min(mFluidOutputs.length, FLUID_OUTPUT_COUNT);
+ ArrayList outputStacks = new ArrayList(itemLimit + fluidLimit);
+
+ for (int i = 0; i < itemLimit; i++) {
+ outputStacks.add(new FixedPositionedStack(this.getOutput(i), 102 + i * 18, 5));
+ }
+
+ for (int i = 0; i < fluidLimit; i++) {
+ outputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(this.mFluidOutputs[i], true), 102 + i * 18, 23));
+ }
+
+ return outputStacks;
+ }
+
+
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java
index bd9ff07f..fbd57a8c 100644
--- a/src/main/java/gregtech/common/GT_RecipeAdder.java
+++ b/src/main/java/gregtech/common/GT_RecipeAdder.java
@@ -114,6 +114,7 @@ public class GT_RecipeAdder
return false;
}
GT_Recipe.GT_Recipe_Map.sChemicalRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput, aOutput2}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUtick, 0);
+ GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput, aOutput2}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUtick, 0);
return true;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
index a110300c..db3841b3 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
@@ -109,7 +109,7 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
if (inputs.length > 0 || fluids.length > 0) {
long voltage = getMaxInputVoltage();
byte tier = (byte) Math.max(1, GT_Utility.getTier(voltage));
- GT_Recipe recipe = GT_Recipe.GT_Recipe_Map.sChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tier], fluids, inputs);
+ GT_Recipe recipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tier], fluids, inputs);
if (recipe != null && recipe.isRecipeInputEqual(true, fluids, inputs)) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
@@ -154,7 +154,7 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX)
&& !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
&& !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
- if (block == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 14) {
casingAmount++;
} else {
return false;
diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
index 193e8432..26bc6a18 100644
--- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
@@ -359,13 +359,22 @@ public class GT_NEI_DefaultHandler
public class CachedDefaultRecipe
extends TemplateRecipeHandler.CachedRecipe {
public final GT_Recipe mRecipe;
- public final List mOutputs = new ArrayList();
- public final List mInputs = new ArrayList();
+ public final List mOutputs;
+ public final List mInputs;
public CachedDefaultRecipe(GT_Recipe aRecipe) {
super();
this.mRecipe = aRecipe;
+ if (aRecipe.getInputPositionedStacks() != null && aRecipe.getOutputPositionedStacks() != null) {
+ mInputs = aRecipe.getInputPositionedStacks();
+ mOutputs = aRecipe.getOutputPositionedStacks();
+ return;
+ }
+
+ mOutputs = new ArrayList();
+ mInputs = new ArrayList();
+
int tStartIndex = 0;
switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) {
case 0: