Add JEI integration for fluid generators recipes

This commit is contained in:
Ourten 2016-12-18 04:02:51 +01:00
parent 1d27182cc2
commit baebc948d9
9 changed files with 241 additions and 28 deletions

View file

@ -1,5 +1,20 @@
package techreborn.api.generator;
import javax.annotation.Nonnull;
public enum EFluidGenerator {
THERMAL, GAS, DIESEL, SEMIFLUID
THERMAL("TechReborn.ThermalGenerator"), GAS("TechReborn.GasGenerator"), DIESEL(
"TechReborn.DieselGenerator"), SEMIFLUID("TechReborn.SemifluidGenerator");
@Nonnull
private final String recipeID;
private EFluidGenerator(@Nonnull String recipeID) {
this.recipeID = recipeID;
}
@Nonnull
public String getRecipeID() {
return recipeID;
}
}

View file

@ -3,34 +3,32 @@ package techreborn.api.generator;
import net.minecraftforge.fluids.Fluid;
public class FluidGeneratorRecipe {
private Fluid fluid;
private int energyPerMb;
private final EFluidGenerator generatorType;
private final Fluid fluid;
private final int energyPerMb;
public FluidGeneratorRecipe(Fluid fluid, int energyPerMb)
public FluidGeneratorRecipe(Fluid fluid, int energyPerMb, EFluidGenerator generatorType)
{
this.fluid = fluid;
this.energyPerMb = energyPerMb;
this.generatorType = generatorType;
}
public Fluid getFluid() {
return fluid;
}
public void setFluid(Fluid fluid) {
this.fluid = fluid;
}
public int getEnergyPerMb() {
return energyPerMb;
}
public void setEnergyPerMb(int energyPerMb) {
this.energyPerMb = energyPerMb;
public EFluidGenerator getGeneratorType() {
return generatorType;
}
@Override
public String toString() {
return "FluidGeneratorRecipe [fluid=" + fluid + ", energyPerMb=" + energyPerMb + "]";
return "FluidGeneratorRecipe [generatorType=" + generatorType + ", fluid=" + fluid + ", energyPerMb="
+ energyPerMb + "]";
}
@Override
@ -39,6 +37,7 @@ public class FluidGeneratorRecipe {
int result = 1;
result = prime * result + energyPerMb;
result = prime * result + ((fluid == null) ? 0 : fluid.hashCode());
result = prime * result + ((generatorType == null) ? 0 : generatorType.hashCode());
return result;
}
@ -58,6 +57,8 @@ public class FluidGeneratorRecipe {
return false;
} else if (!fluid.equals(other.fluid))
return false;
if (generatorType != other.generatorType)
return false;
return true;
}
}

View file

@ -28,7 +28,7 @@ public class GeneratorRecipeHelper {
*/
public static void registerFluidRecipe(EFluidGenerator generatorType, Fluid fluidType, int energyPerMb) {
fluidRecipes.putIfAbsent(generatorType, new FluidGeneratorRecipeList());
fluidRecipes.get(generatorType).addRecipe(new FluidGeneratorRecipe(fluidType, energyPerMb));
fluidRecipes.get(generatorType).addRecipe(new FluidGeneratorRecipe(fluidType, energyPerMb, generatorType));
}
/**