From db9095e0f73aeeee6ba5bebeb754a086ccff0c81 Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:23:15 -0600 Subject: [PATCH] Fixed drill dyeing recipes, Closes #1459 --- CHANGELOG.md | 4 +++ .../9cf54cdf67e16111ec482a2a3b607e8fd75a4246 | 36 +++++++++---------- .../drill_coloring/dye_drill_black.json | 5 ++- .../recipe/drill_coloring/dye_drill_blue.json | 5 ++- .../drill_coloring/dye_drill_brown.json | 5 ++- .../recipe/drill_coloring/dye_drill_cyan.json | 5 ++- .../recipe/drill_coloring/dye_drill_gray.json | 5 ++- .../drill_coloring/dye_drill_green.json | 5 ++- .../drill_coloring/dye_drill_light_blue.json | 5 ++- .../drill_coloring/dye_drill_light_gray.json | 5 ++- .../recipe/drill_coloring/dye_drill_lime.json | 5 ++- .../drill_coloring/dye_drill_magenta.json | 5 ++- .../drill_coloring/dye_drill_orange.json | 5 ++- .../recipe/drill_coloring/dye_drill_pink.json | 5 ++- .../drill_coloring/dye_drill_purple.json | 5 ++- .../recipe/drill_coloring/dye_drill_red.json | 5 ++- .../drill_coloring/dye_drill_white.json | 5 ++- .../drill_coloring/dye_drill_yellow.json | 5 ++- .../recipe/tagged_sticky_piston.json | 2 +- .../data/ItemRecipeGenerator.java | 24 ++++++------- .../mod/crafting/ActuallyRecipes.java | 3 +- .../mod/crafting/RecipeKeepDataShaped.java | 16 ++++++--- .../mod/crafting/RecipeKeepDataShapeless.java | 18 ++++++---- ...nt.java => TargetComponentIngredient.java} | 24 ++++++------- 24 files changed, 134 insertions(+), 73 deletions(-) rename src/main/java/de/ellpeck/actuallyadditions/mod/crafting/{TargetNBTIngredient.java => TargetComponentIngredient.java} (56%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f14de124..62a7e2649 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.3.12+mc1.21.1 +* Fixed the Drill dye recipes not functioning. +* Fixed the name of the first drill speed augment. + # 1.3.11+mc1.21.1 * Fixed Farmer not playing well with non-vanilla farmland. * Added the ability to change the farmers work area with a compass. diff --git a/src/generated/resources/.cache/9cf54cdf67e16111ec482a2a3b607e8fd75a4246 b/src/generated/resources/.cache/9cf54cdf67e16111ec482a2a3b607e8fd75a4246 index 2cfc6a4d9..b68194e86 100644 --- a/src/generated/resources/.cache/9cf54cdf67e16111ec482a2a3b607e8fd75a4246 +++ b/src/generated/resources/.cache/9cf54cdf67e16111ec482a2a3b607e8fd75a4246 @@ -1,4 +1,4 @@ -// 1.21.1 2024-11-07T15:26:09.7156836 Item Recipes +// 1.21.1 2024-12-06T21:14:51.7296768 Item Recipes 14bd5bc2ee3e84b6f3a3181c0e0efd40df5f1d84 data/actuallyadditions/recipe/advanced_coil.json 955aad6c1def123a6adbaeabb13faa6eedce847f data/actuallyadditions/recipe/advanced_leaf_blower.json 97e7ba64f5054b030f4e49615dc4212a28ca9be1 data/actuallyadditions/recipe/basic_coil.json @@ -49,22 +49,22 @@ aa04cb95f6c723f631b968afbd0037192e0a46aa data/actuallyadditions/recipe/decompres 263394a8ccab3e239b870b78bf4d1dca959f6c08 data/actuallyadditions/recipe/decompress/void_crystal_shard.json 5c9c0603f78ceb6de7e55a398fed6d30e44936c9 data/actuallyadditions/recipe/diamond_aiot.json d449363a6a4b89c8a718d98cde294cc648a9b485 data/actuallyadditions/recipe/double_battery.json -836d06df12ebb1b4506ebd3b95f4d488a62ec0c4 data/actuallyadditions/recipe/drill_coloring/dye_drill_black.json -fb1f5a571b19ef49a899d5776b626118342108b3 data/actuallyadditions/recipe/drill_coloring/dye_drill_blue.json -84d5c995ee33352d69ee5c2aa83c3968affbcebb data/actuallyadditions/recipe/drill_coloring/dye_drill_brown.json -e58498cdfe8fe51b04292864f62711af67b44d35 data/actuallyadditions/recipe/drill_coloring/dye_drill_cyan.json -ce971f33b9e8be10e43fc7e7be91a0573ff45f73 data/actuallyadditions/recipe/drill_coloring/dye_drill_gray.json -fa6c5ffc9f742799ac639a3138ce8bb5b548b4c2 data/actuallyadditions/recipe/drill_coloring/dye_drill_green.json -087149df86c0332d9f321c1c092db0ad33c967dd data/actuallyadditions/recipe/drill_coloring/dye_drill_light_blue.json -11821c443c3fcea44d4527ddc8f8a51133853133 data/actuallyadditions/recipe/drill_coloring/dye_drill_light_gray.json -7df9ef361d0b366860bbf92424cf0d0bf79035f9 data/actuallyadditions/recipe/drill_coloring/dye_drill_lime.json -698cf24c334d5bb05f447a4fdf8f1e5546e20b1f data/actuallyadditions/recipe/drill_coloring/dye_drill_magenta.json -e447436880c0370d9a0158a7ee47cc6a95a0dd0f data/actuallyadditions/recipe/drill_coloring/dye_drill_orange.json -022958646fc11a838f9083ecd553f7a051020a06 data/actuallyadditions/recipe/drill_coloring/dye_drill_pink.json -78490dfd929a5bbd4ece14ec098f98ca8e7cc854 data/actuallyadditions/recipe/drill_coloring/dye_drill_purple.json -5e1a4f23d9d596bed5f2aebca574002918a5fb97 data/actuallyadditions/recipe/drill_coloring/dye_drill_red.json -91e28015934f2e49144760cb4c454b9593d1b85e data/actuallyadditions/recipe/drill_coloring/dye_drill_white.json -1122df15841403bfb97f6e020090abb1e9494796 data/actuallyadditions/recipe/drill_coloring/dye_drill_yellow.json +2632116b27a8f0c5697ffc12a540520ff4817c00 data/actuallyadditions/recipe/drill_coloring/dye_drill_black.json +1c6242d3910f3afe4e270113c8a402823da6b0cb data/actuallyadditions/recipe/drill_coloring/dye_drill_blue.json +eb357e471110e905e5f7d0531dcac3dcb01ad4ff data/actuallyadditions/recipe/drill_coloring/dye_drill_brown.json +ac1a0baad5a287c1e655ada7ce98cc6aaecc83f9 data/actuallyadditions/recipe/drill_coloring/dye_drill_cyan.json +e6219d74254bea00addcdf08f1a644f847968a6e data/actuallyadditions/recipe/drill_coloring/dye_drill_gray.json +6d0c945fa07d8f8842a9099f2ff608e224b085a7 data/actuallyadditions/recipe/drill_coloring/dye_drill_green.json +a6cef0e184cff8f11084778dc0a72d05485f3fbc data/actuallyadditions/recipe/drill_coloring/dye_drill_light_blue.json +79f98f436372c3f85a35fbd3d7a3de42a8117d1f data/actuallyadditions/recipe/drill_coloring/dye_drill_light_gray.json +5f843e257dd0e03d73656d8d1733b63aab750124 data/actuallyadditions/recipe/drill_coloring/dye_drill_lime.json +525a514e7d376f3d0819dc95955ba3276b74c5d9 data/actuallyadditions/recipe/drill_coloring/dye_drill_magenta.json +cd022566bfd3bf7abd37c81e63223bbbd4b8c83d data/actuallyadditions/recipe/drill_coloring/dye_drill_orange.json +b9f81ade143cdd026cb61ee0bc72c712152c599d data/actuallyadditions/recipe/drill_coloring/dye_drill_pink.json +991e75b85e40ac7ee488c4680294f566a0a6bcd2 data/actuallyadditions/recipe/drill_coloring/dye_drill_purple.json +6d10bb7fee0bfc22662ecbe7a9e8946dabb2ab40 data/actuallyadditions/recipe/drill_coloring/dye_drill_red.json +755eddac6c3de13163f24ddb268717d174c6c2a2 data/actuallyadditions/recipe/drill_coloring/dye_drill_white.json +2c3431723d0a68b86ab19e290ae87331b968189c data/actuallyadditions/recipe/drill_coloring/dye_drill_yellow.json 3226a302f425ab52edb0c6008c7a4eb10cb2fd18 data/actuallyadditions/recipe/drill_core.json 8df3f7b20c8c46ed492b314aa4322b6a00178417 data/actuallyadditions/recipe/drill_light_blue.json f146fe12be4b36cd125d85ea25e26d5288198f72 data/actuallyadditions/recipe/drill_pattern.json @@ -131,7 +131,7 @@ b5bcd0457a68e28d37312f1a1e94a106d3b6f038 data/actuallyadditions/recipe/ring_of_g f31206c1d67ddc93e41d13f24d54e8d6b5913348 data/actuallyadditions/recipe/single_battery.json 9504d2a8e3cb536cf865e8385a013743a0d615d0 data/actuallyadditions/recipe/stone_aiot.json bd83fca2a318f4b513a38310e4b3d26f87ab9439 data/actuallyadditions/recipe/tagged_slime_block.json -7e657b2d9a1aeea7fc93f8be27b4a32f814f21e4 data/actuallyadditions/recipe/tagged_sticky_piston.json +685c36302163f912fd6979181f9c07fdc21e317a data/actuallyadditions/recipe/tagged_sticky_piston.json b40274260097d19ae4f925e31982d8bfad3acd84 data/actuallyadditions/recipe/teleport_staff.json b0e94b90682d5224dd995c15b26d6df50fd78dd6 data/actuallyadditions/recipe/tiny_to_charcoal.json a60310bd6c5ec1368137372aed468e673cd1fd00 data/actuallyadditions/recipe/tiny_to_coal.json diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_black.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_black.json index 12ee2cab4..21f5ac18e 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_black.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_black.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/black" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_blue.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_blue.json index c13cd3264..37655589d 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_blue.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_blue.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/blue" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_brown.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_brown.json index e1fcf0798..f2b6f0ed3 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_brown.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_brown.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/brown" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_cyan.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_cyan.json index c6de8e709..5c63e21f6 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_cyan.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_cyan.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/cyan" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_gray.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_gray.json index 6992b3e31..0552d27ad 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_gray.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_gray.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/gray" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_green.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_green.json index 755e14faf..7a21e084a 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_green.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_green.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/green" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_light_blue.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_light_blue.json index 14dc45f5e..a79a7dc66 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_light_blue.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_light_blue.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/light_blue" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_light_gray.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_light_gray.json index fc84a8987..e90fd3af9 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_light_gray.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_light_gray.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/light_gray" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_lime.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_lime.json index 20a4623d3..104f541df 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_lime.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_lime.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/lime" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_magenta.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_magenta.json index 620664a54..9c52db196 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_magenta.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_magenta.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/magenta" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_orange.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_orange.json index 504daf535..e48675cbd 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_orange.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_orange.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/orange" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_pink.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_pink.json index aab31e8c0..1351e80b7 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_pink.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_pink.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/pink" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_purple.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_purple.json index 2a98d0d9c..53b116ca3 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_purple.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_purple.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/purple" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_red.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_red.json index f9914f4aa..1572041f5 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_red.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_red.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/red" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_white.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_white.json index 7cee4e280..c3b4d09d7 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_white.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_white.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/white" diff --git a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_yellow.json b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_yellow.json index a7f2509f4..6e1138736 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_yellow.json +++ b/src/generated/resources/data/actuallyadditions/recipe/drill_coloring/dye_drill_yellow.json @@ -3,7 +3,10 @@ "category": "misc", "ingredients": [ { - "tag": "actuallyadditions:drills" + "type": "actuallyadditions:target_nbt", + "base": { + "tag": "actuallyadditions:drills" + } }, { "tag": "c:dyes/yellow" diff --git a/src/generated/resources/data/actuallyadditions/recipe/tagged_sticky_piston.json b/src/generated/resources/data/actuallyadditions/recipe/tagged_sticky_piston.json index f5e2520f4..3c842b277 100644 --- a/src/generated/resources/data/actuallyadditions/recipe/tagged_sticky_piston.json +++ b/src/generated/resources/data/actuallyadditions/recipe/tagged_sticky_piston.json @@ -6,7 +6,7 @@ "item": "minecraft:piston" }, "R": { - "tag": "c:slimeballs" + "tag": "c:slime_balls" } }, "pattern": [ diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java index 2483724e7..aeca921dc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/ItemRecipeGenerator.java @@ -6,7 +6,7 @@ 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.crafting.TargetComponentIngredient; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput; import de.ellpeck.actuallyadditions.mod.util.RecipeInjector; @@ -46,6 +46,7 @@ public class ItemRecipeGenerator extends RecipeProvider { super(packOutput, lookupProvider); } + @Nonnull @Override public String getName() { return "Item " + super.getName(); @@ -162,9 +163,8 @@ public class ItemRecipeGenerator extends RecipeProvider { //Killer Lens ItemStack enchantedBook = new ItemStack(Items.ENCHANTED_BOOK); - if (enchantmentLookup != null) { - enchantedBook.enchant(enchantmentLookup.getOrThrow(Enchantments.SHARPNESS), 5); - } + enchantedBook.enchant(enchantmentLookup.getOrThrow(Enchantments.SHARPNESS), 5); + Recipe.shapeless(ActuallyItems.LENS_OF_THE_KILLER.get()) .requires(Items.DIAMOND_SWORD) .requires(ActuallyItems.LENS_OF_CERTAIN_DEATH.get()) @@ -409,7 +409,7 @@ public class ItemRecipeGenerator extends RecipeProvider { .pattern(" R ") .pattern("ICI") .pattern("III") - .define('R', TargetNBTIngredient.of(ActuallyItems.SINGLE_BATTERY.get())) + .define('R', TargetComponentIngredient.of(ActuallyItems.SINGLE_BATTERY.get())) .define('I', ActuallyItems.ENORI_CRYSTAL.get()) .define('C', ActuallyItems.ADVANCED_COIL.get()) .save(new RecipeInjector(recipeOutput, RecipeKeepDataShaped::new)); @@ -419,7 +419,7 @@ public class ItemRecipeGenerator extends RecipeProvider { .pattern(" R ") .pattern("ICI") .pattern("III") - .define('R', TargetNBTIngredient.of(ActuallyItems.DOUBLE_BATTERY.get())) + .define('R', TargetComponentIngredient.of(ActuallyItems.DOUBLE_BATTERY.get())) .define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get()) .define('C', ActuallyItems.ADVANCED_COIL.get()) .save(new RecipeInjector(recipeOutput, RecipeKeepDataShaped::new)); @@ -429,7 +429,7 @@ public class ItemRecipeGenerator extends RecipeProvider { .pattern(" R ") .pattern("ICI") .pattern("III") - .define('R', TargetNBTIngredient.of(ActuallyItems.TRIPLE_BATTERY.get())) + .define('R', TargetComponentIngredient.of(ActuallyItems.TRIPLE_BATTERY.get())) .define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get()) .define('C', ActuallyItems.ADVANCED_COIL.get()) .save(new RecipeInjector(recipeOutput, RecipeKeepDataShaped::new)); @@ -439,7 +439,7 @@ public class ItemRecipeGenerator extends RecipeProvider { .pattern(" R ") .pattern("ICI") .pattern("III") - .define('R', TargetNBTIngredient.of(ActuallyItems.QUADRUPLE_BATTERY.get())) + .define('R', TargetComponentIngredient.of(ActuallyItems.QUADRUPLE_BATTERY.get())) .define('I', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get()) .define('C', ActuallyItems.ADVANCED_COIL.get()) .save(new RecipeInjector(recipeOutput, RecipeKeepDataShaped::new)); @@ -533,14 +533,14 @@ public class ItemRecipeGenerator extends RecipeProvider { // Sticky Piston from tagged slime balls Recipe.shaped(Items.STICKY_PISTON) .pattern("R", "P") - .define('R', Tags.Items.SLIMEBALLS) + .define('R', Tags.Items.SLIME_BALLS) .define('P', Items.PISTON) .save(recipeOutput, ActuallyAdditions.modLoc("tagged_sticky_piston")); // Slime block from tagged balls Recipe.shaped(Items.SLIME_BLOCK) .pattern("RRR", "RRR", "RRR") - .define('R', Tags.Items.SLIMEBALLS) + .define('R', Tags.Items.SLIME_BALLS) .save(recipeOutput, ActuallyAdditions.modLoc("tagged_slime_block")); //Shards @@ -650,7 +650,7 @@ public class ItemRecipeGenerator extends RecipeProvider { private static void dyeDrill(DeferredItem result, TagKey dyeItem, RecipeOutput recipeOutput) { Recipe.shapeless(result.get()) - .requires(Ingredient.of(ActuallyTags.Items.DRILLS)) //TargetNBTIngredient + .requires(TargetComponentIngredient.of(ActuallyTags.Items.DRILLS)) .requires(dyeItem) .save(new RecipeInjector(recipeOutput, RecipeKeepDataShapeless::new), ActuallyAdditions.modLoc("drill_coloring/dye_" + BuiltInRegistries.ITEM.getKey(result.get()).getPath())); } @@ -807,7 +807,7 @@ public class ItemRecipeGenerator extends RecipeProvider { } } - private static class Shaped extends ShapedRecipeBuilder { + public static class Shaped extends ShapedRecipeBuilder { public Shaped(ItemLike resultIn) { this(resultIn, 1); } 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 9c8d7b17b..65775baf7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ActuallyRecipes.java @@ -52,6 +52,7 @@ public class ActuallyRecipes { public static class Ingredients { public static final DeferredRegister> INGREDIENTS = DeferredRegister.create(NeoForgeRegistries.Keys.INGREDIENT_TYPES, ActuallyAdditions.MODID); - public static final Supplier> TARGET_NBT = INGREDIENTS.register("target_nbt", () -> new IngredientType<>(TargetNBTIngredient.CODEC)); + //TODO change name from nbt in 1.22 + public static final Supplier> TARGET_NBT = INGREDIENTS.register("target_nbt", () -> new IngredientType<>(TargetComponentIngredient.CODEC)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java index 6f0787718..8a913fe87 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java @@ -12,21 +12,24 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.ShapedRecipe; +import javax.annotation.Nonnull; + public class RecipeKeepDataShaped extends ShapedRecipe { public static String NAME = "copy_nbt"; public RecipeKeepDataShaped(ShapedRecipe shapedRecipe) { super(shapedRecipe.getGroup(), shapedRecipe.category(), shapedRecipe.pattern, shapedRecipe.getResultItem(null)); } + @Nonnull @Override - public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { + public ItemStack assemble(@Nonnull CraftingInput inv, @Nonnull HolderLookup.Provider registries) { final ItemStack craftingResult = super.assemble(inv, registries); - TargetNBTIngredient donorIngredient = null; + TargetComponentIngredient donorIngredient = null; ItemStack datasource = ItemStack.EMPTY; NonNullList ingredients = getIngredients(); for (Ingredient ingredient : ingredients) { - if (ingredient.getCustomIngredient() instanceof TargetNBTIngredient) { - donorIngredient = (TargetNBTIngredient)ingredient.getCustomIngredient(); + if (ingredient.getCustomIngredient() instanceof TargetComponentIngredient) { + donorIngredient = (TargetComponentIngredient)ingredient.getCustomIngredient(); break; } } @@ -47,6 +50,7 @@ public class RecipeKeepDataShaped extends ShapedRecipe { } + @Nonnull @Override public RecipeSerializer getSerializer() { return ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get(); @@ -58,11 +62,13 @@ public class RecipeKeepDataShaped extends ShapedRecipe { RecipeKeepDataShaped.Serializer::toNetwork, RecipeKeepDataShaped.Serializer::fromNetwork ); + @Nonnull @Override public MapCodec codec() { return CODEC; } + @Nonnull @Override public StreamCodec streamCodec() { return STREAM_CODEC; @@ -77,7 +83,7 @@ public class RecipeKeepDataShaped extends ShapedRecipe { RecipeSerializer.SHAPED_RECIPE.streamCodec().encode(buffer, recipe); } catch (Exception exception) { - ActuallyAdditions.LOGGER.info("Error writing {} Recipe to packet: ", NAME, exception); + ActuallyAdditions.LOGGER.info("Error writing {} Recipe to packet: ", NAME, exception); throw exception; } } 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 56f1ad957..e34d08578 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java @@ -24,6 +24,8 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.ShapelessRecipe; +import javax.annotation.Nonnull; + public class RecipeKeepDataShapeless extends ShapelessRecipe { public static String NAME = "copy_nbt_shapeless"; public RecipeKeepDataShapeless(String pGroup, CraftingBookCategory pCategory, ItemStack pResult, NonNullList pIngredients) { @@ -33,21 +35,23 @@ public class RecipeKeepDataShapeless extends ShapelessRecipe { super(recipe.getGroup(), recipe.category(), recipe.getResultItem(RegistryAccess.EMPTY), recipe.getIngredients()); } + @Nonnull @Override public RecipeSerializer getSerializer() { return ActuallyRecipes.KEEP_DATA_SHAPELESS_RECIPE.get(); } + @Nonnull @Override - public ItemStack assemble(CraftingInput pContainer, HolderLookup.Provider provider) { + public ItemStack assemble(@Nonnull CraftingInput pContainer, @Nonnull HolderLookup.Provider provider) { ItemStack result = super.assemble(pContainer, provider); - TargetNBTIngredient donorIngredient = null; + TargetComponentIngredient donorIngredient = null; ItemStack datasource = ItemStack.EMPTY; NonNullList ingredients = getIngredients(); for (Ingredient ingredient : ingredients) { - if (ingredient.getCustomIngredient() instanceof TargetNBTIngredient) { - donorIngredient = (TargetNBTIngredient)ingredient.getCustomIngredient(); + if (ingredient.getCustomIngredient() instanceof TargetComponentIngredient) { + donorIngredient = (TargetComponentIngredient)ingredient.getCustomIngredient(); break; } } @@ -65,7 +69,7 @@ public class RecipeKeepDataShapeless extends ShapelessRecipe { if (!datasource.isEmpty() && !datasource.getComponents().isEmpty()) result.applyComponents(datasource.getComponents()); else { - ActuallyAdditions.LOGGER.info("AA.KeepDataShapeless missing TargetNBTIngredient"); + ActuallyAdditions.LOGGER.info("AA.KeepDataShapeless missing TargetComponentIngredient"); return ItemStack.EMPTY; } @@ -78,11 +82,13 @@ public class RecipeKeepDataShapeless extends ShapelessRecipe { RecipeKeepDataShapeless.Serializer::toNetwork, RecipeKeepDataShapeless.Serializer::fromNetwork ); + @Nonnull @Override public MapCodec codec() { return CODEC; } + @Nonnull @Override public StreamCodec streamCodec() { return STREAM_CODEC; @@ -97,7 +103,7 @@ public class RecipeKeepDataShapeless extends ShapelessRecipe { RecipeSerializer.SHAPELESS_RECIPE.streamCodec().encode(pBuffer, pRecipe); } catch (Exception e) { - ActuallyAdditions.LOGGER.info("Failed to serialize {} Recipe to packet: {}", NAME, e.getMessage()); + ActuallyAdditions.LOGGER.info("Failed to serialize {} Recipe to packet: {}", NAME, 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/TargetComponentIngredient.java similarity index 56% rename from src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetComponentIngredient.java index 1ff07c2dc..d62f5ba0a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetNBTIngredient.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/TargetComponentIngredient.java @@ -13,27 +13,22 @@ import net.neoforged.neoforge.common.crafting.IngredientType; import javax.annotation.Nonnull; import java.util.stream.Stream; -public record TargetNBTIngredient(Ingredient ingredient) implements ICustomIngredient { - public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( +public record TargetComponentIngredient(Ingredient ingredient) implements ICustomIngredient { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( - Ingredient.CODEC.fieldOf("base").forGetter(TargetNBTIngredient::ingredient) + Ingredient.CODEC.fieldOf("base").forGetter(TargetComponentIngredient::ingredient) ) - .apply(builder, TargetNBTIngredient::new)); - - - /* public static final Codec CODEC = - RecordCodecBuilder.create(builder -> builder.group( - BuiltInRegistries.ITEM.byNameCodec().fieldOf( "item").forGetter(TargetNBTIngredient::getItem) - ).apply(builder, TargetNBTIngredient::new));*/ + .apply(builder, TargetComponentIngredient::new)); + @Nonnull @Override public Stream getItems() { return Stream.of(ingredient.getItems()); } @Override - public boolean test(ItemStack stack) { + public boolean test(@Nonnull ItemStack stack) { return ingredient.test(stack); } @@ -42,18 +37,19 @@ public record TargetNBTIngredient(Ingredient ingredient) implements ICustomIngre return ingredient.isSimple(); } + @Nonnull @Override public IngredientType getType() { return ActuallyRecipes.Ingredients.TARGET_NBT.get(); } public static Ingredient of(ItemLike itemProvider) { - return new TargetNBTIngredient(Ingredient.of(itemProvider)).toVanilla(); + return new TargetComponentIngredient(Ingredient.of(itemProvider)).toVanilla(); } public static Ingredient of(ItemStack itemStack) { - return new TargetNBTIngredient(Ingredient.of(itemStack)).toVanilla(); + return new TargetComponentIngredient(Ingredient.of(itemStack)).toVanilla(); } public static Ingredient of(@Nonnull TagKey tag) { - return new TargetNBTIngredient(Ingredient.of(tag)).toVanilla(); + return new TargetComponentIngredient(Ingredient.of(tag)).toVanilla(); } } \ No newline at end of file