From 6dbfa03ccaeb52fb5f2e642b80973e61b65de42b Mon Sep 17 00:00:00 2001 From: Alex_hawks Date: Sat, 4 Jan 2014 21:22:17 +0800 Subject: [PATCH] Changed recipe handler to handle fluids --- .../resonantinduction/api/RecipeUtils.java | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/main/java/resonantinduction/api/RecipeUtils.java b/src/main/java/resonantinduction/api/RecipeUtils.java index eed2982c6..fe3699a81 100644 --- a/src/main/java/resonantinduction/api/RecipeUtils.java +++ b/src/main/java/resonantinduction/api/RecipeUtils.java @@ -1,6 +1,7 @@ package resonantinduction.api; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; public class RecipeUtils @@ -23,6 +24,7 @@ public class RecipeUtils } public abstract boolean isEqual(ItemStack is); + public abstract boolean isEqual(FluidStack fs); public boolean hasChance() { @@ -56,6 +58,12 @@ public class RecipeUtils { return is.equals(this.itemStack); } + + @Override + public boolean isEqual(FluidStack fs) + { + return false; + } } public static class OreDictResource extends Resource @@ -79,6 +87,40 @@ public class RecipeUtils { return OreDictionary.getOres(this.name).contains(is); } - } + @Override + public boolean isEqual(FluidStack fs) + { + return false; + } + } + + public static class FluidStackResource extends Resource + { + public final FluidStack fluidStack; + + public FluidStackResource(FluidStack fs) + { + super(); + this.fluidStack = fs; + } + + public FluidStackResource(FluidStack fs, float chance) + { + super(chance); + this.fluidStack = fs; + } + + @Override + public boolean isEqual(ItemStack is) + { + return false; + } + + @Override + public boolean isEqual(FluidStack fs) + { + return fs.isFluidEqual(this.fluidStack); + } + } }