mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-08 19:04:46 +00:00
fix nei issue with mariculture in #223
This commit is contained in:
6 files changed
+80
-22
No files matched your search
@@ -19,6 +19,8 @@ import static codechicken.lib.gui.GuiDraw.*;
|
||||
|
||||
public abstract class BaseRecipeHandler extends TemplateRecipeHandler implements IGuiWrapper
|
||||
{
|
||||
public static final String FLUID_LOOKUP_ID = "mekanism.fluid";
|
||||
|
||||
public BaseRecipeHandler()
|
||||
{
|
||||
addGuiElements();
|
||||
@@ -28,6 +30,11 @@ public abstract class BaseRecipeHandler extends TemplateRecipeHandler implements
|
||||
|
||||
public abstract void addGuiElements();
|
||||
|
||||
public static boolean isFluidLookup(String id)
|
||||
{
|
||||
return "fluid".equals(id) || FLUID_LOOKUP_ID.equals(id);
|
||||
}
|
||||
|
||||
public void displayGauge(int length, int xPos, int yPos, int overlayX, int overlayY, int scale, FluidStack fluid, GasStack gas)
|
||||
{
|
||||
if(fluid == null && gas == null)
|
||||
@@ -122,20 +129,29 @@ public abstract class BaseRecipeHandler extends TemplateRecipeHandler implements
|
||||
*/
|
||||
public boolean doFluidLookup(FluidStack stack, boolean type)
|
||||
{
|
||||
if(stack != null && stack.amount > 0)
|
||||
if(stack != null && stack.amount > 0 && stack.getFluid() != null)
|
||||
{
|
||||
if(type)
|
||||
FluidStack copy = stack.copy();
|
||||
|
||||
try
|
||||
{
|
||||
if(!GuiUsageRecipe.openRecipeGui("fluid", new Object[] {stack}))
|
||||
if(type)
|
||||
{
|
||||
return false;
|
||||
if(!GuiUsageRecipe.openRecipeGui(FLUID_LOOKUP_ID, new Object[] {copy}))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!GuiCraftingRecipe.openRecipeGui(FLUID_LOOKUP_ID, new Object[] {copy}))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!GuiCraftingRecipe.openRecipeGui("fluid", new Object[] {stack}))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch(Throwable ignored)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -143,7 +159,7 @@ public abstract class BaseRecipeHandler extends TemplateRecipeHandler implements
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawTexturedRect(int x, int y, int u, int v, int w, int h)
|
||||
{
|
||||
|
||||
@@ -135,9 +135,11 @@ public class ChemicalWasherRecipeHandler extends BaseRecipeHandler
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
if(isFluidLookup(inputId) && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
{
|
||||
if(((FluidStack)ingredients[0]).getFluid() == FluidRegistry.WATER)
|
||||
FluidStack fluid = (FluidStack)ingredients[0];
|
||||
|
||||
if(fluid.getFluid() == FluidRegistry.WATER)
|
||||
{
|
||||
for(WasherRecipe irecipe : getRecipes())
|
||||
{
|
||||
|
||||
@@ -187,11 +187,18 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
if(isFluidLookup(inputId) && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
{
|
||||
FluidStack fluid = (FluidStack)ingredients[0];
|
||||
|
||||
if(fluid.getFluid() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(SeparatorRecipe irecipe : getRecipes())
|
||||
{
|
||||
if(irecipe.recipeInput.ingredient.isFluidEqual((FluidStack)ingredients[0]))
|
||||
if(irecipe != null && irecipe.recipeInput != null && irecipe.recipeInput.ingredient != null && irecipe.recipeInput.ingredient.isFluidEqual(fluid))
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe));
|
||||
}
|
||||
|
||||
@@ -219,11 +219,18 @@ public class PRCRecipeHandler extends BaseRecipeHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
else if(isFluidLookup(inputId) && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
{
|
||||
FluidStack fluid = (FluidStack)ingredients[0];
|
||||
|
||||
if(fluid.getFluid() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(Map.Entry<PressurizedInput, PressurizedRecipe> irecipe : getRecipes())
|
||||
{
|
||||
if(irecipe.getKey().containsType((FluidStack)ingredients[0]))
|
||||
if(irecipe != null && irecipe.getKey() != null && irecipe.getKey().containsType(fluid))
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe));
|
||||
}
|
||||
|
||||
@@ -128,9 +128,15 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler
|
||||
arecipes.add(new CachedIORecipe(new GasStack(gas.getGas(), 1), new FluidStack(gas.getGas().getFluid(), 1), false));
|
||||
}
|
||||
}
|
||||
else if(outputId.equals("fluid") && results.length == 1 && results[0] instanceof FluidStack)
|
||||
else if(isFluidLookup(outputId) && results.length == 1 && results[0] instanceof FluidStack)
|
||||
{
|
||||
FluidStack fluid = (FluidStack)results[0];
|
||||
|
||||
if(fluid.getFluid() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Gas gas = GasRegistry.getGas(fluid.getFluid());
|
||||
|
||||
if(gas != null)
|
||||
@@ -155,9 +161,15 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler
|
||||
arecipes.add(new CachedIORecipe(new GasStack(gas.getGas(), 1), new FluidStack(gas.getGas().getFluid(), 1), true));
|
||||
}
|
||||
}
|
||||
else if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
else if(isFluidLookup(inputId) && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
{
|
||||
FluidStack fluid = (FluidStack)ingredients[0];
|
||||
|
||||
if(fluid.getFluid() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Gas gas = GasRegistry.getGas(fluid.getFluid());
|
||||
|
||||
if(gas != null)
|
||||
|
||||
@@ -113,11 +113,18 @@ public class ThermalEvaporationRecipeHandler extends BaseRecipeHandler
|
||||
arecipes.add(new CachedIORecipe(irecipe));
|
||||
}
|
||||
}
|
||||
else if(outputId.equals("fluid") && results.length == 1 && results[0] instanceof FluidStack)
|
||||
else if(isFluidLookup(outputId) && results.length == 1 && results[0] instanceof FluidStack)
|
||||
{
|
||||
FluidStack fluid = (FluidStack)results[0];
|
||||
|
||||
if(fluid.getFluid() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(ThermalEvaporationRecipe irecipe : getRecipes())
|
||||
{
|
||||
if(((FluidStack)results[0]).isFluidEqual(irecipe.recipeOutput.output))
|
||||
if(irecipe != null && irecipe.recipeOutput != null && irecipe.recipeOutput.output != null && fluid.isFluidEqual(irecipe.recipeOutput.output))
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe));
|
||||
}
|
||||
@@ -131,11 +138,18 @@ public class ThermalEvaporationRecipeHandler extends BaseRecipeHandler
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
if(isFluidLookup(inputId) && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
|
||||
{
|
||||
FluidStack fluid = (FluidStack)ingredients[0];
|
||||
|
||||
if(fluid.getFluid() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(ThermalEvaporationRecipe irecipe : getRecipes())
|
||||
{
|
||||
if(irecipe.recipeInput.ingredient.isFluidEqual((FluidStack)ingredients[0]))
|
||||
if(irecipe != null && irecipe.recipeInput != null && irecipe.recipeInput.ingredient != null && irecipe.recipeInput.ingredient.isFluidEqual(fluid))
|
||||
{
|
||||
arecipes.add(new CachedIORecipe(irecipe));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user