Skip to content

Commit a18c080

Browse files
committed
feat: Add blahaj recipes
*technically a fix*
1 parent 74a44d8 commit a18c080

Some content is hidden

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

58 files changed

+45
-856
lines changed

xplat/src/datagen/java/gay/pridecraft/joy/data/JoyItemTagProvider.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package gay.pridecraft.joy.data;
22

3+
import gay.pridecraft.joy.block.BlahajBlocks;
34
import gay.pridecraft.joy.registry.JoyItems;
45
import gay.pridecraft.joy.tags.JoyItemTags;
56
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
67
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
8+
import net.minecraft.item.Item;
79
import net.minecraft.item.Items;
810
import net.minecraft.registry.RegistryWrapper;
911

@@ -31,5 +33,16 @@ protected void configure(final RegistryWrapper.WrapperLookup wrapperLookup) {
3133
Items.TOTEM_OF_UNDYING,
3234
JoyItems.TOTEM_OF_PRIDE
3335
);
36+
37+
getOrCreateTagBuilder(JoyItemTags.SHARKS).add(
38+
BlahajBlocks.BLAHAJ_ITEM,
39+
BlahajBlocks.GRAY_SHARK_ITEM
40+
).add(BlahajBlocks.PRIDE_ITEMS.toArray(Item[]::new));
41+
42+
getOrCreateTagBuilder(JoyItemTags.PLUSHIES).add(
43+
BlahajBlocks.BLAVINGAD_ITEM,
44+
BlahajBlocks.BREAD_ITEM,
45+
BlahajBlocks.BROWN_BEAR_ITEM
46+
).addTag(JoyItemTags.SHARKS);
3447
}
3548
}

xplat/src/datagen/java/gay/pridecraft/joy/data/JoyRecipeProvider.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
package gay.pridecraft.joy.data;
22

3+
import gay.pridecraft.joy.block.BlahajBlocks;
34
import gay.pridecraft.joy.registry.JoyBlocks;
5+
import gay.pridecraft.joy.tags.JoyItemTags;
46
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
57
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
68
import net.minecraft.data.server.recipe.RecipeExporter;
79
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
10+
import net.minecraft.data.server.recipe.StonecuttingRecipeJsonBuilder;
811
import net.minecraft.item.Item;
912
import net.minecraft.item.ItemConvertible;
1013
import net.minecraft.item.Items;
14+
import net.minecraft.recipe.Ingredient;
1115
import net.minecraft.recipe.book.RecipeCategory;
1216
import net.minecraft.registry.Registries;
1317
import net.minecraft.registry.RegistryWrapper;
18+
import net.minecraft.registry.tag.TagKey;
1419

1520
import java.util.concurrent.CompletableFuture;
1621

@@ -28,6 +33,9 @@ public void generate(final RecipeExporter exporter) {
2833
offerConversion(JoyBlocks.BLUE_ALLIUM, Items.BLUE_DYE, exporter);
2934
offerConversion(JoyBlocks.PINK_ALLIUM, Items.PINK_DYE, exporter);
3035
offerConversion(JoyBlocks.WHITE_ALLIUM, Items.WHITE_DYE, exporter);
36+
37+
stonecutting(exporter, RecipeCategory.MISC, JoyItemTags.SHARKS, 1,
38+
BlahajBlocks.PRIDE_ITEMS.toArray(Item[]::new));
3139
}
3240

3341
private static void offerConversion(ItemConvertible base, Item dye, RecipeExporter exporter) {
@@ -38,4 +46,24 @@ private static void offerConversion(ItemConvertible base, Item dye, RecipeExport
3846
.withSuffixedPath("has_").toString(), conditionsFromItem(base))
3947
.offerTo(exporter);
4048
}
49+
50+
private static void stonecutting(RecipeExporter exporter, RecipeCategory category, TagKey<Item> base, int count, ItemConvertible... results) {
51+
for (final var result : results) {
52+
offerStonecuttingRecipe(exporter, category, result, base, count);
53+
}
54+
}
55+
56+
private static void offerStonecuttingRecipe(RecipeExporter exporter, RecipeCategory category, ItemConvertible output, TagKey<Item> input, int count) {
57+
StonecuttingRecipeJsonBuilder.createStonecutting(Ingredient.fromTag(input), category, output, count)
58+
.criterion(hasTag(input), conditionsFromTag(input))
59+
.offerTo(exporter, "stonecutting/" + tagToItem(input, output));
60+
}
61+
62+
private static String tagToItem(TagKey<?> input, ItemConvertible output) {
63+
return getItemPath(output) + "_from_" + input.id().getPath();
64+
}
65+
66+
private static String hasTag(TagKey<?> tag) {
67+
return tag.id().withSuffixedPath("has_").toString();
68+
}
4169
}

xplat/src/main/java/gay/pridecraft/joy/tags/JoyItemTags.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ public final class JoyItemTags {
1616
ELYTRA = common("elytra"),
1717
TOTEM_OF_UNDYING = common("totem_of_undying");
1818

19+
public static final TagKey<Item>
20+
PLUSHIES = joy("plushies"),
21+
SHARKS = joy("sharks");
22+
1923
private static TagKey<Item> joy(String name) {
2024
return TagKey.of(RegistryKeys.ITEM, JoyUtil.id(name));
2125
}

xplat/src/main/resources/data/joy/blahaj/loot_table/blocks/ace_shark.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

xplat/src/main/resources/data/joy/blahaj/loot_table/blocks/agender_shark.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

xplat/src/main/resources/data/joy/blahaj/loot_table/blocks/aro_shark.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

xplat/src/main/resources/data/joy/blahaj/loot_table/blocks/aroace_shark.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

xplat/src/main/resources/data/joy/blahaj/loot_table/blocks/bi_shark.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

xplat/src/main/resources/data/joy/blahaj/loot_table/blocks/blue_shark.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

xplat/src/main/resources/data/joy/blahaj/loot_table/blocks/blue_whale.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)