Fixed drill dyeing recipes, Closes #1459

This commit is contained in:
Flanks255 2024-12-06 21:23:15 -06:00
parent e9979ba6b8
commit db9095e0f7
24 changed files with 134 additions and 73 deletions

View file

@ -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 # 1.3.11+mc1.21.1
* Fixed Farmer not playing well with non-vanilla farmland. * Fixed Farmer not playing well with non-vanilla farmland.
* Added the ability to change the farmers work area with a compass. * Added the ability to change the farmers work area with a compass.

View file

@ -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 14bd5bc2ee3e84b6f3a3181c0e0efd40df5f1d84 data/actuallyadditions/recipe/advanced_coil.json
955aad6c1def123a6adbaeabb13faa6eedce847f data/actuallyadditions/recipe/advanced_leaf_blower.json 955aad6c1def123a6adbaeabb13faa6eedce847f data/actuallyadditions/recipe/advanced_leaf_blower.json
97e7ba64f5054b030f4e49615dc4212a28ca9be1 data/actuallyadditions/recipe/basic_coil.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 263394a8ccab3e239b870b78bf4d1dca959f6c08 data/actuallyadditions/recipe/decompress/void_crystal_shard.json
5c9c0603f78ceb6de7e55a398fed6d30e44936c9 data/actuallyadditions/recipe/diamond_aiot.json 5c9c0603f78ceb6de7e55a398fed6d30e44936c9 data/actuallyadditions/recipe/diamond_aiot.json
d449363a6a4b89c8a718d98cde294cc648a9b485 data/actuallyadditions/recipe/double_battery.json d449363a6a4b89c8a718d98cde294cc648a9b485 data/actuallyadditions/recipe/double_battery.json
836d06df12ebb1b4506ebd3b95f4d488a62ec0c4 data/actuallyadditions/recipe/drill_coloring/dye_drill_black.json 2632116b27a8f0c5697ffc12a540520ff4817c00 data/actuallyadditions/recipe/drill_coloring/dye_drill_black.json
fb1f5a571b19ef49a899d5776b626118342108b3 data/actuallyadditions/recipe/drill_coloring/dye_drill_blue.json 1c6242d3910f3afe4e270113c8a402823da6b0cb data/actuallyadditions/recipe/drill_coloring/dye_drill_blue.json
84d5c995ee33352d69ee5c2aa83c3968affbcebb data/actuallyadditions/recipe/drill_coloring/dye_drill_brown.json eb357e471110e905e5f7d0531dcac3dcb01ad4ff data/actuallyadditions/recipe/drill_coloring/dye_drill_brown.json
e58498cdfe8fe51b04292864f62711af67b44d35 data/actuallyadditions/recipe/drill_coloring/dye_drill_cyan.json ac1a0baad5a287c1e655ada7ce98cc6aaecc83f9 data/actuallyadditions/recipe/drill_coloring/dye_drill_cyan.json
ce971f33b9e8be10e43fc7e7be91a0573ff45f73 data/actuallyadditions/recipe/drill_coloring/dye_drill_gray.json e6219d74254bea00addcdf08f1a644f847968a6e data/actuallyadditions/recipe/drill_coloring/dye_drill_gray.json
fa6c5ffc9f742799ac639a3138ce8bb5b548b4c2 data/actuallyadditions/recipe/drill_coloring/dye_drill_green.json 6d0c945fa07d8f8842a9099f2ff608e224b085a7 data/actuallyadditions/recipe/drill_coloring/dye_drill_green.json
087149df86c0332d9f321c1c092db0ad33c967dd data/actuallyadditions/recipe/drill_coloring/dye_drill_light_blue.json a6cef0e184cff8f11084778dc0a72d05485f3fbc data/actuallyadditions/recipe/drill_coloring/dye_drill_light_blue.json
11821c443c3fcea44d4527ddc8f8a51133853133 data/actuallyadditions/recipe/drill_coloring/dye_drill_light_gray.json 79f98f436372c3f85a35fbd3d7a3de42a8117d1f data/actuallyadditions/recipe/drill_coloring/dye_drill_light_gray.json
7df9ef361d0b366860bbf92424cf0d0bf79035f9 data/actuallyadditions/recipe/drill_coloring/dye_drill_lime.json 5f843e257dd0e03d73656d8d1733b63aab750124 data/actuallyadditions/recipe/drill_coloring/dye_drill_lime.json
698cf24c334d5bb05f447a4fdf8f1e5546e20b1f data/actuallyadditions/recipe/drill_coloring/dye_drill_magenta.json 525a514e7d376f3d0819dc95955ba3276b74c5d9 data/actuallyadditions/recipe/drill_coloring/dye_drill_magenta.json
e447436880c0370d9a0158a7ee47cc6a95a0dd0f data/actuallyadditions/recipe/drill_coloring/dye_drill_orange.json cd022566bfd3bf7abd37c81e63223bbbd4b8c83d data/actuallyadditions/recipe/drill_coloring/dye_drill_orange.json
022958646fc11a838f9083ecd553f7a051020a06 data/actuallyadditions/recipe/drill_coloring/dye_drill_pink.json b9f81ade143cdd026cb61ee0bc72c712152c599d data/actuallyadditions/recipe/drill_coloring/dye_drill_pink.json
78490dfd929a5bbd4ece14ec098f98ca8e7cc854 data/actuallyadditions/recipe/drill_coloring/dye_drill_purple.json 991e75b85e40ac7ee488c4680294f566a0a6bcd2 data/actuallyadditions/recipe/drill_coloring/dye_drill_purple.json
5e1a4f23d9d596bed5f2aebca574002918a5fb97 data/actuallyadditions/recipe/drill_coloring/dye_drill_red.json 6d10bb7fee0bfc22662ecbe7a9e8946dabb2ab40 data/actuallyadditions/recipe/drill_coloring/dye_drill_red.json
91e28015934f2e49144760cb4c454b9593d1b85e data/actuallyadditions/recipe/drill_coloring/dye_drill_white.json 755eddac6c3de13163f24ddb268717d174c6c2a2 data/actuallyadditions/recipe/drill_coloring/dye_drill_white.json
1122df15841403bfb97f6e020090abb1e9494796 data/actuallyadditions/recipe/drill_coloring/dye_drill_yellow.json 2c3431723d0a68b86ab19e290ae87331b968189c data/actuallyadditions/recipe/drill_coloring/dye_drill_yellow.json
3226a302f425ab52edb0c6008c7a4eb10cb2fd18 data/actuallyadditions/recipe/drill_core.json 3226a302f425ab52edb0c6008c7a4eb10cb2fd18 data/actuallyadditions/recipe/drill_core.json
8df3f7b20c8c46ed492b314aa4322b6a00178417 data/actuallyadditions/recipe/drill_light_blue.json 8df3f7b20c8c46ed492b314aa4322b6a00178417 data/actuallyadditions/recipe/drill_light_blue.json
f146fe12be4b36cd125d85ea25e26d5288198f72 data/actuallyadditions/recipe/drill_pattern.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 f31206c1d67ddc93e41d13f24d54e8d6b5913348 data/actuallyadditions/recipe/single_battery.json
9504d2a8e3cb536cf865e8385a013743a0d615d0 data/actuallyadditions/recipe/stone_aiot.json 9504d2a8e3cb536cf865e8385a013743a0d615d0 data/actuallyadditions/recipe/stone_aiot.json
bd83fca2a318f4b513a38310e4b3d26f87ab9439 data/actuallyadditions/recipe/tagged_slime_block.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 b40274260097d19ae4f925e31982d8bfad3acd84 data/actuallyadditions/recipe/teleport_staff.json
b0e94b90682d5224dd995c15b26d6df50fd78dd6 data/actuallyadditions/recipe/tiny_to_charcoal.json b0e94b90682d5224dd995c15b26d6df50fd78dd6 data/actuallyadditions/recipe/tiny_to_charcoal.json
a60310bd6c5ec1368137372aed468e673cd1fd00 data/actuallyadditions/recipe/tiny_to_coal.json a60310bd6c5ec1368137372aed468e673cd1fd00 data/actuallyadditions/recipe/tiny_to_coal.json

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/black" "tag": "c:dyes/black"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/blue" "tag": "c:dyes/blue"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/brown" "tag": "c:dyes/brown"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/cyan" "tag": "c:dyes/cyan"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/gray" "tag": "c:dyes/gray"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/green" "tag": "c:dyes/green"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/light_blue" "tag": "c:dyes/light_blue"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/light_gray" "tag": "c:dyes/light_gray"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/lime" "tag": "c:dyes/lime"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/magenta" "tag": "c:dyes/magenta"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/orange" "tag": "c:dyes/orange"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/pink" "tag": "c:dyes/pink"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/purple" "tag": "c:dyes/purple"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/red" "tag": "c:dyes/red"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/white" "tag": "c:dyes/white"

View file

@ -3,7 +3,10 @@
"category": "misc", "category": "misc",
"ingredients": [ "ingredients": [
{ {
"type": "actuallyadditions:target_nbt",
"base": {
"tag": "actuallyadditions:drills" "tag": "actuallyadditions:drills"
}
}, },
{ {
"tag": "c:dyes/yellow" "tag": "c:dyes/yellow"

View file

@ -6,7 +6,7 @@
"item": "minecraft:piston" "item": "minecraft:piston"
}, },
"R": { "R": {
"tag": "c:slimeballs" "tag": "c:slime_balls"
} }
}, },
"pattern": [ "pattern": [

View file

@ -6,7 +6,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition; import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
import de.ellpeck.actuallyadditions.mod.crafting.RecipeKeepDataShaped; import de.ellpeck.actuallyadditions.mod.crafting.RecipeKeepDataShaped;
import de.ellpeck.actuallyadditions.mod.crafting.RecipeKeepDataShapeless; 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.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput; import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import de.ellpeck.actuallyadditions.mod.util.RecipeInjector; import de.ellpeck.actuallyadditions.mod.util.RecipeInjector;
@ -46,6 +46,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
super(packOutput, lookupProvider); super(packOutput, lookupProvider);
} }
@Nonnull
@Override @Override
public String getName() { public String getName() {
return "Item " + super.getName(); return "Item " + super.getName();
@ -162,9 +163,8 @@ public class ItemRecipeGenerator extends RecipeProvider {
//Killer Lens //Killer Lens
ItemStack enchantedBook = new ItemStack(Items.ENCHANTED_BOOK); 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()) Recipe.shapeless(ActuallyItems.LENS_OF_THE_KILLER.get())
.requires(Items.DIAMOND_SWORD) .requires(Items.DIAMOND_SWORD)
.requires(ActuallyItems.LENS_OF_CERTAIN_DEATH.get()) .requires(ActuallyItems.LENS_OF_CERTAIN_DEATH.get())
@ -409,7 +409,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern(" R ") .pattern(" R ")
.pattern("ICI") .pattern("ICI")
.pattern("III") .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('I', ActuallyItems.ENORI_CRYSTAL.get())
.define('C', ActuallyItems.ADVANCED_COIL.get()) .define('C', ActuallyItems.ADVANCED_COIL.get())
.save(new RecipeInjector<ShapedRecipe>(recipeOutput, RecipeKeepDataShaped::new)); .save(new RecipeInjector<ShapedRecipe>(recipeOutput, RecipeKeepDataShaped::new));
@ -419,7 +419,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern(" R ") .pattern(" R ")
.pattern("ICI") .pattern("ICI")
.pattern("III") .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('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
.define('C', ActuallyItems.ADVANCED_COIL.get()) .define('C', ActuallyItems.ADVANCED_COIL.get())
.save(new RecipeInjector<ShapedRecipe>(recipeOutput, RecipeKeepDataShaped::new)); .save(new RecipeInjector<ShapedRecipe>(recipeOutput, RecipeKeepDataShaped::new));
@ -429,7 +429,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern(" R ") .pattern(" R ")
.pattern("ICI") .pattern("ICI")
.pattern("III") .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('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
.define('C', ActuallyItems.ADVANCED_COIL.get()) .define('C', ActuallyItems.ADVANCED_COIL.get())
.save(new RecipeInjector<ShapedRecipe>(recipeOutput, RecipeKeepDataShaped::new)); .save(new RecipeInjector<ShapedRecipe>(recipeOutput, RecipeKeepDataShaped::new));
@ -439,7 +439,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern(" R ") .pattern(" R ")
.pattern("ICI") .pattern("ICI")
.pattern("III") .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('I', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get())
.define('C', ActuallyItems.ADVANCED_COIL.get()) .define('C', ActuallyItems.ADVANCED_COIL.get())
.save(new RecipeInjector<ShapedRecipe>(recipeOutput, RecipeKeepDataShaped::new)); .save(new RecipeInjector<ShapedRecipe>(recipeOutput, RecipeKeepDataShaped::new));
@ -533,14 +533,14 @@ public class ItemRecipeGenerator extends RecipeProvider {
// Sticky Piston from tagged slime balls // Sticky Piston from tagged slime balls
Recipe.shaped(Items.STICKY_PISTON) Recipe.shaped(Items.STICKY_PISTON)
.pattern("R", "P") .pattern("R", "P")
.define('R', Tags.Items.SLIMEBALLS) .define('R', Tags.Items.SLIME_BALLS)
.define('P', Items.PISTON) .define('P', Items.PISTON)
.save(recipeOutput, ActuallyAdditions.modLoc("tagged_sticky_piston")); .save(recipeOutput, ActuallyAdditions.modLoc("tagged_sticky_piston"));
// Slime block from tagged balls // Slime block from tagged balls
Recipe.shaped(Items.SLIME_BLOCK) Recipe.shaped(Items.SLIME_BLOCK)
.pattern("RRR", "RRR", "RRR") .pattern("RRR", "RRR", "RRR")
.define('R', Tags.Items.SLIMEBALLS) .define('R', Tags.Items.SLIME_BALLS)
.save(recipeOutput, ActuallyAdditions.modLoc("tagged_slime_block")); .save(recipeOutput, ActuallyAdditions.modLoc("tagged_slime_block"));
//Shards //Shards
@ -650,7 +650,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
private static void dyeDrill(DeferredItem<? extends Item> result, TagKey<Item> dyeItem, RecipeOutput recipeOutput) { private static void dyeDrill(DeferredItem<? extends Item> result, TagKey<Item> dyeItem, RecipeOutput recipeOutput) {
Recipe.shapeless(result.get()) Recipe.shapeless(result.get())
.requires(Ingredient.of(ActuallyTags.Items.DRILLS)) //TargetNBTIngredient .requires(TargetComponentIngredient.of(ActuallyTags.Items.DRILLS))
.requires(dyeItem) .requires(dyeItem)
.save(new RecipeInjector<ShapelessRecipe>(recipeOutput, RecipeKeepDataShapeless::new), ActuallyAdditions.modLoc("drill_coloring/dye_" + BuiltInRegistries.ITEM.getKey(result.get()).getPath())); .save(new RecipeInjector<ShapelessRecipe>(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) { public Shaped(ItemLike resultIn) {
this(resultIn, 1); this(resultIn, 1);
} }

View file

@ -52,6 +52,7 @@ public class ActuallyRecipes {
public static class Ingredients { public static class Ingredients {
public static final DeferredRegister<IngredientType<?>> INGREDIENTS = DeferredRegister.create(NeoForgeRegistries.Keys.INGREDIENT_TYPES, ActuallyAdditions.MODID); public static final DeferredRegister<IngredientType<?>> INGREDIENTS = DeferredRegister.create(NeoForgeRegistries.Keys.INGREDIENT_TYPES, ActuallyAdditions.MODID);
public static final Supplier<IngredientType<TargetNBTIngredient>> TARGET_NBT = INGREDIENTS.register("target_nbt", () -> new IngredientType<>(TargetNBTIngredient.CODEC)); //TODO change name from nbt in 1.22
public static final Supplier<IngredientType<TargetComponentIngredient>> TARGET_NBT = INGREDIENTS.register("target_nbt", () -> new IngredientType<>(TargetComponentIngredient.CODEC));
} }
} }

View file

@ -12,21 +12,24 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.item.crafting.ShapedRecipe;
import javax.annotation.Nonnull;
public class RecipeKeepDataShaped extends ShapedRecipe { public class RecipeKeepDataShaped extends ShapedRecipe {
public static String NAME = "copy_nbt"; public static String NAME = "copy_nbt";
public RecipeKeepDataShaped(ShapedRecipe shapedRecipe) { public RecipeKeepDataShaped(ShapedRecipe shapedRecipe) {
super(shapedRecipe.getGroup(), shapedRecipe.category(), shapedRecipe.pattern, shapedRecipe.getResultItem(null)); super(shapedRecipe.getGroup(), shapedRecipe.category(), shapedRecipe.pattern, shapedRecipe.getResultItem(null));
} }
@Nonnull
@Override @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); final ItemStack craftingResult = super.assemble(inv, registries);
TargetNBTIngredient donorIngredient = null; TargetComponentIngredient donorIngredient = null;
ItemStack datasource = ItemStack.EMPTY; ItemStack datasource = ItemStack.EMPTY;
NonNullList<Ingredient> ingredients = getIngredients(); NonNullList<Ingredient> ingredients = getIngredients();
for (Ingredient ingredient : ingredients) { for (Ingredient ingredient : ingredients) {
if (ingredient.getCustomIngredient() instanceof TargetNBTIngredient) { if (ingredient.getCustomIngredient() instanceof TargetComponentIngredient) {
donorIngredient = (TargetNBTIngredient)ingredient.getCustomIngredient(); donorIngredient = (TargetComponentIngredient)ingredient.getCustomIngredient();
break; break;
} }
} }
@ -47,6 +50,7 @@ public class RecipeKeepDataShaped extends ShapedRecipe {
} }
@Nonnull
@Override @Override
public RecipeSerializer<?> getSerializer() { public RecipeSerializer<?> getSerializer() {
return ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get(); return ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get();
@ -58,11 +62,13 @@ public class RecipeKeepDataShaped extends ShapedRecipe {
RecipeKeepDataShaped.Serializer::toNetwork, RecipeKeepDataShaped.Serializer::fromNetwork RecipeKeepDataShaped.Serializer::toNetwork, RecipeKeepDataShaped.Serializer::fromNetwork
); );
@Nonnull
@Override @Override
public MapCodec<RecipeKeepDataShaped> codec() { public MapCodec<RecipeKeepDataShaped> codec() {
return CODEC; return CODEC;
} }
@Nonnull
@Override @Override
public StreamCodec<RegistryFriendlyByteBuf, RecipeKeepDataShaped> streamCodec() { public StreamCodec<RegistryFriendlyByteBuf, RecipeKeepDataShaped> streamCodec() {
return STREAM_CODEC; return STREAM_CODEC;

View file

@ -24,6 +24,8 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.ShapelessRecipe; import net.minecraft.world.item.crafting.ShapelessRecipe;
import javax.annotation.Nonnull;
public class RecipeKeepDataShapeless extends ShapelessRecipe { public class RecipeKeepDataShapeless extends ShapelessRecipe {
public static String NAME = "copy_nbt_shapeless"; public static String NAME = "copy_nbt_shapeless";
public RecipeKeepDataShapeless(String pGroup, CraftingBookCategory pCategory, ItemStack pResult, NonNullList<Ingredient> pIngredients) { public RecipeKeepDataShapeless(String pGroup, CraftingBookCategory pCategory, ItemStack pResult, NonNullList<Ingredient> pIngredients) {
@ -33,21 +35,23 @@ public class RecipeKeepDataShapeless extends ShapelessRecipe {
super(recipe.getGroup(), recipe.category(), recipe.getResultItem(RegistryAccess.EMPTY), recipe.getIngredients()); super(recipe.getGroup(), recipe.category(), recipe.getResultItem(RegistryAccess.EMPTY), recipe.getIngredients());
} }
@Nonnull
@Override @Override
public RecipeSerializer<?> getSerializer() { public RecipeSerializer<?> getSerializer() {
return ActuallyRecipes.KEEP_DATA_SHAPELESS_RECIPE.get(); return ActuallyRecipes.KEEP_DATA_SHAPELESS_RECIPE.get();
} }
@Nonnull
@Override @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); ItemStack result = super.assemble(pContainer, provider);
TargetNBTIngredient donorIngredient = null; TargetComponentIngredient donorIngredient = null;
ItemStack datasource = ItemStack.EMPTY; ItemStack datasource = ItemStack.EMPTY;
NonNullList<Ingredient> ingredients = getIngredients(); NonNullList<Ingredient> ingredients = getIngredients();
for (Ingredient ingredient : ingredients) { for (Ingredient ingredient : ingredients) {
if (ingredient.getCustomIngredient() instanceof TargetNBTIngredient) { if (ingredient.getCustomIngredient() instanceof TargetComponentIngredient) {
donorIngredient = (TargetNBTIngredient)ingredient.getCustomIngredient(); donorIngredient = (TargetComponentIngredient)ingredient.getCustomIngredient();
break; break;
} }
} }
@ -65,7 +69,7 @@ public class RecipeKeepDataShapeless extends ShapelessRecipe {
if (!datasource.isEmpty() && !datasource.getComponents().isEmpty()) if (!datasource.isEmpty() && !datasource.getComponents().isEmpty())
result.applyComponents(datasource.getComponents()); result.applyComponents(datasource.getComponents());
else { else {
ActuallyAdditions.LOGGER.info("AA.KeepDataShapeless missing TargetNBTIngredient"); ActuallyAdditions.LOGGER.info("AA.KeepDataShapeless missing TargetComponentIngredient");
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
@ -78,11 +82,13 @@ public class RecipeKeepDataShapeless extends ShapelessRecipe {
RecipeKeepDataShapeless.Serializer::toNetwork, RecipeKeepDataShapeless.Serializer::fromNetwork RecipeKeepDataShapeless.Serializer::toNetwork, RecipeKeepDataShapeless.Serializer::fromNetwork
); );
@Nonnull
@Override @Override
public MapCodec<RecipeKeepDataShapeless> codec() { public MapCodec<RecipeKeepDataShapeless> codec() {
return CODEC; return CODEC;
} }
@Nonnull
@Override @Override
public StreamCodec<RegistryFriendlyByteBuf, RecipeKeepDataShapeless> streamCodec() { public StreamCodec<RegistryFriendlyByteBuf, RecipeKeepDataShapeless> streamCodec() {
return STREAM_CODEC; return STREAM_CODEC;

View file

@ -13,27 +13,22 @@ import net.neoforged.neoforge.common.crafting.IngredientType;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.stream.Stream; import java.util.stream.Stream;
public record TargetNBTIngredient(Ingredient ingredient) implements ICustomIngredient { public record TargetComponentIngredient(Ingredient ingredient) implements ICustomIngredient {
public static final MapCodec<TargetNBTIngredient> CODEC = RecordCodecBuilder.mapCodec( public static final MapCodec<TargetComponentIngredient> CODEC = RecordCodecBuilder.mapCodec(
builder -> builder builder -> builder
.group( .group(
Ingredient.CODEC.fieldOf("base").forGetter(TargetNBTIngredient::ingredient) Ingredient.CODEC.fieldOf("base").forGetter(TargetComponentIngredient::ingredient)
) )
.apply(builder, TargetNBTIngredient::new)); .apply(builder, TargetComponentIngredient::new));
/* public static final Codec<TargetNBTIngredient> CODEC =
RecordCodecBuilder.create(builder -> builder.group(
BuiltInRegistries.ITEM.byNameCodec().fieldOf( "item").forGetter(TargetNBTIngredient::getItem)
).apply(builder, TargetNBTIngredient::new));*/
@Nonnull
@Override @Override
public Stream<ItemStack> getItems() { public Stream<ItemStack> getItems() {
return Stream.of(ingredient.getItems()); return Stream.of(ingredient.getItems());
} }
@Override @Override
public boolean test(ItemStack stack) { public boolean test(@Nonnull ItemStack stack) {
return ingredient.test(stack); return ingredient.test(stack);
} }
@ -42,18 +37,19 @@ public record TargetNBTIngredient(Ingredient ingredient) implements ICustomIngre
return ingredient.isSimple(); return ingredient.isSimple();
} }
@Nonnull
@Override @Override
public IngredientType<?> getType() { public IngredientType<?> getType() {
return ActuallyRecipes.Ingredients.TARGET_NBT.get(); return ActuallyRecipes.Ingredients.TARGET_NBT.get();
} }
public static Ingredient of(ItemLike itemProvider) { 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) { 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<Item> tag) { public static Ingredient of(@Nonnull TagKey<Item> tag) {
return new TargetNBTIngredient(Ingredient.of(tag)).toVanilla(); return new TargetComponentIngredient(Ingredient.of(tag)).toVanilla();
} }
} }