Skip to content

Commit

Permalink
add back BrewingRecipeRegistry support
Browse files Browse the repository at this point in the history
  • Loading branch information
TropheusJ committed Jul 17, 2023
1 parent 60e0d0a commit 42b31f1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ milk_lib_version = 1.2.60

port_lib_version = 2.1.1056+1.20
# adding a module also requires adding a dependency to the FMJ
port_lib_modules = accessors,base,entity,extensions,fake_players,networking,obj_loader,tags,transfer,models,tool_actions,client_events
port_lib_modules = accessors,base,entity,extensions,fake_players,networking,obj_loader,tags,transfer,models,tool_actions,client_events,brewing

night_config_version = 3.6.3
jsr305_version = 3.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder;
import com.simibubi.create.foundation.fluid.FluidIngredient;

import io.github.fabricators_of_create.porting_lib.brewing.BrewingRecipe;
import io.github.fabricators_of_create.porting_lib.brewing.BrewingRecipeRegistry;
import io.github.fabricators_of_create.porting_lib.brewing.IBrewingRecipe;
import io.github.fabricators_of_create.porting_lib.mixin.accessors.common.accessor.PotionBrewing$MixAccessor;
import io.github.fabricators_of_create.porting_lib.mixin.accessors.common.accessor.PotionBrewingAccessor;
import io.github.fabricators_of_create.porting_lib.util.FluidStack;
import me.shedaniel.rei.plugin.common.displays.brewing.BrewingRecipe;
import net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants;
import net.minecraft.core.Registry;
Expand Down Expand Up @@ -93,28 +95,28 @@ private static List<MixingRecipe> createRecipes() {
}

// fabric: no brewing API
// recipeIndex = 0;
// for (IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) {
// if (recipe instanceof BrewingRecipe recipeImpl) {
// ItemStack output = recipeImpl.getOutput();
// if (!SUPPORTED_CONTAINERS.contains(output.getItem())) {
// continue;
// }
//
// Ingredient input = recipeImpl.getInput();
// Ingredient ingredient = recipeImpl.getIngredient();
// FluidStack outputFluid = null;
// for (ItemStack stack : supportedContainerStacks) {
// if (input.test(stack)) {
// FluidStack inputFluid = PotionFluidHandler.getFluidFromPotionItem(stack);
// if (outputFluid == null) {
// outputFluid = PotionFluidHandler.getFluidFromPotionItem(output);
// }
// mixingRecipes.add(createRecipe("potion_mixing_modded_" + recipeIndex++, ingredient, inputFluid, outputFluid));
// }
// }
// }
// }
recipeIndex = 0;
for (IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) {
if (recipe instanceof BrewingRecipe recipeImpl) {
ItemStack output = recipeImpl.getOutput();
if (!SUPPORTED_CONTAINERS.contains(output.getItem())) {
continue;
}

Ingredient input = recipeImpl.getInput();
Ingredient ingredient = recipeImpl.getIngredient();
FluidStack outputFluid = null;
for (ItemStack stack : supportedContainerStacks) {
if (input.test(stack)) {
FluidStack inputFluid = PotionFluidHandler.getFluidFromPotionItem(stack);
if (outputFluid == null) {
outputFluid = PotionFluidHandler.getFluidFromPotionItem(output);
}
mixingRecipes.add(createRecipe("potion_mixing_modded_" + recipeIndex++, ingredient, inputFluid, outputFluid));
}
}
}
}

return mixingRecipes;
}
Expand Down

0 comments on commit 42b31f1

Please sign in to comment.