Added ability to remove fluidgenerator recipe via CT. Closes #1404
This commit is contained in:
parent
91a56077d8
commit
c69b9f46b6
2 changed files with 44 additions and 0 deletions
|
@ -27,6 +27,7 @@ package techreborn.api.generator;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class GeneratorRecipeHelper {
|
public class GeneratorRecipeHelper {
|
||||||
|
|
||||||
|
@ -62,4 +63,18 @@ public class GeneratorRecipeHelper {
|
||||||
public static FluidGeneratorRecipeList getFluidRecipesForGenerator(EFluidGenerator generatorType) {
|
public static FluidGeneratorRecipeList getFluidRecipesForGenerator(EFluidGenerator generatorType) {
|
||||||
return fluidRecipes.get(generatorType);
|
return fluidRecipes.get(generatorType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes recipe
|
||||||
|
*
|
||||||
|
* @param generatorType A value of the EFluidGenerator type for which we should remove recipe
|
||||||
|
* @param fluidType Fluid to remove from generator recipes
|
||||||
|
*/
|
||||||
|
public static void removeFluidRecipe(EFluidGenerator generatorType, Fluid fluidType) {
|
||||||
|
FluidGeneratorRecipeList recipeList = getFluidRecipesForGenerator(generatorType);
|
||||||
|
Optional<FluidGeneratorRecipe> recipe = recipeList.getRecipeForFluid(fluidType);
|
||||||
|
if (recipe.isPresent()) {
|
||||||
|
recipeList.removeRecipe(recipe.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,36 @@ public class CTFluidGen {
|
||||||
addFluid(EFluidGenerator.PLASMA, fluid, energyPerMb);
|
addFluid(EFluidGenerator.PLASMA, fluid, energyPerMb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ZenMethod
|
||||||
|
public static void removeThermalFluid(ILiquidStack fluid) {
|
||||||
|
removeFluid(EFluidGenerator.THERMAL, fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ZenMethod
|
||||||
|
public static void removeGasFluid(ILiquidStack fluid) {
|
||||||
|
removeFluid(EFluidGenerator.GAS, fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ZenMethod
|
||||||
|
public static void removeSemiFluid(ILiquidStack fluid) {
|
||||||
|
removeFluid(EFluidGenerator.SEMIFLUID, fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ZenMethod
|
||||||
|
public static void removeDieselFluid(ILiquidStack fluid) {
|
||||||
|
removeFluid(EFluidGenerator.DIESEL, fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ZenMethod
|
||||||
|
public static void removePlasmaFluid(ILiquidStack fluid) {
|
||||||
|
removeFluid(EFluidGenerator.PLASMA, fluid);
|
||||||
|
}
|
||||||
|
|
||||||
private static void addFluid(EFluidGenerator type, ILiquidStack fluid, int energyPerMb) {
|
private static void addFluid(EFluidGenerator type, ILiquidStack fluid, int energyPerMb) {
|
||||||
GeneratorRecipeHelper.registerFluidRecipe(type, CraftTweakerCompat.toFluidStack(fluid).getFluid(), energyPerMb);
|
GeneratorRecipeHelper.registerFluidRecipe(type, CraftTweakerCompat.toFluidStack(fluid).getFluid(), energyPerMb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void removeFluid(EFluidGenerator type, ILiquidStack fluid) {
|
||||||
|
GeneratorRecipeHelper.removeFluidRecipe(type, CraftTweakerCompat.toFluidStack(fluid).getFluid());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue