Fix NEI support to dynamically accept different gas types
This commit is contained in:
parent
ee2b81c3fd
commit
740f4581b0
5 changed files with 36 additions and 16 deletions
|
@ -11,6 +11,7 @@ import java.util.Map.Entry;
|
|||
import java.util.Set;
|
||||
|
||||
import mekanism.api.AdvancedInput;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.ObfuscatedNames;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -34,7 +35,7 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
|
|||
|
||||
public abstract Set<Entry<AdvancedInput, ItemStack>> getRecipes();
|
||||
|
||||
public abstract List<ItemStack> getFuelStacks();
|
||||
public abstract List<ItemStack> getFuelStacks(Gas gasType);
|
||||
|
||||
@Override
|
||||
public void drawBackground(int i)
|
||||
|
@ -77,9 +78,9 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
|
|||
{
|
||||
if(outputId.equals(getRecipeId()))
|
||||
{
|
||||
for(Map.Entry irecipe : getRecipes())
|
||||
for(Map.Entry<AdvancedInput, ItemStack> irecipe : getRecipes())
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks()));
|
||||
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getKey().gasType)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -90,11 +91,11 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
|
|||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
for(Map.Entry irecipe : getRecipes())
|
||||
for(Map.Entry<AdvancedInput, ItemStack> irecipe : getRecipes())
|
||||
{
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getValue(), result))
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks()));
|
||||
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getKey().gasType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +109,7 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
|
|||
{
|
||||
if(irecipe.getKey().gasType == ((GasStack)ingredients[0]).getGas())
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks()));
|
||||
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getKey().gasType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +125,7 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
|
|||
{
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getKey().itemStack, ingredient))
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks()));
|
||||
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getKey().gasType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package mekanism.client.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.ListUtils;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.client.gui.GuiChemicalInjectionChamber;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -45,11 +46,20 @@ public class ChemicalInjectionChamberRecipeHandler extends AdvancedMachineRecipe
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getFuelStacks()
|
||||
public List<ItemStack> getFuelStacks(Gas gasType)
|
||||
{
|
||||
List<ItemStack> fuels = OreDictionary.getOres("dustSulfur");
|
||||
fuels.add(MekanismUtils.getFullGasTank(GasRegistry.getGas("sulfuricAcid")));
|
||||
return fuels;
|
||||
if(gasType == GasRegistry.getGas("sulfuricAcid"))
|
||||
{
|
||||
List<ItemStack> fuels = OreDictionary.getOres("dustSulfur");
|
||||
fuels.add(MekanismUtils.getFullGasTank(GasRegistry.getGas("sulfuricAcid")));
|
||||
return fuels;
|
||||
}
|
||||
else if(gasType == GasRegistry.getGas("water"))
|
||||
{
|
||||
return ListUtils.asList(MekanismUtils.getFullGasTank(GasRegistry.getGas("water")));
|
||||
}
|
||||
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import mekanism.api.ListUtils;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.client.gui.GuiCombiner;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -42,7 +43,7 @@ public class CombinerRecipeHandler extends AdvancedMachineRecipeHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getFuelStacks()
|
||||
public List<ItemStack> getFuelStacks(Gas gasType)
|
||||
{
|
||||
return ListUtils.asList(new ItemStack(Block.cobblestone));
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import mekanism.api.ListUtils;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.client.gui.GuiOsmiumCompressor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
|
@ -42,7 +43,7 @@ public class OsmiumCompressorRecipeHandler extends AdvancedMachineRecipeHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getFuelStacks()
|
||||
public List<ItemStack> getFuelStacks(Gas gasType)
|
||||
{
|
||||
return ListUtils.asList(new ItemStack(Mekanism.Ingot, 1, 1));
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package mekanism.client.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.ListUtils;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.client.gui.GuiPurificationChamber;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
|
@ -44,9 +46,14 @@ public class PurificationChamberRecipeHandler extends AdvancedMachineRecipeHandl
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getFuelStacks()
|
||||
public List<ItemStack> getFuelStacks(Gas gasType)
|
||||
{
|
||||
return ListUtils.asList(new ItemStack(Item.flint), MekanismUtils.getFullGasTank(GasRegistry.getGas("oxygen")));
|
||||
if(gasType == GasRegistry.getGas("oxygen"))
|
||||
{
|
||||
return ListUtils.asList(new ItemStack(Item.flint), MekanismUtils.getFullGasTank(GasRegistry.getGas("oxygen")));
|
||||
}
|
||||
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue