Skip to content

Commit 48a6207

Browse files
authored
Kyanbirb's block recipes (rebase of #817) (#903)
2 parents d2a5e81 + 2a5612d commit 48a6207

File tree

137 files changed

+3160
-383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+3160
-383
lines changed

Common/src/main/java/at/petrak/hexcasting/api/mod/HexTags.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public static final class Items {
2424
public static final TagKey<Item> DIRECTRICES = create("directrices");
2525
public static final TagKey<Item> MINDFLAYED_CIRCLE_COMPONENTS = create("brainswept_circle_components");
2626

27+
public static final TagKey<Item> SLATE_BLOCKS = create("slate_blocks");
28+
public static final TagKey<Item> AMETHYST_BLOCKS = create("amethyst_blocks");
29+
public static final TagKey<Item> QUENCHED_ALLAY_BLOCKS = create("quenched_allay_blocks");
30+
2731
public static TagKey<Item> create(String name) {
2832
return create(modLoc(name));
2933
}
@@ -37,11 +41,14 @@ public static final class Blocks {
3741
public static final TagKey<Block> EDIFIED_LOGS = create("edified_logs");
3842
public static final TagKey<Block> EDIFIED_PLANKS = create("edified_planks");
3943

40-
4144
public static final TagKey<Block> IMPETI = create("impeti");
4245
public static final TagKey<Block> DIRECTRICES = create("directrices");
4346
public static final TagKey<Block> MINDFLAYED_CIRCLE_COMPONENTS = create("brainswept_circle_components");
4447

48+
public static final TagKey<Block> SLATE_BLOCKS = create("slate_blocks");
49+
public static final TagKey<Block> AMETHYST_BLOCKS = create("amethyst_blocks");
50+
public static final TagKey<Block> QUENCHED_ALLAY_BLOCKS = create("quenched_allay_blocks");
51+
4552
// Used to determine what blocks should be replaced with air by OpDestroyFluid
4653
public static final TagKey<Block> WATER_PLANTS = create("water_plants");
4754

Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java

Lines changed: 81 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import net.minecraft.resources.ResourceLocation;
2727
import net.minecraft.sounds.SoundEvents;
2828
import net.minecraft.tags.ItemTags;
29+
import net.minecraft.tags.TagKey;
2930
import net.minecraft.world.entity.EntityType;
3031
import net.minecraft.world.entity.npc.VillagerProfession;
3132
import net.minecraft.world.item.DyeColor;
@@ -35,6 +36,7 @@
3536
import net.minecraft.world.item.crafting.Ingredient;
3637
import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer;
3738
import net.minecraft.world.level.block.Blocks;
39+
import org.jetbrains.annotations.Nullable;
3840

3941
import java.util.List;
4042
import java.util.Map;
@@ -280,13 +282,6 @@ public void buildRecipes(Consumer<FinishedRecipe> recipes) {
280282
packing(RecipeCategory.BUILDING_BLOCKS, HexItems.AMETHYST_DUST, HexBlocks.AMETHYST_DUST_BLOCK.asItem(), "amethyst_dust",
281283
false, recipes);
282284

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-
290285
ringAll(RecipeCategory.BUILDING_BLOCKS, HexBlocks.SCROLL_PAPER, 8, Items.PAPER, Items.AMETHYST_SHARD)
291286
.unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes);
292287

@@ -427,6 +422,37 @@ public void buildRecipes(Consumer<FinishedRecipe> recipes) {
427422
.pattern("LPL")
428423
.unlockedBy("enlightenment", enlightenment).save(recipes);
429424

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+
430456
new BrainsweepRecipeBuilder(StateIngredientHelper.of(Blocks.AMETHYST_BLOCK),
431457
new VillagerIngredient(null, null, 3),
432458
Blocks.BUDDING_AMETHYST.defaultBlockState(), MediaConstants.CRYSTAL_UNIT * 10)
@@ -570,4 +596,52 @@ private void specialRecipe(Consumer<FinishedRecipe> consumer, SimpleCraftingReci
570596
var name = BuiltInRegistries.RECIPE_SERIALIZER.getKey(serializer);
571597
SpecialRecipeBuilder.special(serializer).save(consumer, HexAPI.MOD_ID + ":dynamic" + name.getPath());
572598
}
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+
}
573647
}

Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexBlockTagProvider.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ protected void addTags(HolderLookup.Provider provider) {
133133
add(tag(HexTags.Blocks.CHEAP_TO_BREAK_BLOCK),
134134
HexBlocks.CONJURED_BLOCK, HexBlocks.CONJURED_LIGHT);
135135

136+
add(tag(HexTags.Blocks.SLATE_BLOCKS),
137+
HexBlocks.SLATE_BLOCK, HexBlocks.SLATE_BRICKS, HexBlocks.SLATE_BRICKS_SMALL, HexBlocks.SLATE_TILES, HexBlocks.SLATE_PILLAR);
138+
add(tag(HexTags.Blocks.AMETHYST_BLOCKS),
139+
Blocks.AMETHYST_BLOCK, HexBlocks.AMETHYST_BRICKS, HexBlocks.AMETHYST_BRICKS_SMALL, HexBlocks.AMETHYST_TILES, HexBlocks.AMETHYST_PILLAR);
140+
add(tag(HexTags.Blocks.QUENCHED_ALLAY_BLOCKS),
141+
HexBlocks.QUENCHED_ALLAY, HexBlocks.QUENCHED_ALLAY_BRICKS, HexBlocks.QUENCHED_ALLAY_BRICKS_SMALL, HexBlocks.QUENCHED_ALLAY_TILES);
142+
136143
// this is a hack but fixes #532
137144
var createBrittle = TagKey.create(Registries.BLOCK, new ResourceLocation("create", "brittle"));
138145
tag(createBrittle).addOptionalTag(BuiltInRegistries.BLOCK.getKey(HexBlocks.SLATE));

Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexItemTagProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ protected void addTags(HolderLookup.Provider provider) {
5656
this.copy(HexTags.Blocks.IMPETI, HexTags.Items.IMPETI);
5757
this.copy(HexTags.Blocks.DIRECTRICES, HexTags.Items.DIRECTRICES);
5858
this.copy(HexTags.Blocks.MINDFLAYED_CIRCLE_COMPONENTS, HexTags.Items.MINDFLAYED_CIRCLE_COMPONENTS);
59+
this.copy(HexTags.Blocks.SLATE_BLOCKS, HexTags.Items.SLATE_BLOCKS);
60+
this.copy(HexTags.Blocks.AMETHYST_BLOCKS, HexTags.Items.AMETHYST_BLOCKS);
61+
this.copy(HexTags.Blocks.QUENCHED_ALLAY_BLOCKS, HexTags.Items.QUENCHED_ALLAY_BLOCKS);
5962
this.copy(BlockTags.LOGS_THAT_BURN, ItemTags.LOGS_THAT_BURN);
6063
this.copy(BlockTags.LOGS, ItemTags.LOGS);
6164
this.copy(BlockTags.PLANKS, ItemTags.PLANKS);

0 commit comments

Comments
 (0)