From e0a8eed365eec51651cd19808d99a2716b4c0c37 Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:56:22 -0500 Subject: [PATCH] Added RecipeKeepDataShapeless Added drill coloring recipes. --- .../9cf54cdf67e16111ec482a2a3b607e8fd75a4246 | 19 ++- .../drill_coloring/dye_drill_black.json | 20 +++ .../drill_coloring/dye_drill_blue.json | 20 +++ .../drill_coloring/dye_drill_brown.json | 20 +++ .../drill_coloring/dye_drill_cyan.json | 20 +++ .../drill_coloring/dye_drill_gray.json | 20 +++ .../drill_coloring/dye_drill_green.json | 20 +++ .../drill_coloring/dye_drill_light_blue.json | 20 +++ .../drill_coloring/dye_drill_light_gray.json | 20 +++ .../drill_coloring/dye_drill_lime.json | 20 +++ .../drill_coloring/dye_drill_magenta.json | 20 +++ .../drill_coloring/dye_drill_orange.json | 20 +++ .../drill_coloring/dye_drill_pink.json | 20 +++ .../drill_coloring/dye_drill_purple.json | 20 +++ .../recipes/drill_coloring/dye_drill_red.json | 20 +++ .../drill_coloring/dye_drill_white.json | 20 +++ .../drill_coloring/dye_drill_yellow.json | 20 +++ .../data/ItemRecipeGenerator.java | 32 ++++- .../mod/ActuallyAdditions.java | 6 +- .../mod/crafting/ActuallyRecipes.java | 1 + .../mod/crafting/RecipeKeepDataShapeless.java | 114 +++++++++++++----- .../mod/crafting/TargetNBTIngredient.java | 4 +- .../resources/META-INF/accesstransformer.cfg | 1 + 23 files changed, 464 insertions(+), 33 deletions(-) create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_black.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_blue.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_brown.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_cyan.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_gray.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_green.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_light_blue.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_light_gray.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_lime.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_magenta.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_orange.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_pink.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_purple.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_red.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_white.json create mode 100644 src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_yellow.json diff --git a/src/generated/resources/.cache/9cf54cdf67e16111ec482a2a3b607e8fd75a4246 b/src/generated/resources/.cache/9cf54cdf67e16111ec482a2a3b607e8fd75a4246 index 6c89c4e9b..31b52d2d5 100644 --- a/src/generated/resources/.cache/9cf54cdf67e16111ec482a2a3b607e8fd75a4246 +++ b/src/generated/resources/.cache/9cf54cdf67e16111ec482a2a3b607e8fd75a4246 @@ -1,4 +1,4 @@ -// 1.20.4 2024-03-13T16:31:58.3504382 Item Recipes +// 1.20.4 2024-03-13T16:30:00.2078814 Item Recipes d374edde9294d1a224b4b5610b50117a11328c00 data/actuallyadditions/recipes/advanced_coil.json f67629e45d152c96f3467a90a67520f78ecf9f07 data/actuallyadditions/recipes/advanced_leaf_blower.json d65e5a70232fa2f0e74d2a67c1cd4b0e87124242 data/actuallyadditions/recipes/basic_coil.json @@ -49,6 +49,22 @@ dd65310cce05d96449b6641f0c29982bd670d623 data/actuallyadditions/recipes/decompre 823c7188829eb50975d857f61e33bc5c2780bb12 data/actuallyadditions/recipes/decompress/void_crystal_shard.json c3592647a1b6de17893a80eeb9ed214f719cc4eb data/actuallyadditions/recipes/diamond_aiot.json 035937b870792a57c0db0b512b41f965af4c8195 data/actuallyadditions/recipes/double_battery.json +ed2c70ef554ccdc2b64ec07966d42668a319d32b data/actuallyadditions/recipes/drill_coloring/dye_drill_black.json +881cee08ef4c9cae7ff0549c896bc9c030a8b0f7 data/actuallyadditions/recipes/drill_coloring/dye_drill_blue.json +cd5471712f938e4b494809e91dd5947cdbd15a6e data/actuallyadditions/recipes/drill_coloring/dye_drill_brown.json +60a3f8cd14f2eb24787929e063abfba3c20fb01d data/actuallyadditions/recipes/drill_coloring/dye_drill_cyan.json +618b10d9093db3ad2b33ccf53a56c89dee8a62d4 data/actuallyadditions/recipes/drill_coloring/dye_drill_gray.json +5de54c56552fd3f448d453133adcae5456b31587 data/actuallyadditions/recipes/drill_coloring/dye_drill_green.json +14ec8cc195f2f741464cb9f110f9eb287a546232 data/actuallyadditions/recipes/drill_coloring/dye_drill_light_blue.json +07b386e726536b8a7e48f1332497adb76e16885e data/actuallyadditions/recipes/drill_coloring/dye_drill_light_gray.json +80e71aca4867f58fb74f090fc37838dd114e124f data/actuallyadditions/recipes/drill_coloring/dye_drill_lime.json +83a7d3a234441da079f014cbbf64a8cd1fcb7ec6 data/actuallyadditions/recipes/drill_coloring/dye_drill_magenta.json +75b0919b05bae59afb8c0c852842dfd17c1d3a92 data/actuallyadditions/recipes/drill_coloring/dye_drill_orange.json +6000e5221d29e456658861e7b35f102606a77ce0 data/actuallyadditions/recipes/drill_coloring/dye_drill_pink.json +f24b883db19649b69dc45faf38621a91fd125f08 data/actuallyadditions/recipes/drill_coloring/dye_drill_purple.json +36312062f28665b65da73f3e735a48cabc0d186e data/actuallyadditions/recipes/drill_coloring/dye_drill_red.json +72a714b78e80f028771b887c6bc865c5850f2fe9 data/actuallyadditions/recipes/drill_coloring/dye_drill_white.json +afbd032dbb1278f1edf020af0e4d5d558f58ad77 data/actuallyadditions/recipes/drill_coloring/dye_drill_yellow.json ac1da42089dad9779f7f8b4d143c35e910a43610 data/actuallyadditions/recipes/drill_core.json 33dc398564081b1ea8b619650b6e292231ef957d data/actuallyadditions/recipes/drill_light_blue.json 201358d5c3c6b02e02de6c35d0a6e62c6fe565eb data/actuallyadditions/recipes/drill_pattern.json @@ -86,6 +102,7 @@ bbda1becc270cf13e6b1d8e6d873aafa0951552d data/actuallyadditions/recipes/lens_of_ 80a2e4f402acab5da96bdf3acd459fce0f930c08 data/actuallyadditions/recipes/quintuple_battery.json c6ff81ba878c02651a9353e490b3a8f9897a5410 data/actuallyadditions/recipes/rice_dough.json bc69015bae99ad4bb1a613a7367469d4401f83ae data/actuallyadditions/recipes/rice_dough_smelting.json +36eb3f29269e14cac10af27e6cd070209446a7b8 data/actuallyadditions/recipes/rice_paper.json 5958ff2fb37430660fb22012212336320ee83dd8 data/actuallyadditions/recipes/rice_seeds.json f6c73cb2e41a8a21e2fda888b28bf52672b33d2e data/actuallyadditions/recipes/rice_slime.json 319b2d0423b79497837f5a3f940011b3bccf09f3 data/actuallyadditions/recipes/rice_slime_potion.json diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_black.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_black.json new file mode 100644 index 000000000..5c401b42d --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_black.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/black" + } + ], + "result": { + "item": "actuallyadditions:drill_black" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_blue.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_blue.json new file mode 100644 index 000000000..ae892b7f9 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_blue.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/blue" + } + ], + "result": { + "item": "actuallyadditions:drill_blue" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_brown.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_brown.json new file mode 100644 index 000000000..11b3cd5f5 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_brown.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/brown" + } + ], + "result": { + "item": "actuallyadditions:drill_brown" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_cyan.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_cyan.json new file mode 100644 index 000000000..6ebf1e26a --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_cyan.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/cyan" + } + ], + "result": { + "item": "actuallyadditions:drill_cyan" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_gray.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_gray.json new file mode 100644 index 000000000..f98a2ca6f --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_gray.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/gray" + } + ], + "result": { + "item": "actuallyadditions:drill_gray" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_green.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_green.json new file mode 100644 index 000000000..97136d90f --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_green.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/green" + } + ], + "result": { + "item": "actuallyadditions:drill_green" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_light_blue.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_light_blue.json new file mode 100644 index 000000000..b7b15955d --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_light_blue.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/light_blue" + } + ], + "result": { + "item": "actuallyadditions:drill_light_blue" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_light_gray.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_light_gray.json new file mode 100644 index 000000000..2be646e96 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_light_gray.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/light_gray" + } + ], + "result": { + "item": "actuallyadditions:drill_light_gray" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_lime.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_lime.json new file mode 100644 index 000000000..33e8bab30 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_lime.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/lime" + } + ], + "result": { + "item": "actuallyadditions:drill_lime" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_magenta.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_magenta.json new file mode 100644 index 000000000..a43e7a933 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_magenta.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/magenta" + } + ], + "result": { + "item": "actuallyadditions:drill_magenta" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_orange.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_orange.json new file mode 100644 index 000000000..e2380ce48 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_orange.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/orange" + } + ], + "result": { + "item": "actuallyadditions:drill_orange" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_pink.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_pink.json new file mode 100644 index 000000000..57e0e37ae --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_pink.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/pink" + } + ], + "result": { + "item": "actuallyadditions:drill_pink" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_purple.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_purple.json new file mode 100644 index 000000000..9fa08510c --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_purple.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/purple" + } + ], + "result": { + "item": "actuallyadditions:drill_purple" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_red.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_red.json new file mode 100644 index 000000000..3811b2517 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_red.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/red" + } + ], + "result": { + "item": "actuallyadditions:drill_red" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_white.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_white.json new file mode 100644 index 000000000..4888e2658 --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_white.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/white" + } + ], + "result": { + "item": "actuallyadditions:drill_white" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_yellow.json b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_yellow.json new file mode 100644 index 000000000..b57da9c8d --- /dev/null +++ b/src/generated/resources/data/actuallyadditions/recipes/drill_coloring/dye_drill_yellow.json @@ -0,0 +1,20 @@ +{ + "type": "actuallyadditions:copy_nbt_shapeless", + "value": { + "category": "misc", + "ingredients": [ + { + "type": "actuallyadditions:target_nbt", + "value": { + "tag": "actuallyadditions:drills" + } + }, + { + "tag": "forge:dyes/yellow" + } + ], + "result": { + "item": "actuallyadditions:drill_yellow" + } + } +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java index 5c7ee2d1a..91d49626c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java @@ -1,9 +1,11 @@ package de.ellpeck.actuallyadditions.data; +import de.ellpeck.actuallyadditions.api.ActuallyTags; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition; import de.ellpeck.actuallyadditions.mod.crafting.RecipeKeepDataShaped; +import de.ellpeck.actuallyadditions.mod.crafting.RecipeKeepDataShapeless; import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput; @@ -18,11 +20,13 @@ import net.minecraft.data.recipes.ShapelessRecipeBuilder; import net.minecraft.data.recipes.SimpleCookingRecipeBuilder; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.ShapedRecipe; +import net.minecraft.world.item.crafting.ShapelessRecipe; import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.ItemLike; import net.neoforged.neoforge.common.Tags; @@ -238,6 +242,25 @@ public class ItemRecipeGenerator extends RecipeProvider { .define('R', ActuallyItems.DRILL_CORE.get()) .define('I', ActuallyItems.ENORI_CRYSTAL.get()).save(recipeOutput); + // Drill Colors + dyeDrill(ActuallyItems.DRILL_BLACK, Tags.Items.DYES_BLACK, recipeOutput); + dyeDrill(ActuallyItems.DRILL_RED, Tags.Items.DYES_RED, recipeOutput); + dyeDrill(ActuallyItems.DRILL_GREEN, Tags.Items.DYES_GREEN, recipeOutput); + dyeDrill(ActuallyItems.DRILL_BROWN, Tags.Items.DYES_BROWN, recipeOutput); + dyeDrill(ActuallyItems.DRILL_BLUE, Tags.Items.DYES_BLUE, recipeOutput); + dyeDrill(ActuallyItems.DRILL_PURPLE, Tags.Items.DYES_PURPLE, recipeOutput); + dyeDrill(ActuallyItems.DRILL_CYAN, Tags.Items.DYES_CYAN, recipeOutput); + dyeDrill(ActuallyItems.DRILL_LIGHT_GRAY, Tags.Items.DYES_LIGHT_GRAY, recipeOutput); + dyeDrill(ActuallyItems.DRILL_GRAY, Tags.Items.DYES_GRAY, recipeOutput); + dyeDrill(ActuallyItems.DRILL_PINK, Tags.Items.DYES_PINK, recipeOutput); + dyeDrill(ActuallyItems.DRILL_LIME, Tags.Items.DYES_LIME, recipeOutput); + dyeDrill(ActuallyItems.DRILL_YELLOW, Tags.Items.DYES_YELLOW, recipeOutput); + dyeDrill(ActuallyItems.DRILL_MAIN, Tags.Items.DYES_LIGHT_BLUE, recipeOutput); + dyeDrill(ActuallyItems.DRILL_ORANGE, Tags.Items.DYES_ORANGE, recipeOutput); + dyeDrill(ActuallyItems.DRILL_WHITE, Tags.Items.DYES_WHITE, recipeOutput); + dyeDrill(ActuallyItems.DRILL_MAGENTA, Tags.Items.DYES_MAGENTA, recipeOutput); + + //Drill Core Recipe.shaped(ActuallyItems.DRILL_CORE.get()) .pattern("ICI") @@ -583,7 +606,14 @@ public class ItemRecipeGenerator extends RecipeProvider { addPaxel(consumer, ActuallyItems.GOLD_AIOT, Items.GOLDEN_AXE, Items.GOLDEN_PICKAXE, Items.GOLDEN_SWORD, Items.GOLDEN_SHOVEL, Items.GOLDEN_HOE); addPaxel(consumer, ActuallyItems.DIAMOND_AIOT, Items.DIAMOND_AXE, Items.DIAMOND_PICKAXE, Items.DIAMOND_SWORD, Items.DIAMOND_SHOVEL, Items.DIAMOND_HOE); addPaxel(consumer, ActuallyItems.NETHERITE_AIOT, Items.NETHERITE_AXE, Items.NETHERITE_PICKAXE, Items.NETHERITE_SWORD, Items.NETHERITE_SHOVEL, Items.NETHERITE_HOE); -} + } + + private static void dyeDrill(DeferredItem result, TagKey dyeItem, RecipeOutput recipeOutput) { + Recipe.shapeless(result.get()) + .requires(TargetNBTIngredient.of(ActuallyTags.Items.DRILLS)) + .requires(dyeItem) + .save(new RecipeInjector(recipeOutput, RecipeKeepDataShapeless::new), new ResourceLocation(ActuallyAdditions.MODID, "drill_coloring/dye_" + BuiltInRegistries.ITEM.getKey(result.get()).getPath())); + } public static void addPaxel(RecipeOutput consumer, DeferredItem output, Item axe, Item pickaxe, Item sword, Item shovel, Item hoe) { Recipe.shapeless(output.get()) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index b6c9daf84..607d75c8c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -68,8 +68,8 @@ import net.neoforged.neoforge.event.server.ServerStoppedEvent; import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; import net.neoforged.neoforge.registries.NeoForgeRegistries; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.function.Supplier; @@ -86,7 +86,7 @@ public class ActuallyAdditions { public static final String GUIFACTORY = "de.ellpeck.actuallyadditions.mod.config.GuiFactory"; public static final String DEPS = "required:forge@[14.23.5.2836,);before:craftingtweaks;after:fastbench@[1.3.2,)"; - public static final Logger LOGGER = LogManager.getLogger(NAME); + public static final Logger LOGGER = LoggerFactory.getLogger(MODID); private static final DeferredRegister> ENTITIES = DeferredRegister.create(BuiltInRegistries.ENTITY_TYPE, MODID); public static final Supplier> ENTITY_WORM = ENTITIES.register("worm", () -> EntityType.Builder.of(EntityWorm::new, MobCategory.MISC).build(MODID + ":worm")); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java index 9bb786a5b..9c8d7b17b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java @@ -21,6 +21,7 @@ public class ActuallyRecipes { } public static final Supplier> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new); + public static final Supplier> KEEP_DATA_SHAPELESS_RECIPE = SERIALIZERS.register(RecipeKeepDataShapeless.NAME, RecipeKeepDataShapeless.Serializer::new); public static final Supplier> LASER_RECIPE = SERIALIZERS.register(LaserRecipe.NAME, LaserRecipe.Serializer::new); public static final Supplier> EMPOWERING_RECIPE = SERIALIZERS.register(EmpowererRecipe.NAME, EmpowererRecipe.Serializer::new); public static final Supplier> CRUSHING_RECIPE = SERIALIZERS.register(CrushingRecipe.NAME, CrushingRecipe.Serializer::new); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java index 43d5167fd..8bc287397 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java @@ -10,31 +10,91 @@ package de.ellpeck.actuallyadditions.mod.crafting; -// TODO: [port] MOVE TO DATA_GENERATOR -@Deprecated -public class RecipeKeepDataShapeless {// extends ShapelessOreRecipe { - // - // private final ItemStack nbtCopyStack; - // - // public RecipeKeepDataShapeless(ResourceLocation group, ItemStack result, ItemStack nbtCopyStack, Object... recipe) { - // super(group, result, recipe); - // this.nbtCopyStack = nbtCopyStack; - // - // RecipeHelper.addRecipe(group.getPath(), this); - // } - // - // @Override - // public ItemStack getCraftingResult(InventoryCrafting inventory) { - // ItemStack stack = super.getCraftingResult(inventory); - // if (StackUtil.isValid(stack)) { - // for (int i = 0; i < inventory.getSizeInventory(); i++) { - // ItemStack input = inventory.getStackInSlot(i); - // if (ItemUtil.areItemsEqual(this.nbtCopyStack, input, true)) { - // stack.setTagCompound(input.getTagCompound()); - // break; - // } - // } - // } - // return stack; - // } +import com.mojang.serialization.Codec; +import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import net.minecraft.core.NonNullList; +import net.minecraft.core.RegistryAccess; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.ShapelessRecipe; +import net.neoforged.neoforge.attachment.AttachmentInternals; + +public class RecipeKeepDataShapeless extends ShapelessRecipe { + public static String NAME = "copy_nbt_shapeless"; + public RecipeKeepDataShapeless(String pGroup, CraftingBookCategory pCategory, ItemStack pResult, NonNullList pIngredients) { + super(pGroup, pCategory, pResult, pIngredients); + } + public RecipeKeepDataShapeless(ShapelessRecipe recipe) { + super(recipe.getGroup(), recipe.category(), recipe.getResultItem(RegistryAccess.EMPTY), recipe.getIngredients()); + } + + @Override + public RecipeSerializer getSerializer() { + return ActuallyRecipes.KEEP_DATA_SHAPELESS_RECIPE.get(); + } + + @Override + public ItemStack assemble(CraftingContainer pContainer, RegistryAccess pRegistryAccess) { + ItemStack result = super.assemble(pContainer, pRegistryAccess); + + TargetNBTIngredient donorIngredient = null; + ItemStack datasource = ItemStack.EMPTY; + NonNullList ingredients = getIngredients(); + for (Ingredient ingredient : ingredients) { + if (ingredient instanceof TargetNBTIngredient) { + donorIngredient = (TargetNBTIngredient) ingredient; + break; + } + } + + if (donorIngredient != null && !pContainer.isEmpty()) { + for (int i = 0; i < pContainer.getContainerSize(); i++) { + final ItemStack item = pContainer.getItem(i); + if (!item.isEmpty() && donorIngredient.test(item)) { + datasource = item; + break; + } + } + } + + if (!datasource.isEmpty() && datasource.hasTag()) + result.setTag(datasource.getTag().copy()); + else { + ActuallyAdditions.LOGGER.info("AA.KeepDataShapeless missing TargetNBTIngredient"); + return ItemStack.EMPTY; + } + + if (!datasource.isEmpty()) + AttachmentInternals.copyStackAttachments(datasource, result); + + return result; + } + + public static class Serializer implements RecipeSerializer { + public static final Codec CODEC = ShapelessRecipe.Serializer.CODEC.xmap(RecipeKeepDataShapeless::new, $ -> $); + @Override + public Codec codec() { + return CODEC; + } + + @Override + public RecipeKeepDataShapeless fromNetwork(FriendlyByteBuf pBuffer) { + return new RecipeKeepDataShapeless(RecipeSerializer.SHAPELESS_RECIPE.fromNetwork(pBuffer)); + } + + @Override + public void toNetwork(net.minecraft.network.FriendlyByteBuf pBuffer, RecipeKeepDataShapeless pRecipe) { + try { + RecipeSerializer.SHAPELESS_RECIPE.toNetwork(pBuffer, pRecipe); + } + catch (Exception e) { + ActuallyAdditions.LOGGER.info("Failed to serialize " + NAME + " Recipe to packet: " + e.getMessage()); + throw e; + } + } + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java index c6413700c..2dadc131a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java @@ -2,11 +2,13 @@ package de.ellpeck.actuallyadditions.mod.crafting; import com.mojang.serialization.Codec; import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.ItemLike; import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.stream.Stream; @@ -34,7 +36,7 @@ public class TargetNBTIngredient extends Ingredient { public static TargetNBTIngredient of(ItemStack itemStack) { return new TargetNBTIngredient(Stream.of(new ItemValue(itemStack))); } - public static TargetNBTIngredient of(TagKey tag) { + public static TargetNBTIngredient of(@Nonnull TagKey tag) { return new TargetNBTIngredient(Stream.of(new TagValue(tag))); } } \ No newline at end of file diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 5054fc344..66112eb33 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -3,6 +3,7 @@ public net.minecraft.world.damagesource.DamageSources damageTypes public-f net.minecraft.data.recipes.RecipeProvider getName()Ljava/lang/String; public-f net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList list public net.minecraft.world.item.crafting.ShapedRecipe pattern +public net.minecraft.world.item.crafting.ShapelessRecipe$Serializer CODEC # Codec public net.minecraft.world.inventory.InventoryMenu TEXTURE_EMPTY_SLOTS public net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool templates public-f net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool rawTemplates