|
12 | 12 | import gregtech.api.recipes.Recipe; |
13 | 13 | import gregtech.api.recipes.RecipeBuilder; |
14 | 14 | import gregtech.api.recipes.RecipeMap; |
| 15 | +import gregtech.api.recipes.RecipeMapBuilder; |
15 | 16 | import gregtech.api.recipes.builders.BlastRecipeBuilder; |
16 | 17 | import gregtech.api.unification.material.Materials; |
17 | 18 | import gregtech.api.util.GTUtility; |
|
24 | 25 | import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockPart; |
25 | 26 |
|
26 | 27 | import net.minecraft.init.Blocks; |
| 28 | +import net.minecraft.init.Items; |
27 | 29 | import net.minecraft.item.ItemStack; |
28 | 30 | import net.minecraft.util.ResourceLocation; |
29 | 31 | import net.minecraft.world.World; |
|
38 | 40 | import java.lang.reflect.InvocationTargetException; |
39 | 41 | import java.lang.reflect.Method; |
40 | 42 |
|
41 | | -import static org.hamcrest.CoreMatchers.is; |
42 | | -import static org.hamcrest.CoreMatchers.nullValue; |
| 43 | +import static org.hamcrest.CoreMatchers.*; |
43 | 44 |
|
44 | 45 | public class IParallelableRecipeLogicTest { |
45 | 46 |
|
@@ -713,6 +714,44 @@ public MetaTileEntity getMetaTileEntity() { |
713 | 714 | MatcherAssert.assertThat(outputRecipe, nullValue()); |
714 | 715 | } |
715 | 716 |
|
| 717 | + @Test |
| 718 | + public void findParallelRecipe_SmallMaxStackSize() { |
| 719 | + MetaTileEntityElectricBlastFurnace EBF = initEBF(521); |
| 720 | + |
| 721 | + int parallelLimit = 4; |
| 722 | + |
| 723 | + // Create a recipe Map to be used for testing |
| 724 | + RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("electric_blast_furnace", new BlastRecipeBuilder()) |
| 725 | + .itemInputs(3).itemOutputs(2).fluidInputs(1).fluidOutputs(1).build(); |
| 726 | + |
| 727 | + // Create a simple recipe to be used for testing |
| 728 | + // Use an output item with small max stack size |
| 729 | + Recipe recipe = map.recipeBuilder() |
| 730 | + .inputs(new ItemStack(Blocks.COBBLESTONE)) |
| 731 | + .outputs(new ItemStack(Items.ELYTRA)) |
| 732 | + .blastFurnaceTemp(1000) |
| 733 | + .EUt(30).duration(100) |
| 734 | + .build().getResult(); |
| 735 | + |
| 736 | + IParallelableRecipeLogic logic = new ParallelableTestLogic(EBF, map, ParallelLogicType.MULTIPLY); |
| 737 | + |
| 738 | + // Populate the Input Bus |
| 739 | + importItemBus.getImportItems().insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); |
| 740 | + |
| 741 | + // Saturate the export bus, except for one slot |
| 742 | + exportItemBus.getExportItems().insertItem(0, new ItemStack(Blocks.BONE_BLOCK, 16), false); |
| 743 | + exportItemBus.getExportItems().insertItem(1, new ItemStack(Blocks.BONE_BLOCK, 16), false); |
| 744 | + exportItemBus.getExportItems().insertItem(2, new ItemStack(Blocks.BONE_BLOCK, 16), false); |
| 745 | + |
| 746 | + RecipeBuilder<?> parallelRecipe = logic.findMultipliedParallelRecipe(map, recipe, |
| 747 | + importItemBus.getImportItems(), importFluidBus.getImportFluids(), |
| 748 | + exportItemBus.getExportItems(), exportFluidBus.getExportFluids(), parallelLimit, Integer.MAX_VALUE, |
| 749 | + EBF); |
| 750 | + |
| 751 | + MatcherAssert.assertThat(parallelRecipe, notNullValue()); |
| 752 | + MatcherAssert.assertThat(parallelRecipe.getParallel(), is(1)); |
| 753 | + } |
| 754 | + |
716 | 755 | @Test |
717 | 756 | public void applyParallelBonus_Test() { |
718 | 757 | MetaTileEntityElectricBlastFurnace EBF = initEBF(518); |
|
0 commit comments