diff --git a/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java index 132c512fa7..5b16d92889 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java @@ -34,6 +34,7 @@ import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction; import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; +import net.neoforged.neoforge.fluids.crafting.DataComponentFluidIngredient; import net.neoforged.neoforge.fluids.crafting.SizedFluidIngredient; @ParametersAreNonnullByDefault @@ -52,9 +53,11 @@ public static void consumeRecipes(Consumer> consumer FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack); Ingredient bottle = Ingredient.of(Items.GLASS_BOTTLE); ResourceLocation id = Create.asResource("potions"); + SizedFluidIngredient fluidIngredient = new SizedFluidIngredient( + DataComponentFluidIngredient.of(false, fluidFromPotionItem), fluidFromPotionItem.getAmount()); FillingRecipe recipe = new StandardProcessingRecipe.Builder<>(FillingRecipe::new, id) .withItemIngredients(bottle) - .withFluidIngredients(SizedFluidIngredient.of(fluidFromPotionItem)) + .withFluidIngredients(fluidIngredient) .withSingleItemOutput(stack) .build(); consumer.accept(new RecipeHolder<>(id, recipe)); @@ -93,9 +96,11 @@ public static void consumeRecipes(Consumer> consumer ResourceLocation fluidName = RegisteredObjectsHelper.getKeyOrThrow(fluidCopy.getFluid()); ResourceLocation id = Create.asResource("fill_" + itemName.getNamespace() + "_" + itemName.getPath() + "_with_" + fluidName.getNamespace() + "_" + fluidName.getPath()); + SizedFluidIngredient fluidIngredient = new SizedFluidIngredient( + DataComponentFluidIngredient.of(false, fluidCopy), fluidCopy.getAmount()); FillingRecipe recipe = new StandardProcessingRecipe.Builder<>(FillingRecipe::new, id) .withItemIngredients(bucket) - .withFluidIngredients(SizedFluidIngredient.of(fluidCopy)) + .withFluidIngredients(fluidIngredient) .withSingleItemOutput(container) .build(); consumer.accept(new RecipeHolder<>(id, recipe)); diff --git a/src/main/java/com/simibubi/create/content/fluids/potion/PotionMixingRecipes.java b/src/main/java/com/simibubi/create/content/fluids/potion/PotionMixingRecipes.java index 8aeb8a90d9..afd2dfc95c 100644 --- a/src/main/java/com/simibubi/create/content/fluids/potion/PotionMixingRecipes.java +++ b/src/main/java/com/simibubi/create/content/fluids/potion/PotionMixingRecipes.java @@ -30,6 +30,7 @@ import net.neoforged.neoforge.common.brewing.BrewingRecipe; import net.neoforged.neoforge.common.brewing.IBrewingRecipe; import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.crafting.DataComponentFluidIngredient; import net.neoforged.neoforge.fluids.crafting.SizedFluidIngredient; public class PotionMixingRecipes { @@ -149,7 +150,7 @@ private static RecipeHolder createRecipe(String id, Ingredient ing ResourceLocation recipeId = Create.asResource(id); MixingRecipe recipe = new Builder<>(MixingRecipe::new, recipeId) .require(ingredient) - .require(SizedFluidIngredient.of(fromFluid)) + .require(new SizedFluidIngredient(DataComponentFluidIngredient.of(false, fromFluid), fromFluid.getAmount())) .output(toFluid) .requiresHeat(HeatCondition.HEATED) .build(); diff --git a/src/main/java/com/simibubi/create/infrastructure/gametest/CreateGameTestHelper.java b/src/main/java/com/simibubi/create/infrastructure/gametest/CreateGameTestHelper.java index b73cac0185..f5c20c8b72 100644 --- a/src/main/java/com/simibubi/create/infrastructure/gametest/CreateGameTestHelper.java +++ b/src/main/java/com/simibubi/create/infrastructure/gametest/CreateGameTestHelper.java @@ -66,6 +66,7 @@ public class CreateGameTestHelper extends GameTestHelper { public static final int TEN_SECONDS = 10 * TICKS_PER_SECOND; public static final int FIFTEEN_SECONDS = 15 * TICKS_PER_SECOND; public static final int TWENTY_SECONDS = 20 * TICKS_PER_SECOND; + public static final int THIRTY_SECONDS = 30 * TICKS_PER_SECOND; private CreateGameTestHelper(GameTestInfo testInfo) { super(testInfo); diff --git a/src/main/java/com/simibubi/create/infrastructure/gametest/tests/TestProcessing.java b/src/main/java/com/simibubi/create/infrastructure/gametest/tests/TestProcessing.java index 151e32902b..921915d3c1 100644 --- a/src/main/java/com/simibubi/create/infrastructure/gametest/tests/TestProcessing.java +++ b/src/main/java/com/simibubi/create/infrastructure/gametest/tests/TestProcessing.java @@ -42,6 +42,25 @@ public static void brassMixing2(CreateGameTestHelper helper) { helper.succeedWhen(() -> helper.assertContainerContains(output, AllItems.BRASS_INGOT.get())); } + @GameTest(template = "potion_brewing", timeoutTicks = CreateGameTestHelper.THIRTY_SECONDS) + public static void potionBrewing(CreateGameTestHelper helper) { + BlockPos chest = new BlockPos(8, 3, 5); + BlockPos potionLever = new BlockPos(2, 3, 4); + BlockPos bottleLever = new BlockPos(7, 3, 2); + ItemStack expected = PotionContents.createItemStack(Items.POTION, Potions.HEALING); + + helper.pullLever(potionLever); + helper.whenSecondsPassed(15, () -> helper.pullLever(bottleLever)); + helper.succeedWhen(() -> helper.assertContainerContains(chest, expected)); + } + + @GameTest(template = "spout_crafting", timeoutTicks = CreateGameTestHelper.TEN_SECONDS) + public static void spoutCrafting(CreateGameTestHelper helper) { + BlockPos chest = new BlockPos(5, 3, 1); + helper.pullLever(2, 3, 2); + helper.succeedWhen(() -> helper.assertContainerContains(chest, Items.REDSTONE)); + } + @GameTest(template = "crushing_wheel_crafting", timeoutTicks = CreateGameTestHelper.TEN_SECONDS) public static void crushingWheelCrafting(CreateGameTestHelper helper) { BlockPos chest = new BlockPos(1, 4, 3); diff --git a/src/main/resources/data/create/structure/gametest/processing/potion_brewing.nbt b/src/main/resources/data/create/structure/gametest/processing/potion_brewing.nbt new file mode 100644 index 0000000000..a93e6c942c Binary files /dev/null and b/src/main/resources/data/create/structure/gametest/processing/potion_brewing.nbt differ diff --git a/src/main/resources/data/create/structure/gametest/processing/spout_crafting.nbt b/src/main/resources/data/create/structure/gametest/processing/spout_crafting.nbt new file mode 100644 index 0000000000..e7f272232d Binary files /dev/null and b/src/main/resources/data/create/structure/gametest/processing/spout_crafting.nbt differ