|
26 | 26 | import net.minecraft.resources.ResourceLocation; |
27 | 27 | import net.minecraft.sounds.SoundEvents; |
28 | 28 | import net.minecraft.tags.ItemTags; |
| 29 | +import net.minecraft.tags.TagKey; |
29 | 30 | import net.minecraft.world.entity.EntityType; |
30 | 31 | import net.minecraft.world.entity.npc.VillagerProfession; |
31 | 32 | import net.minecraft.world.item.DyeColor; |
|
35 | 36 | import net.minecraft.world.item.crafting.Ingredient; |
36 | 37 | import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer; |
37 | 38 | import net.minecraft.world.level.block.Blocks; |
| 39 | +import org.jetbrains.annotations.Nullable; |
38 | 40 |
|
39 | 41 | import java.util.List; |
40 | 42 | import java.util.Map; |
@@ -280,13 +282,6 @@ public void buildRecipes(Consumer<FinishedRecipe> recipes) { |
280 | 282 | packing(RecipeCategory.BUILDING_BLOCKS, HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust", |
281 | 283 | false, recipes); |
282 | 284 |
|
283 | | - ringAll(RecipeCategory.BUILDING_BLOCKS, HexBlocks.AMETHYST_TILES, 8, Blocks.AMETHYST_BLOCK, HexItems.AMETHYST_DUST) |
284 | | - .unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes); |
285 | | - |
286 | | - SingleItemRecipeBuilder.stonecutting(Ingredient.of(Blocks.AMETHYST_BLOCK), RecipeCategory.BUILDING_BLOCKS, HexBlocks.AMETHYST_TILES) |
287 | | - .unlockedBy("has_item", hasItem(Blocks.AMETHYST_BLOCK)) |
288 | | - .save(recipes, modLoc("stonecutting/amethyst_tiles")); |
289 | | - |
290 | 285 | ringAll(RecipeCategory.BUILDING_BLOCKS, HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD) |
291 | 286 | .unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes); |
292 | 287 |
|
@@ -427,6 +422,37 @@ public void buildRecipes(Consumer<FinishedRecipe> recipes) { |
427 | 422 | .pattern("LPL") |
428 | 423 | .unlockedBy("enlightenment", enlightenment).save(recipes); |
429 | 424 |
|
| 425 | + // Stone sets |
| 426 | + stoneSet(recipes, HexBlocks.SLATE_BLOCK.asItem(), HexBlocks.SLATE_BRICKS.asItem(), HexBlocks.SLATE_BRICKS_SMALL.asItem(), HexBlocks.SLATE_TILES.asItem(), HexBlocks.SLATE_PILLAR.asItem()); |
| 427 | + stoneSet(recipes, Blocks.AMETHYST_BLOCK.asItem(), HexBlocks.AMETHYST_BRICKS.asItem(), HexBlocks.AMETHYST_BRICKS_SMALL.asItem(), HexBlocks.AMETHYST_TILES.asItem(), HexBlocks.AMETHYST_PILLAR.asItem()); |
| 428 | + stoneSet(recipes, HexBlocks.QUENCHED_ALLAY.asItem(), HexBlocks.QUENCHED_ALLAY_BRICKS.asItem(), HexBlocks.QUENCHED_ALLAY_BRICKS_SMALL.asItem(), HexBlocks.QUENCHED_ALLAY_TILES.asItem(), null); |
| 429 | + |
| 430 | + // Stone sets in stonecutter |
| 431 | + stoneCutterFromTag(recipes, HexTags.Items.SLATE_BLOCKS, HexBlocks.SLATE_BRICKS.asItem(), HexBlocks.SLATE_BRICKS_SMALL.asItem(), HexBlocks.SLATE_TILES.asItem(), HexBlocks.SLATE_PILLAR.asItem()); |
| 432 | + stoneCutterFromTag(recipes, HexTags.Items.AMETHYST_BLOCKS, HexBlocks.AMETHYST_BRICKS.asItem(), HexBlocks.AMETHYST_BRICKS_SMALL.asItem(), HexBlocks.AMETHYST_TILES.asItem(), HexBlocks.AMETHYST_PILLAR.asItem()); |
| 433 | + stoneCutterFromTag(recipes, HexTags.Items.QUENCHED_ALLAY_BLOCKS, HexBlocks.QUENCHED_ALLAY_BRICKS.asItem(), HexBlocks.QUENCHED_ALLAY_BRICKS_SMALL.asItem(), HexBlocks.QUENCHED_ALLAY_TILES.asItem()); |
| 434 | + |
| 435 | + // Slate & Amethyst block set |
| 436 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, HexBlocks.SLATE_AMETHYST_BRICKS.asItem(), 2) |
| 437 | + .requires(HexBlocks.SLATE_BRICKS) |
| 438 | + .requires(HexBlocks.AMETHYST_BRICKS) |
| 439 | + .unlockedBy("has_item", has(HexBlocks.SLATE)).save(recipes); |
| 440 | + |
| 441 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, HexBlocks.SLATE_AMETHYST_BRICKS_SMALL.asItem(), 2) |
| 442 | + .requires(HexBlocks.SLATE_BRICKS_SMALL) |
| 443 | + .requires(HexBlocks.AMETHYST_BRICKS_SMALL) |
| 444 | + .unlockedBy("has_item", has(HexBlocks.SLATE)).save(recipes); |
| 445 | + |
| 446 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, HexBlocks.SLATE_AMETHYST_TILES.asItem(), 2) |
| 447 | + .requires(HexBlocks.SLATE_TILES) |
| 448 | + .requires(HexBlocks.AMETHYST_TILES) |
| 449 | + .unlockedBy("has_item", has(HexBlocks.SLATE)).save(recipes); |
| 450 | + |
| 451 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, HexBlocks.SLATE_AMETHYST_PILLAR.asItem(), 2) |
| 452 | + .requires(HexBlocks.SLATE_PILLAR) |
| 453 | + .requires(HexBlocks.AMETHYST_PILLAR) |
| 454 | + .unlockedBy("has_item", has(HexBlocks.SLATE)).save(recipes); |
| 455 | + |
430 | 456 | new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK), |
431 | 457 | new VillagerIngredient(null, null, 3), |
432 | 458 | Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10) |
@@ -570,4 +596,52 @@ private void specialRecipe(Consumer<FinishedRecipe> consumer, SimpleCraftingReci |
570 | 596 | var name = BuiltInRegistries.RECIPE_SERIALIZER.getKey(serializer); |
571 | 597 | SpecialRecipeBuilder.special(serializer).save(consumer, HexAPI.MOD_ID + ":dynamic" + name.getPath()); |
572 | 598 | } |
| 599 | + |
| 600 | + private void stoneSet(Consumer<FinishedRecipe> recipes, Item base, Item bricks, Item smallBricks, Item tiles, @Nullable Item pillar) { |
| 601 | + // Bricks from base block |
| 602 | + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, bricks, 4) |
| 603 | + .define('#', base) |
| 604 | + .pattern("##") |
| 605 | + .pattern("##") |
| 606 | + .unlockedBy("has_item", hasItem(base)) |
| 607 | + .save(recipes); |
| 608 | + |
| 609 | + // Bricks from small bricks |
| 610 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, bricks) |
| 611 | + .requires(smallBricks) |
| 612 | + .unlockedBy("has_item", hasItem(base)) |
| 613 | + .save(recipes, modLoc(bricks + "_from_" + smallBricks)); |
| 614 | + |
| 615 | + // Small bricks from bricks |
| 616 | + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, smallBricks) |
| 617 | + .requires(bricks) |
| 618 | + .unlockedBy("has_item", hasItem(base)) |
| 619 | + .save(recipes, modLoc(smallBricks + "_from_" + bricks)); |
| 620 | + |
| 621 | + // Tiles from bricks |
| 622 | + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, tiles, 4) |
| 623 | + .define('#', bricks) |
| 624 | + .pattern("##") |
| 625 | + .pattern("##") |
| 626 | + .unlockedBy("has_item", hasItem(base)) |
| 627 | + .save(recipes); |
| 628 | + |
| 629 | + // Pillar from base block |
| 630 | + if (pillar != null) { |
| 631 | + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, pillar, 2) |
| 632 | + .define('#', base) |
| 633 | + .pattern("#") |
| 634 | + .pattern("#") |
| 635 | + .unlockedBy("has_item", hasItem(base)) |
| 636 | + .save(recipes); |
| 637 | + } |
| 638 | + } |
| 639 | + |
| 640 | + private void stoneCutterFromTag(Consumer<FinishedRecipe> recipes, TagKey<Item> tagKey, Item ...results) { |
| 641 | + for (Item result : results) { |
| 642 | + SingleItemRecipeBuilder.stonecutting(Ingredient.of(tagKey), RecipeCategory.BUILDING_BLOCKS, result) |
| 643 | + .unlockedBy("has_item", hasItem(tagKey)) |
| 644 | + .save(recipes, modLoc("stonecutting/" + result)); |
| 645 | + } |
| 646 | + } |
573 | 647 | } |
0 commit comments