|
29 | 29 | import net.minecraft.data.recipes.RecipeOutput;
|
30 | 30 | import net.minecraft.data.recipes.RecipeProvider;
|
31 | 31 | import net.minecraft.resources.ResourceLocation;
|
| 32 | +import net.minecraft.world.item.Items; |
32 | 33 | import net.minecraft.world.item.crafting.Recipe;
|
33 | 34 | import net.minecraft.world.item.crafting.RecipeHolder;
|
34 | 35 | import net.neoforged.bus.api.SubscribeEvent;
|
@@ -61,34 +62,44 @@ private static void buildPolishedBlockRecipes(RecipeOutput output) {
|
61 | 62 | var baseId = polishedId.withPath(name -> name.replace("polished_", ""));
|
62 | 63 | if (!BuiltInRegistries.BLOCK.containsKey(baseId))
|
63 | 64 | return;
|
64 |
| - var polished = holder.value(); |
65 |
| - var base = BuiltInRegistries.BLOCK.get(baseId); |
| 65 | + var polishedItem = holder.value().asItem(); |
| 66 | + var baseItem = BuiltInRegistries.BLOCK.get(baseId).asItem(); |
| 67 | + if (polishedItem == Items.AIR || baseItem == Items.AIR) |
| 68 | + return; |
66 | 69 | var recipeId = CDPCommon.asResource(baseId.toString().replace(':', '/'));
|
67 | 70 | new ProcessingRecipeBuilder<>(SandPaperPolishingRecipe::new, recipeId)
|
68 |
| - .require(base) |
69 |
| - .output(polished) |
| 71 | + .require(baseItem) |
| 72 | + .output(polishedItem) |
70 | 73 | .build(output);
|
71 | 74 | });
|
72 | 75 | }
|
73 | 76 |
|
74 | 77 | private static void buildOxidizedBlockRecipes(RecipeOutput output) {
|
75 | 78 | DataMapHooks.INVERSE_OXIDIZABLES_DATAMAP.forEach((oxidized, polished) -> {
|
| 79 | + var oxidizedItem = oxidized.asItem(); |
| 80 | + var polishedItem = polished.asItem(); |
| 81 | + if (oxidizedItem == Items.AIR || polishedItem == Items.AIR) |
| 82 | + return; |
76 | 83 | var oxidizedId = BuiltInRegistries.BLOCK.getKey(oxidized);
|
77 | 84 | var recipeId = CDPCommon.asResource(oxidizedId.toString().replace(':', '/'));
|
78 | 85 | new ProcessingRecipeBuilder<>(SandPaperPolishingRecipe::new, recipeId)
|
79 |
| - .require(oxidized) |
80 |
| - .output(polished) |
| 86 | + .require(oxidizedItem) |
| 87 | + .output(polishedItem) |
81 | 88 | .build(output);
|
82 | 89 | });
|
83 | 90 | }
|
84 | 91 |
|
85 | 92 | private static void buildWaxedBlockRecipes(RecipeOutput output) {
|
86 | 93 | DataMapHooks.INVERSE_WAXABLES_DATAMAP.forEach((waxed, polished) -> {
|
| 94 | + var waxedItem = waxed.asItem(); |
| 95 | + var polishedItem = polished.asItem(); |
| 96 | + if (waxedItem == Items.AIR || polishedItem == Items.AIR) |
| 97 | + return; |
87 | 98 | var waxedId = BuiltInRegistries.BLOCK.getKey(waxed);
|
88 | 99 | var recipeId = CDPCommon.asResource(waxedId.toString().replace(':', '/'));
|
89 | 100 | new ProcessingRecipeBuilder<>(SandPaperPolishingRecipe::new, recipeId)
|
90 |
| - .require(waxed) |
91 |
| - .output(polished) |
| 101 | + .require(waxedItem) |
| 102 | + .output(polishedItem) |
92 | 103 | .build(output);
|
93 | 104 | });
|
94 | 105 | }
|
|
0 commit comments