diff --git a/docs/content/Modpacks/Changes/v7.5.0.md b/docs/content/Modpacks/Changes/v7.5.0.md index da3f56ba0d7..a2d4c55f107 100644 --- a/docs/content/Modpacks/Changes/v7.5.0.md +++ b/docs/content/Modpacks/Changes/v7.5.0.md @@ -75,6 +75,17 @@ Previously, lamps were not useable with the terminal in multiblocks. There are n The predicate to use all lamps is: `Predicates.anyLamp()` The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want. +## `GTRecipeBuilder#adjacentFluidTag()` and `GTRecipeBuilder#adjacentBlockTag()` +_This is only relevant to **add-on mods** with custom recipe types that use the condition(s). **KubeJS recipes are not affected.**_ + +The renames of `GTRecipeBuilder#adjacentFluid(TagKey...)` -> `#adjacentFluidTag(TagKey...)` and `GTRecipeBuilder#adjacentBlock(TagKey...)` -> `#adjacentBlockTag(TagKey...)` +have been deprecated in favor of naming every variant `adjacentFluids` and `adjacentBlocks`, respectively. +Please update your addon mods' recipes to use these new methods, as the now deprecated methods will be removed come 8.0.0. + +A full list of all deprecated methods & their replacement is as follows: +Fluids: `adjacentFluid`, `adjacentFluidTag` -> `adjacentFluids` +Blocks: `adjacentBlock`, `adjacentBlockTag` -> `adjacentBlocks` + ## Machine Recipe Failure Diagnostics Machines now provide detailed diagnostics explaining why recipes fail to start. @@ -100,6 +111,7 @@ public boolean beforeWorking(@Nullable GTRecipe recipe) { return true; } ``` + ## Painted Output Buses/Hatches For some time, Spray Paint cans could be used to paint Input and Output Buses/Hatches on multiblock machines. Version 7.0.0 added the feature that Painted Input Buses/Hatches of different colors would not share their ingredients with @@ -119,4 +131,4 @@ Addon mods which explicitly attempt to construct, copy, or apply their own Modif their constructor calls, or the additional `recipe.groupColor` to their copy calls. ## Added BiomeTagCondition -Added a new RecipeCondition called BiomeTagCondition for needing a specific biome tag. This can be used with KubeJS using `.biomeTag("biome")`. \ No newline at end of file +Added a new RecipeCondition called BiomeTagCondition for needing a specific biome tag. This can be used with KubeJS using `.biomeTag("biome")`. diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index c9d3eb3eb3b..eb97eff4d6d 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -62,6 +62,7 @@ import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -214,7 +215,7 @@ public GTRecipeBuilder output(RecipeCapability capability, T... obj) { return this; } - public GTRecipeBuilder addCondition(RecipeCondition condition) { + public GTRecipeBuilder addCondition(RecipeCondition condition) { conditions.add(condition); recipeType.setMinRecipeConditions(conditions.size()); return this; @@ -1195,62 +1196,112 @@ public final GTRecipeBuilder adjacentFluids(Fluid... fluids) { public final GTRecipeBuilder adjacentFluids(boolean isReverse, Fluid... fluids) { if (fluids.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); + GTCEu.LOGGER.error("Adjacent fluid condition has too many fluids, not adding to recipe. id: {}", this.id); return this; } return addCondition(AdjacentFluidCondition.fromFluids(fluids).setReverse(isReverse)); } - public final GTRecipeBuilder adjacentFluid(Fluid... fluids) { - return adjacentFluid(false, fluids); + @SafeVarargs + public final GTRecipeBuilder adjacentFluids(TagKey... tags) { + return adjacentFluids(false, tags); } - public final GTRecipeBuilder adjacentFluid(boolean isReverse, Fluid... fluids) { - if (fluids.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); + @SafeVarargs + public final GTRecipeBuilder adjacentFluids(boolean isReverse, TagKey... tags) { + if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { + GTCEu.LOGGER.error("Adjacent fluid condition has too many fluids, not adding to recipe. id: {}", this.id); return this; } - return addCondition(AdjacentFluidCondition.fromFluids(fluids).setReverse(isReverse)); + return addCondition(AdjacentFluidCondition.fromTags(tags).setReverse(isReverse)); + } + + public GTRecipeBuilder adjacentFluids(Collection> fluids) { + return adjacentFluids(fluids, false); + } + + public GTRecipeBuilder adjacentFluids(Collection> fluids, boolean isReverse) { + if (fluids.size() > GTUtil.NON_CORNER_NEIGHBOURS.size()) { + GTCEu.LOGGER.error("Adjacent fluid condition has too many fluids, not adding to recipe. id: {}", this.id); + return this; + } + return addCondition(new AdjacentFluidCondition(isReverse, List.copyOf(fluids))); + } + + /** + * @deprecated use {@link #adjacentFluids(Fluid...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) + public final GTRecipeBuilder adjacentFluid(Fluid... fluids) { + return adjacentFluids(fluids); + } + + /** + * @deprecated use {@link #adjacentFluids(boolean, Fluid...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) + public final GTRecipeBuilder adjacentFluid(boolean isReverse, Fluid... fluids) { + return adjacentFluids(isReverse, fluids); } + /** + * @deprecated use {@link #adjacentFluids(TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentFluidTag(TagKey... tags) { - return adjacentFluidTag(false, tags); + return adjacentFluids(tags); } + /** + * @deprecated use {@link #adjacentFluids(boolean, TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentFluidTag(boolean isReverse, TagKey... tags) { - if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(AdjacentFluidCondition.fromTags(tags).setReverse(isReverse)); + return adjacentFluids(isReverse, tags); } + /** + * @deprecated use {@link #adjacentFluids(TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentFluid(TagKey... tags) { - return adjacentFluid(false, tags); + return adjacentFluids(tags); } + /** + * @deprecated use {@link #adjacentFluids(boolean, TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentFluid(boolean isReverse, TagKey... tags) { - if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(AdjacentFluidCondition.fromTags(tags).setReverse(isReverse)); + return adjacentFluids(isReverse, tags); } + /** + * @deprecated use {@link #adjacentFluids(Collection)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentFluid(Collection> fluids) { - return adjacentFluid(fluids, false); + return adjacentFluids(fluids); } + /** + * @deprecated use {@link #adjacentFluids(Collection, boolean)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentFluid(Collection> fluids, boolean isReverse) { - if (fluids.size() > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many fluids, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(new AdjacentFluidCondition(isReverse, new ArrayList<>(fluids))); + return adjacentFluids(fluids, isReverse); } public GTRecipeBuilder adjacentBlocks(Block... blocks) { @@ -1259,62 +1310,116 @@ public GTRecipeBuilder adjacentBlocks(Block... blocks) { public GTRecipeBuilder adjacentBlocks(boolean isReverse, Block... blocks) { if (blocks.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); + GTCEu.LOGGER.error("Adjacent block condition has too many blocks, not adding to recipe. id: {}", this.id); return this; } return addCondition(AdjacentBlockCondition.fromBlocks(blocks).setReverse(isReverse)); } + @SafeVarargs + public final GTRecipeBuilder adjacentBlocks(TagKey... tags) { + return adjacentBlocks(false, tags); + } + + @SafeVarargs + public final GTRecipeBuilder adjacentBlocks(boolean isReverse, TagKey... tags) { + if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { + GTCEu.LOGGER.error("Adjacent block condition has too many blocks, not adding to recipe. id: {}", this.id); + return this; + } + return addCondition(AdjacentBlockCondition.fromTags(tags).setReverse(isReverse)); + } + + public GTRecipeBuilder adjacentBlocks(Collection> blocks) { + return adjacentBlocks(blocks, false); + } + + public GTRecipeBuilder adjacentBlocks(Collection> blocks, boolean isReverse) { + if (blocks.size() > GTUtil.NON_CORNER_NEIGHBOURS.size()) { + GTCEu.LOGGER.error("Adjacent block condition has too many blocks, not adding to recipe. id: {}", this.id); + return this; + } + return addCondition(new AdjacentBlockCondition(isReverse, List.copyOf(blocks))); + } + + /** + * @deprecated use {@link #adjacentBlocks(Block...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentBlock(Block... blocks) { return adjacentBlock(false, blocks); } + /** + * @deprecated use {@link #adjacentBlocks(boolean, Block...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentBlock(boolean isReverse, Block... blocks) { if (blocks.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); + GTCEu.LOGGER.error("Adjacent block condition has too many blocks, not adding to recipe. id: {}", this.id); return this; } return addCondition(AdjacentBlockCondition.fromBlocks(blocks).setReverse(isReverse)); } + /** + * @deprecated use {@link #adjacentBlocks(TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentBlock(TagKey... tags) { - return adjacentBlock(false, tags); + return adjacentBlocks(tags); } + /** + * @deprecated use {@link #adjacentBlocks(boolean, TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentBlock(boolean isReverse, TagKey... tags) { - if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(AdjacentBlockCondition.fromTags(tags).setReverse(isReverse)); + return adjacentBlocks(isReverse, tags); } + /** + * @deprecated use {@link #adjacentBlocks(TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentBlockTag(TagKey... tags) { - return adjacentBlockTag(false, tags); + return adjacentBlocks(tags); } + /** + * @deprecated use {@link #adjacentBlocks(boolean, TagKey...)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) @SafeVarargs public final GTRecipeBuilder adjacentBlockTag(boolean isReverse, TagKey... tags) { - if (tags.length > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(AdjacentBlockCondition.fromTags(tags).setReverse(isReverse)); + return adjacentBlocks(isReverse, tags); } + /** + * @deprecated use {@link #adjacentBlocks(Collection)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentBlock(Collection> blocks) { - return adjacentBlock(blocks, false); + return adjacentBlocks(blocks); } + /** + * @deprecated use {@link #adjacentBlocks(Collection, boolean)} instead + */ + @ApiStatus.ScheduledForRemoval(inVersion = "8.0.0") + @Deprecated(since = "7.2.1", forRemoval = true) public GTRecipeBuilder adjacentBlock(Collection> blocks, boolean isReverse) { - if (blocks.size() > GTUtil.NON_CORNER_NEIGHBOURS.size()) { - GTCEu.LOGGER.error("Has too many blocks, not adding to recipe, id: {}", this.id); - return this; - } - return addCondition(new AdjacentBlockCondition(isReverse, new ArrayList<>(blocks))); + return adjacentBlocks(blocks, isReverse); } public GTRecipeBuilder daytime(boolean isNight) { diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java index 38914de3715..8ea508e563c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java @@ -89,7 +89,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("cobblestone") .notConsumable(Blocks.COBBLESTONE.asItem()) .outputItems(Blocks.COBBLESTONE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VA[ULV]) .save(provider); @@ -97,7 +97,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("stone") .notConsumable(Blocks.STONE.asItem()) .outputItems(Blocks.STONE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VA[ULV]) .save(provider); @@ -105,7 +105,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("andesite") .notConsumable(Blocks.ANDESITE.asItem()) .outputItems(Blocks.ANDESITE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[MV]) .save(provider); @@ -113,7 +113,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("granite") .notConsumable(Blocks.GRANITE.asItem()) .outputItems(Blocks.GRANITE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[MV]) .save(provider); @@ -121,7 +121,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("diorite") .notConsumable(Blocks.DIORITE.asItem()) .outputItems(Blocks.DIORITE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[MV]) .save(provider); @@ -129,7 +129,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("obsidian") .notConsumable(dust, Redstone) .outputItems(Blocks.OBSIDIAN.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -137,7 +137,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("basalt") .notConsumable(Blocks.BASALT.asItem()) .outputItems(Blocks.BASALT.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -145,7 +145,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("blackstone") .notConsumable(Blocks.BLACKSTONE.asItem()) .outputItems(Blocks.BLACKSTONE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -153,7 +153,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("deepslate") .notConsumable(Blocks.DEEPSLATE.asItem()) .outputItems(Blocks.DEEPSLATE.asItem()) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[EV]) .save(provider); @@ -161,7 +161,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("marble") .notConsumable(rock, Marble) .outputItems(rock, Marble) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -169,7 +169,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("basalt") .notConsumable(rock, Basalt) .outputItems(rock, Basalt) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[HV]) .save(provider); @@ -177,7 +177,7 @@ public static void init(Consumer provider) { ROCK_BREAKER_RECIPES.recipeBuilder("red_granite") .notConsumable(rock, GraniteRed) .outputItems(rock, GraniteRed) - .adjacentFluidTag(FluidTags.LAVA, FluidTags.WATER) + .adjacentFluids(FluidTags.LAVA, FluidTags.WATER) .duration(16) .EUt(VHA[EV]) .save(provider); diff --git a/src/test/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidConditionTest.java b/src/test/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidConditionTest.java index 3a1adb5ac59..4ce72c313de 100644 --- a/src/test/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidConditionTest.java +++ b/src/test/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentFluidConditionTest.java @@ -39,7 +39,7 @@ public static void prepare(ServerLevel level) { .recipeBuilder(GTCEu.id("test_adjacent_fluid_conditions")) .inputItems(new ItemStack(Blocks.COBBLESTONE)) .outputItems(new ItemStack(Blocks.STONE)) - .adjacentFluidTag(FluidTags.WATER) + .adjacentFluids(FluidTags.WATER) .EUt(GTValues.VA[GTValues.HV]) .duration(8) .buildRawRecipe()); @@ -48,7 +48,7 @@ public static void prepare(ServerLevel level) { .recipeBuilder(GTCEu.id("test_adjacent_fluid_conditions_multiple_fluids")) .inputItems(new ItemStack(Blocks.OAK_WOOD)) .outputItems(new ItemStack(Items.CHARCOAL)) - .adjacentFluidTag(FluidTags.WATER, FluidTags.LAVA) + .adjacentFluids(FluidTags.WATER, FluidTags.LAVA) .EUt(GTValues.VA[GTValues.HV]) .duration(8) .buildRawRecipe());