Skip to content

Commit

Permalink
Add more 1.21(.4) content recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Dec 19, 2024
1 parent b4c1094 commit 02ac676
Show file tree
Hide file tree
Showing 7 changed files with 372 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changelog-next.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
- Steel Gears use 3d models when held in hand (2d texture otherwise).
- Changed recipe of Arithmetic Operator and Data Memory to include Cable.
- Boolean Data now returns 15 redstone power for true and 0 for false.
- Added Grinder recipe for Wind Charges and Eyeblossom dyes.
- Added Press recipe for Bundle and Mace.
- Added Mixer recipe for dyed Bundle and Shulker Box.
- Recipes now use Fabric's Convention tag for Stripped Logs.
- Fixed Funnels pulling items form blocks using Fabric Storage API loosing last stack if the storage becomes empty.
- Fixed Conveyors sometimes deleting items.
Expand Down
32 changes: 26 additions & 6 deletions src/main/java/eu/pb4/polyfactory/datagen/RecipesProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@
import eu.pb4.polyfactory.fluid.FactoryFluids;
import eu.pb4.polyfactory.fluid.FluidStack;
import eu.pb4.polyfactory.item.FactoryDataComponents;
import eu.pb4.polyfactory.item.FactoryItemTags;
import eu.pb4.polyfactory.item.FactoryItems;
import eu.pb4.polyfactory.mixin.BrewingRecipeRegistryAccessor;
import eu.pb4.polyfactory.other.FactorySoundEvents;
import eu.pb4.polyfactory.recipe.*;
import eu.pb4.polyfactory.recipe.drain.PotionAddDrainRecipe;
import eu.pb4.polyfactory.recipe.drain.PotionRemoveDrainRecipe;
import eu.pb4.polyfactory.recipe.fluid.RemovingFluidInteractionRecipe;
import eu.pb4.polyfactory.recipe.fluid.SimpleFluidInteractionRecipe;
import eu.pb4.polyfactory.recipe.spout.*;
import eu.pb4.polyfactory.recipe.input.FluidInputStack;
import eu.pb4.polyfactory.recipe.mixing.*;
import eu.pb4.polyfactory.recipe.press.FillSprayCanPressRecipe;
import eu.pb4.polyfactory.recipe.press.GenericPressRecipe;
import eu.pb4.polyfactory.recipe.spout.PotionSpoutRecipe;
import eu.pb4.polyfactory.recipe.spout.RepairSpoutRecipe;
import eu.pb4.polyfactory.recipe.spout.SimpleDrainRecipe;
import eu.pb4.polyfactory.recipe.spout.SimpleSpoutRecipe;
import eu.pb4.polyfactory.util.DyeColorExtra;
import eu.pb4.polyfactory.other.FactorySoundEvents;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags;
Expand Down Expand Up @@ -708,6 +710,7 @@ public void generate() {
),
GrindingRecipe.of("bone_to_bone_meal", Ingredient.ofItems(Items.BONE), 1, 5, 10, OutputStack.of(Items.BONE_MEAL, 1, 3), OutputStack.of(Items.BONE_MEAL, 0.5f, 2)),
GrindingRecipe.of("blaze_rod_to_powder", Ingredient.ofItems(Items.BLAZE_ROD), 2, 5, 10, OutputStack.of(Items.BLAZE_POWDER, 1, 2), OutputStack.of(Items.BLAZE_POWDER, 0.5f, 2)),
GrindingRecipe.of("breeze_rod_to_charge", Ingredient.ofItems(Items.BREEZE_ROD), 2, 5, 10, OutputStack.of(Items.WIND_CHARGE, 1, 4), OutputStack.of(Items.WIND_CHARGE, 0.5f, 2)),
GrindingRecipe.of("glowstone_to_powder", Ingredient.ofItems(Items.GLOWSTONE), 1, 5, 10, new ItemStack(Items.GLOWSTONE_DUST, 4)),
GrindingRecipe.of("sugar", Ingredient.ofItems(Items.SUGAR_CANE), 1, 5, OutputStack.of(Items.SUGAR, 1f, 1), OutputStack.of(Items.SUGAR, 0.4f, 1)),

Expand Down Expand Up @@ -742,7 +745,9 @@ public void generate() {
GrindingRecipe.of("peony_to_dye", "dye", Ingredient.ofItems(Items.PEONY), 1, 6, new ItemStack(Items.PINK_DYE, 6)),
GrindingRecipe.of("rose_to_dye", "dye", Ingredient.ofItems(Items.ROSE_BUSH), 1, 6, new ItemStack(Items.RED_DYE, 6)),
GrindingRecipe.of("pitcher_to_dye", "dye", Ingredient.ofItems(Items.PITCHER_PLANT), 1, 6, new ItemStack(Items.CYAN_DYE, 6)),
GrindingRecipe.of("cactus_to_dye", "dye", Ingredient.ofItems(Items.CACTUS), 1, 6, new ItemStack(Items.GREEN_DYE, 3))
GrindingRecipe.of("cactus_to_dye", "dye", Ingredient.ofItems(Items.CACTUS), 1, 6, new ItemStack(Items.GREEN_DYE, 3)),
GrindingRecipe.of("closed_eyeblossom_to_dye", "dye", Ingredient.ofItems(Items.CLOSED_EYEBLOSSOM), 1, 6, new ItemStack(Items.GRAY_DYE, 3)),
GrindingRecipe.of("open_eyeblossom_to_dye", "dye", Ingredient.ofItems(Items.OPEN_EYEBLOSSOM), 1, 6, new ItemStack(Items.ORANGE_DYE, 3))
);

offerSmelting(List.of(FactoryItems.CRUSHED_RAW_IRON), RecipeCategory.MISC, Items.IRON_INGOT, 0.5F, 180, "iron_ingot");
Expand Down Expand Up @@ -792,7 +797,12 @@ public void generate() {
5, OutputStack.of(Items.GOLDEN_APPLE)),
GenericPressRecipe.of("spray_can", CountedIngredient.ofItems(1, Items.BUCKET), CountedIngredient.ofItems(1, Items.COPPER_INGOT),
5f, OutputStack.of(FactoryItems.SPRAY_CAN)),
new RecipeEntry<>(recipeKey("press/spray_can_fill"), new FillSprayCanPressRecipe(12))
new RecipeEntry<>(recipeKey("press/spray_can_fill"), new FillSprayCanPressRecipe(12)),
GenericPressRecipe.of("bundle", CountedIngredient.ofItems(1, Items.LEATHER), CountedIngredient.ofItems(1, Items.STRING),
3, OutputStack.of(Items.BUNDLE)),
GenericPressRecipe.of("", CountedIngredient.ofItems(1, Items.HEAVY_CORE),
CountedIngredient.ofItems(1, Items.BREEZE_ROD),
6, OutputStack.of(Items.MACE))
);

for (var i = 0; i < 5; i++) {
Expand Down Expand Up @@ -884,6 +894,16 @@ public void generate() {
.offerTo(exporter, recipeKey("windmill_sail/wool/" + dye.getColor()));
}

{
var bundle = Registries.ITEM.get(Identifier.ofVanilla(dye.getColor().asString() + "_bundle"));
var shulker = Registries.ITEM.get(Identifier.ofVanilla(dye.getColor().asString() + "_shulker_box"));
of(exporter, TransformMixingRecipe.of(dye.getColor().asString() + "_bundle", "bundle_coloring",
this.ingredientFromTag(ItemTags.BUNDLES), List.of(Ingredient.ofItems(dye)), 2, 2, 5, bundle.getDefaultStack()),
TransformMixingRecipe.of(dye.getColor().asString() + "_shulker", "shulker_coloring",
this.ingredientFromTag(ItemTags.SHULKER_BOXES), List.of(Ingredient.ofItems(dye)), 2, 2, 5, shulker.getDefaultStack()
));
}

{
var nameSolid = dye.getColor().getName() + "_concrete";
var namePowder = nameSolid + "_powder";
Expand All @@ -893,7 +913,7 @@ public void generate() {
of(exporter, GrindingRecipe.of(nameSolid + "_to_powder", "concrete_to_powder",
Ingredient.ofItems(solid), 3, 5, powder
));

of(exporter, GenericMixingRecipe.ofCounted(namePowder, "concrete_powder",
List.of(CountedIngredient.fromTag(4, itemWrap.getOrThrow(ItemTags.SMELTS_TO_GLASS)), CountedIngredient.ofItems(4, Items.GRAVEL), CountedIngredient.ofItems(1, dye)),
4, 1, 13, new ItemStack(powder, 8)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import eu.pb4.polyfactory.recipe.ColoringCraftingRecipe;
import eu.pb4.polyfactory.recipe.GrindingRecipe;
import eu.pb4.factorytools.api.recipe.OutputStack;
import eu.pb4.polyfactory.recipe.mixing.TransformMixingRecipe;
import eu.pb4.polyfactory.recipe.spout.SimpleDrainRecipe;
import eu.pb4.polyfactory.recipe.spout.SimpleSpoutRecipe;
import eu.pb4.polyfactory.recipe.input.FluidInputStack;
Expand Down Expand Up @@ -57,6 +58,7 @@ public class PolydexCompatImpl {
public static void register() {
PolydexPage.registerRecipeViewer(GenericPressRecipe.class, PressRecipePage::new);
PolydexPage.registerRecipeViewer(GenericMixingRecipe.class, GenericMixerRecipePage::new);
PolydexPage.registerRecipeViewer(TransformMixingRecipe.class, TransformMixerRecipePage::new);
PolydexPage.registerRecipeViewer(BrewingMixingRecipe.class, BrewingMixerRecipePage::new);
PolydexPage.registerRecipeViewer(GrindingRecipe.class, GrindingRecipePage::new);
PolydexPage.registerRecipeViewer(ColoringCraftingRecipe.class, ColoringCraftingRecipePage::new);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package eu.pb4.polyfactory.polydex.pages;

import eu.pb4.factorytools.api.recipe.CountedIngredient;
import eu.pb4.factorytools.api.util.ItemComponentPredicate;
import eu.pb4.polyfactory.fluid.FluidStack;
import eu.pb4.polyfactory.recipe.input.FluidInputStack;
import eu.pb4.polyfactory.recipe.mixing.GenericMixingRecipe;
import eu.pb4.polyfactory.recipe.mixing.TransformMixingRecipe;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.RecipeEntry;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

public class TransformMixerRecipePage extends MixerRecipePage<TransformMixingRecipe> {

public TransformMixerRecipePage(RecipeEntry<TransformMixingRecipe> recipe) {
super(recipe);
}

@Override
protected List<FluidInputStack> getFluidInput() {
return this.recipe.fluidInput();
}

@Override
protected List<CountedIngredient> getItemInput() {
var list = new ArrayList<CountedIngredient>(this.recipe.input().size() + 1);
list.add(new CountedIngredient(Optional.of(this.recipe.base()), ItemComponentPredicate.EMPTY, 1, ItemStack.EMPTY));
list.addAll(this.recipe.input());
return list;
}

@Override
protected List<FluidStack<?>> getFluidOutput() {
return this.recipe.fluidOutput();
}

@Override
protected ItemStack getItemOutput() {
return this.recipe.output();
}

@Override
protected float getMaxTemperature() {
return this.recipe.maxTemperature();
}

@Override
protected float getMinimumTemperature() {
return this.recipe.minimumTemperature();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class FactoryRecipeSerializers {
public static final LazyRecipeSerializer<ColoringMixingRecipe> MIXING_COLORING = register("mixing/coloring", ColoringMixingRecipe.CODEC);

public static final LazyRecipeSerializer<GenericMixingRecipe> MIXING_GENERIC = register("mixing/generic", GenericMixingRecipe.CODEC);
public static final LazyRecipeSerializer<TransformMixingRecipe> MIXING_TRANSFORM = register("mixing/transform", TransformMixingRecipe.CODEC);
public static final LazyRecipeSerializer<FireworkStarMixingRecipe> MIXING_FIREWORK = register("mixing/firework", FireworkStarMixingRecipe.CODEC);
public static final LazyRecipeSerializer<ArtificialDyeMixingRecipe> MIXING_ARTIFICIAL_DYE = register("mixing/artificial_dye", ArtificialDyeMixingRecipe.CODEC);
public static final LazyRecipeSerializer<BrewingMixingRecipe> MIXING_BREWING = register("mixing/brewing", BrewingMixingRecipe.CODEC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ public static RecipeEntry<GenericMixingRecipe> of(String string, List<Ingredient
return new RecipeEntry<>(FactoryUtil.recipeKey("mixing/" + string), new GenericMixingRecipe("", list, Optional.of(List.of()), output, List.of(), mixingTime, minimumSpeed, optimalSpeed, -1f, 2f));
}

public static RecipeEntry<GenericMixingRecipe> of(String string, String group, List<Ingredient> ingredient, double mixingTime, double minimumSpeed, double optimalSpeed, ItemStack output) {
List<CountedIngredient> list = new ArrayList<>();
for (Ingredient x : ingredient) {
CountedIngredient countedIngredient = new CountedIngredient(Optional.of(x), ItemComponentPredicate.EMPTY, 1, CountedIngredient.tryGettingLeftover(x));
list.add(countedIngredient);
}
return new RecipeEntry<>(FactoryUtil.recipeKey("mixing/" + string), new GenericMixingRecipe(group, list, Optional.of(List.of()), output, List.of(), mixingTime, minimumSpeed, optimalSpeed, -1f, 2f));
}

@Override
public String getGroup() {
return this.group;
Expand Down
Loading

0 comments on commit 02ac676

Please sign in to comment.