From 4b474941b47522285c06b14c37128a97405ffa6b Mon Sep 17 00:00:00 2001 From: Daniel Orr Date: Sun, 6 Oct 2024 14:28:04 +0100 Subject: [PATCH] Fat block recipe --- .gitignore | 3 ++ .../6fa3adb4fca924d179eb4b8a8e4283507f3797a1 | 2 - .../7c1de345afb5bf681e6a8125d617dc2e7d65aa2d | 2 - .../e43a29f4397b72b7523d5fcc156ae2acd12a63ac | 53 ------------------- .../recipes/building_blocks/fat_block.json | 32 +++++++++++ .../expandedmobdrops/recipe/fat_block.json | 17 ++++++ .../data/ExpandedMobDropsDataGenerator.java | 7 ++- .../data/{ => client}/LanguageProvider.java | 4 +- .../data/{ => client}/ModelProvider.java | 2 +- .../BlockLootTableProvider.java} | 6 +-- .../data/server/RecipeProvider.java | 22 ++++++++ .../expandedmobdrops/item/EMDItems.java | 33 +++++++++--- 12 files changed, 111 insertions(+), 72 deletions(-) delete mode 100644 src/main/generated/.cache/6fa3adb4fca924d179eb4b8a8e4283507f3797a1 delete mode 100644 src/main/generated/.cache/7c1de345afb5bf681e6a8125d617dc2e7d65aa2d delete mode 100644 src/main/generated/.cache/e43a29f4397b72b7523d5fcc156ae2acd12a63ac create mode 100644 src/main/generated/data/expandedmobdrops/advancement/recipes/building_blocks/fat_block.json create mode 100644 src/main/generated/data/expandedmobdrops/recipe/fat_block.json rename src/main/java/net/leafenzo/expandedmobdrops/data/{ => client}/LanguageProvider.java (95%) rename src/main/java/net/leafenzo/expandedmobdrops/data/{ => client}/ModelProvider.java (96%) rename src/main/java/net/leafenzo/expandedmobdrops/data/{BlockLootTableGenerator.java => server/BlockLootTableProvider.java} (63%) create mode 100644 src/main/java/net/leafenzo/expandedmobdrops/data/server/RecipeProvider.java diff --git a/.gitignore b/.gitignore index c476faf..f93c97f 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ hs_err_*.log replay_*.log *.hprof *.jfr + +# datagen +src/main/generated/.cache diff --git a/src/main/generated/.cache/6fa3adb4fca924d179eb4b8a8e4283507f3797a1 b/src/main/generated/.cache/6fa3adb4fca924d179eb4b8a8e4283507f3797a1 deleted file mode 100644 index 988d952..0000000 --- a/src/main/generated/.cache/6fa3adb4fca924d179eb4b8a8e4283507f3797a1 +++ /dev/null @@ -1,2 +0,0 @@ -// 1.21.1 2024-10-06T02:39:09.184387 Expanded Mob Drops/Language (en_us) -921517668c127c9a264f9438bff6cad6488a667b assets\expandedmobdrops\lang\en_us.json diff --git a/src/main/generated/.cache/7c1de345afb5bf681e6a8125d617dc2e7d65aa2d b/src/main/generated/.cache/7c1de345afb5bf681e6a8125d617dc2e7d65aa2d deleted file mode 100644 index df3d03f..0000000 --- a/src/main/generated/.cache/7c1de345afb5bf681e6a8125d617dc2e7d65aa2d +++ /dev/null @@ -1,2 +0,0 @@ -// 1.21.1 2024-10-06T02:39:09.1762378 Expanded Mob Drops/Block Loot Tables -034e5e59a96cd9e5d9079281409c65e35d428842 data\expandedmobdrops\loot_table\blocks\fat_block.json diff --git a/src/main/generated/.cache/e43a29f4397b72b7523d5fcc156ae2acd12a63ac b/src/main/generated/.cache/e43a29f4397b72b7523d5fcc156ae2acd12a63ac deleted file mode 100644 index 1c8b19b..0000000 --- a/src/main/generated/.cache/e43a29f4397b72b7523d5fcc156ae2acd12a63ac +++ /dev/null @@ -1,53 +0,0 @@ -// 1.21.1 2024-10-06T02:39:09.1803641 Expanded Mob Drops/Model Definitions -2fc58d7c226a9fdbda61d759a5070daae90a4bfe assets\expandedmobdrops\models\item\raw_bird.json -31455688b1e7934eb99c4b5559db20a823a925b0 assets\expandedmobdrops\models\item\polar_bear_hide.json -f44aabac4d30564534c8fefbec31aab65dd7976a assets\expandedmobdrops\models\item\cooked_squid.json -ae38ddf3908fa7af65fcebd43c3c1fc5ae0cbd76 assets\expandedmobdrops\models\item\strider_jerky.json -629ff3774390eed00cedddeb5de568d4f56c40ba assets\expandedmobdrops\models\item\camelid_meat.json -6982f991daf05f112604652cc4d6d372f72e3270 assets\expandedmobdrops\models\item\scaly_hide.json -86f9430ad4ca46071bdf8ccea94008d1724f040c assets\expandedmobdrops\models\item\sculk_tendril.json -8b08d3ff4a648d1b42a2fa56908c75ef18df81b0 assets\expandedmobdrops\models\item\panda_hide.json -08f7dcfc57e3dfd60ecde184c9d4ad0a2f41b8c5 assets\expandedmobdrops\models\block\fat_block.json -bba617faa7800dd22739e1fbf654145f2d22a5ad assets\expandedmobdrops\models\item\feline_meat.json -ade9395a47b20df82983470ea7e37975fbebffd2 assets\expandedmobdrops\models\item\critter_meat.json -639e197904c13d1add4c9b1b3f82c665142dc638 assets\expandedmobdrops\models\item\cooked_camelid.json -9e28fa341905121dec8f975cac67163303edf8f1 assets\expandedmobdrops\models\item\insect_flesh.json -a55f6351584d81d06377756002b2371777f8bec6 assets\expandedmobdrops\models\item\cooked_turtle.json -1a75c789147c5256220b9caa327dd8aee5a8a6eb assets\expandedmobdrops\models\item\glow_squid.json -ef4690c81db7461d64e38e169c25a8c1f5a67adc assets\expandedmobdrops\models\item\cooked_equine.json -2e7d5d3cc072cea98b465e2c1dfc27e775a7d1b5 assets\expandedmobdrops\models\item\sniffer_hide.json -f79d5bad393243782d1fb8af525d2793b8b7b036 assets\expandedmobdrops\models\item\raw_turtle.json -549789d20c363efe5836bfafa3e36cb7b581c899 assets\expandedmobdrops\models\item\bear_hide.json -b74eedfb3543342113a020a701278ec380c05bf4 assets\expandedmobdrops\models\item\bear_meat.json -7d894c5cf20ac5398e82b64fd64cbec0bf4422b7 assets\expandedmobdrops\models\item\raw_amphibian.json -b8caa9c87ebd25a65ac3ea721c4708c445a485f2 assets\expandedmobdrops\models\item\fungal_steak.json -778ba9641cddde6192166cda77019bee9ba6e8eb assets\expandedmobdrops\models\item\fox_hide.json -72a0ca2572e90204f13703f83ef60b675afd07ea assets\expandedmobdrops\models\item\cooked_arthropod.json -82b645639a893028993843de3cff9a8f142088b1 assets\expandedmobdrops\models\item\bear_steak.json -68c49cc2f1596b4af39cb76bce2fd13ec8e96af0 assets\expandedmobdrops\models\item\cooked_reptile.json -bd5424288bd19366fcecce1cf746d81ef26f792e assets\expandedmobdrops\models\item\raw_reptile.json -8f1d024f7734d220fcb12bad068470407aa63f9b assets\expandedmobdrops\models\item\ancient_chops.json -0d23a1bc15831025bbb24703bac3805d39873bd3 assets\expandedmobdrops\models\item\fat_block.json -b6216e09e61cfec6e9a73a850036c11448902672 assets\expandedmobdrops\models\item\cooked_bird.json -d2e0ac623bee8bfefa10d96298eb42890611abc9 assets\expandedmobdrops\models\item\fungal_meat.json -f0b494c5f8e5fd6d91539ae945fc380b413852e2 assets\expandedmobdrops\models\item\fat.json -90b42c9eddf865f3b82f7f4e56a8a2b025d3c86a assets\expandedmobdrops\models\item\squid.json -d48caae85d78786e8c4fd1cda7c5291834b7308e assets\expandedmobdrops\models\item\raw_bushmeat.json -790f95b70642aed809046985a6249adc90f66e8e assets\expandedmobdrops\models\item\cooked_amphibian.json -1b66509444533e5d68beff191d3b2d673ce508b8 assets\expandedmobdrops\models\item\cooked_canine.json -65e2e66b9f3c2de5e54f0db690ec54bb1d4c6306 assets\expandedmobdrops\models\item\critter_steak.json -8e8c0c387e1cd984a18ae6a58cc7607c05f33cb5 assets\expandedmobdrops\blockstates\fat_block.json -35c4d4ce62defbc5ae6a82683456c8915cd750a2 assets\expandedmobdrops\models\item\cooked_bushmeat.json -ed2939052a980cc82696fdcf995e69757fec9864 assets\expandedmobdrops\models\item\mooshroom_hide.json -6e44a27e8198752fe248b034c86df18ac28af1c1 assets\expandedmobdrops\models\item\canine_meat.json -df95cc4801b2a50cae233f672f768583d2ace6e9 assets\expandedmobdrops\models\item\cooked_feline.json -b7ab7c7120de2e360894a07cd62d91074ab3bbde assets\expandedmobdrops\models\item\rotten_porkchop.json -de27e7b6086d4c31ba5e840beb5633225636b25d assets\expandedmobdrops\models\item\bugmeat.json -8b75de16f11d55d4bfd811f9d38a3eee6c29ed0e assets\expandedmobdrops\models\item\strider_chunk.json -3bb417fbf20103de4bb7a5f32d39f2001f73a997 assets\expandedmobdrops\models\item\beast_meat.json -1b472d8e0e97ec6dc318493f44bb53e5646543c3 assets\expandedmobdrops\models\item\cooked_beast.json -a3debe6c9939dd2753ebcc5ff6a65d491ae6f3d0 assets\expandedmobdrops\models\item\arthropod_flesh.json -b1cc86eb09876affb14873e617cb7408e87fb62f assets\expandedmobdrops\models\item\ancient_steak.json -2403294c8339405ec2c814c8f53d8fb4d8f53cd4 assets\expandedmobdrops\models\item\strider_skin.json -be4053921d07c82a7a5389b87010eba615e15c0b assets\expandedmobdrops\models\item\equine_meat.json -eaef409e58cbdb3fe809aad176e4aeb855f83c92 assets\expandedmobdrops\models\item\roasted_tendril.json diff --git a/src/main/generated/data/expandedmobdrops/advancement/recipes/building_blocks/fat_block.json b/src/main/generated/data/expandedmobdrops/advancement/recipes/building_blocks/fat_block.json new file mode 100644 index 0000000..7874e41 --- /dev/null +++ b/src/main/generated/data/expandedmobdrops/advancement/recipes/building_blocks/fat_block.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_fat": { + "conditions": { + "items": [ + { + "items": "expandedmobdrops:fat" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "expandedmobdrops:fat_block" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_fat" + ] + ], + "rewards": { + "recipes": [ + "expandedmobdrops:fat_block" + ] + } +} \ No newline at end of file diff --git a/src/main/generated/data/expandedmobdrops/recipe/fat_block.json b/src/main/generated/data/expandedmobdrops/recipe/fat_block.json new file mode 100644 index 0000000..d34a094 --- /dev/null +++ b/src/main/generated/data/expandedmobdrops/recipe/fat_block.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "key": { + "#": { + "item": "expandedmobdrops:fat" + } + }, + "pattern": [ + "##", + "##" + ], + "result": { + "count": 1, + "id": "expandedmobdrops:fat_block" + } +} \ No newline at end of file diff --git a/src/main/java/net/leafenzo/expandedmobdrops/data/ExpandedMobDropsDataGenerator.java b/src/main/java/net/leafenzo/expandedmobdrops/data/ExpandedMobDropsDataGenerator.java index 6a366ba..52deb96 100644 --- a/src/main/java/net/leafenzo/expandedmobdrops/data/ExpandedMobDropsDataGenerator.java +++ b/src/main/java/net/leafenzo/expandedmobdrops/data/ExpandedMobDropsDataGenerator.java @@ -2,6 +2,10 @@ import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; +import net.leafenzo.expandedmobdrops.data.client.ModelProvider; +import net.leafenzo.expandedmobdrops.data.server.BlockLootTableProvider; +import net.leafenzo.expandedmobdrops.data.client.LanguageProvider; +import net.leafenzo.expandedmobdrops.data.server.RecipeProvider; public class ExpandedMobDropsDataGenerator implements DataGeneratorEntrypoint { @Override @@ -9,6 +13,7 @@ public void onInitializeDataGenerator(FabricDataGenerator generator) { FabricDataGenerator.Pack pack = generator.createPack(); pack.addProvider(ModelProvider::new); pack.addProvider(LanguageProvider::new); - pack.addProvider(BlockLootTableGenerator::new); + pack.addProvider(BlockLootTableProvider::new); + pack.addProvider(RecipeProvider::new); } } diff --git a/src/main/java/net/leafenzo/expandedmobdrops/data/LanguageProvider.java b/src/main/java/net/leafenzo/expandedmobdrops/data/client/LanguageProvider.java similarity index 95% rename from src/main/java/net/leafenzo/expandedmobdrops/data/LanguageProvider.java rename to src/main/java/net/leafenzo/expandedmobdrops/data/client/LanguageProvider.java index eb3d8bc..752c209 100644 --- a/src/main/java/net/leafenzo/expandedmobdrops/data/LanguageProvider.java +++ b/src/main/java/net/leafenzo/expandedmobdrops/data/client/LanguageProvider.java @@ -1,4 +1,4 @@ -package net.leafenzo.expandedmobdrops.data; +package net.leafenzo.expandedmobdrops.data.client; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider; @@ -10,7 +10,7 @@ import java.util.concurrent.CompletableFuture; public class LanguageProvider extends FabricLanguageProvider { - protected LanguageProvider(FabricDataOutput output, CompletableFuture lookup) { + public LanguageProvider(FabricDataOutput output, CompletableFuture lookup) { super(output, lookup); } diff --git a/src/main/java/net/leafenzo/expandedmobdrops/data/ModelProvider.java b/src/main/java/net/leafenzo/expandedmobdrops/data/client/ModelProvider.java similarity index 96% rename from src/main/java/net/leafenzo/expandedmobdrops/data/ModelProvider.java rename to src/main/java/net/leafenzo/expandedmobdrops/data/client/ModelProvider.java index 5145aed..60c59ff 100644 --- a/src/main/java/net/leafenzo/expandedmobdrops/data/ModelProvider.java +++ b/src/main/java/net/leafenzo/expandedmobdrops/data/client/ModelProvider.java @@ -1,4 +1,4 @@ -package net.leafenzo.expandedmobdrops.data; +package net.leafenzo.expandedmobdrops.data.client; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; diff --git a/src/main/java/net/leafenzo/expandedmobdrops/data/BlockLootTableGenerator.java b/src/main/java/net/leafenzo/expandedmobdrops/data/server/BlockLootTableProvider.java similarity index 63% rename from src/main/java/net/leafenzo/expandedmobdrops/data/BlockLootTableGenerator.java rename to src/main/java/net/leafenzo/expandedmobdrops/data/server/BlockLootTableProvider.java index 49bf8d4..c2138f5 100644 --- a/src/main/java/net/leafenzo/expandedmobdrops/data/BlockLootTableGenerator.java +++ b/src/main/java/net/leafenzo/expandedmobdrops/data/server/BlockLootTableProvider.java @@ -1,4 +1,4 @@ -package net.leafenzo.expandedmobdrops.data; +package net.leafenzo.expandedmobdrops.data.server; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider; @@ -7,8 +7,8 @@ import java.util.concurrent.CompletableFuture; -public class BlockLootTableGenerator extends FabricBlockLootTableProvider { - public BlockLootTableGenerator(FabricDataOutput output, CompletableFuture lookup) { +public class BlockLootTableProvider extends FabricBlockLootTableProvider { + public BlockLootTableProvider(FabricDataOutput output, CompletableFuture lookup) { super(output, lookup); } diff --git a/src/main/java/net/leafenzo/expandedmobdrops/data/server/RecipeProvider.java b/src/main/java/net/leafenzo/expandedmobdrops/data/server/RecipeProvider.java new file mode 100644 index 0000000..02663e6 --- /dev/null +++ b/src/main/java/net/leafenzo/expandedmobdrops/data/server/RecipeProvider.java @@ -0,0 +1,22 @@ +package net.leafenzo.expandedmobdrops.data.server; + +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; +import net.leafenzo.expandedmobdrops.block.EMDBlocks; +import net.leafenzo.expandedmobdrops.item.EMDItems; +import net.minecraft.data.server.recipe.RecipeExporter; +import net.minecraft.recipe.book.RecipeCategory; +import net.minecraft.registry.RegistryWrapper; + +import java.util.concurrent.CompletableFuture; + +public class RecipeProvider extends FabricRecipeProvider { + public RecipeProvider(FabricDataOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture); + } + + @Override + public void generate(RecipeExporter exporter) { + offer2x2CompactingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, EMDBlocks.FAT_BLOCK, EMDItems.FAT); + } +} diff --git a/src/main/java/net/leafenzo/expandedmobdrops/item/EMDItems.java b/src/main/java/net/leafenzo/expandedmobdrops/item/EMDItems.java index 5e53d51..6787193 100644 --- a/src/main/java/net/leafenzo/expandedmobdrops/item/EMDItems.java +++ b/src/main/java/net/leafenzo/expandedmobdrops/item/EMDItems.java @@ -10,13 +10,12 @@ import net.minecraft.util.Identifier; public class EMDItems { - public static final Item FAT_BLOCK = register("fat_block", new BlockItem(EMDBlocks.FAT_BLOCK, new Item.Settings())); - // Mammal Meats public static final Item BEAR_MEAT = registerFood( "bear_meat", new FoodComponent.Builder() ); + public static final Item BEAR_STEAK = registerFood( "bear_steak", new FoodComponent.Builder() @@ -26,6 +25,7 @@ public class EMDItems { "beast_meat", new FoodComponent.Builder() ); + public static final Item COOKED_BEAST = registerFood( "cooked_beast", new FoodComponent.Builder() @@ -35,6 +35,7 @@ public class EMDItems { "canine_meat", new FoodComponent.Builder() ); + public static final Item COOKED_CANINE = registerFood( "cooked_canine", new FoodComponent.Builder() @@ -44,6 +45,7 @@ public class EMDItems { "feline_meat", new FoodComponent.Builder() ); + public static final Item COOKED_FELINE = registerFood( "cooked_feline", new FoodComponent.Builder() @@ -53,6 +55,7 @@ public class EMDItems { "equine_meat", new FoodComponent.Builder() ); + public static final Item COOKED_EQUINE = registerFood( "cooked_equine", new FoodComponent.Builder() @@ -62,6 +65,7 @@ public class EMDItems { "camelid_meat", new FoodComponent.Builder() ); + public static final Item COOKED_CAMELID = registerFood( "cooked_camelid", new FoodComponent.Builder() @@ -72,6 +76,7 @@ public class EMDItems { "raw_bushmeat", new FoodComponent.Builder() ); + public static final Item COOKED_BUSHMEAT = registerFood( "cooked_bushmeat", new FoodComponent.Builder() @@ -86,6 +91,7 @@ public class EMDItems { "arthropod_flesh", new FoodComponent.Builder() ); + public static final Item COOKED_ARTHROPOD = registerFood( "cooked_arthropod", new FoodComponent.Builder() @@ -100,6 +106,7 @@ public class EMDItems { "critter_meat", new FoodComponent.Builder() ); + public static final Item CRITTER_STEAK = registerFood( "critter_steak", new FoodComponent.Builder() @@ -110,6 +117,7 @@ public class EMDItems { "raw_reptile", new FoodComponent.Builder() ); + public static final Item COOKED_REPTILE = registerFood( "cooked_reptile", new FoodComponent.Builder() @@ -119,6 +127,7 @@ public class EMDItems { "raw_amphibian", new FoodComponent.Builder() ); + public static final Item COOKED_AMPHIBIAN = registerFood( "cooked_amphibian", new FoodComponent.Builder() @@ -128,6 +137,7 @@ public class EMDItems { "raw_turtle", new FoodComponent.Builder() ); + public static final Item COOKED_TURTLE = registerFood( "cooked_turtle", new FoodComponent.Builder() @@ -138,6 +148,7 @@ public class EMDItems { "raw_bird", new FoodComponent.Builder() ); + public static final Item COOKED_BIRD = registerFood( "cooked_bird", new FoodComponent.Builder() @@ -148,6 +159,7 @@ public class EMDItems { "squid", new FoodComponent.Builder() ); + public static final Item COOKED_SQUID = registerFood( "cooked_squid", new FoodComponent.Builder() @@ -163,6 +175,7 @@ public class EMDItems { "ancient_chops", new FoodComponent.Builder() ); + public static final Item ANCIENT_STEAK = registerFood( "ancient_steak", new FoodComponent.Builder() @@ -172,6 +185,7 @@ public class EMDItems { "fungal_meat", new FoodComponent.Builder() ); + public static final Item FUNGAL_STEAK = registerFood( "fungal_steak", new FoodComponent.Builder() @@ -196,17 +210,12 @@ public class EMDItems { "strider_chunk", new FoodComponent.Builder() ); + public static final Item STRIDER_JERKY = registerFood( "strider_jerky", new FoodComponent.Builder() ); - // Miscellaneous Items - public static final Item FAT = registerFood( - "fat", - new FoodComponent.Builder() - ); - // Animal Hides public static final Item FOX_HIDE = registerFood( "fox_hide", @@ -248,6 +257,14 @@ public class EMDItems { new FoodComponent.Builder() ); + // Miscellaneous Items + public static final Item FAT = registerFood( + "fat", + new FoodComponent.Builder() + ); + + public static final Item FAT_BLOCK = register("fat_block", new BlockItem(EMDBlocks.FAT_BLOCK, new Item.Settings())); + private static Item register(String id, Item item) { return Registry.register(Registries.ITEM, Identifier.of(ExpandedMobDrops.MOD_ID, id), item); }