From daef439632d818c52f4de7ca371ae3a58d1cb51a Mon Sep 17 00:00:00 2001 From: Andrew-71 Date: Tue, 12 Mar 2024 19:31:09 +0300 Subject: [PATCH] Add banner pattern crafting recipes --- CHANGELOG | 2 +- TODO.md | 6 -- .../recipes/misc/grain_pattern.json | 48 +++++++++++++++ .../recipes/misc/sickle_pattern.json | 48 +++++++++++++++ .../recipes/misc/star_pattern.json | 61 +++++++++++++++++++ .../new_soviet/recipes/grain_pattern.json | 15 +++++ .../new_soviet/recipes/sickle_pattern.json | 15 +++++ .../data/new_soviet/recipes/star_pattern.json | 18 ++++++ .../blocks/lamps/DevTableLampBlock.java | 17 ------ .../new_soviet/datagen/RecipeGenerator.java | 14 +++++ .../registration/NSE_BaseRegistration.java | 5 +- .../new_soviet/registration/NSE_Items.java | 10 ++- 12 files changed, 230 insertions(+), 29 deletions(-) create mode 100644 src/main/generated/data/new_soviet/advancements/recipes/misc/grain_pattern.json create mode 100644 src/main/generated/data/new_soviet/advancements/recipes/misc/sickle_pattern.json create mode 100644 src/main/generated/data/new_soviet/advancements/recipes/misc/star_pattern.json create mode 100644 src/main/generated/data/new_soviet/recipes/grain_pattern.json create mode 100644 src/main/generated/data/new_soviet/recipes/sickle_pattern.json create mode 100644 src/main/generated/data/new_soviet/recipes/star_pattern.json delete mode 100644 src/main/java/su/a71/new_soviet/blocks/lamps/DevTableLampBlock.java diff --git a/CHANGELOG b/CHANGELOG index bc139dd..58c4b4f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -74,7 +74,7 @@ Due to sheer amount of changes, some may be undocumented. We hope you enjoy this * Now uses screwdriver to change sound * Sound names now translated * Added a questionable sound option -* At least 1 new advancement +* At least 2 new advancements * Bug fixes * Stone-cutting recipe for slabs now gives 2 blocks * Fixed typos in Russian translation diff --git a/TODO.md b/TODO.md index 7fef4c8..93a6dc8 100644 --- a/TODO.md +++ b/TODO.md @@ -10,9 +10,6 @@ * Add rubbish, rocks * Figure out electronic devices - function -=== ACHIEVEMENTS === -* Chicken kiev - kill a chicken with aspect of fire sickle - === VERSION SPECIFIC === ## 0.3 Goals left - QOL @@ -20,13 +17,10 @@ Goals left - QOL * Better feedback - particles, noises ~+- ## 0.4 -* Add crafting recipes for banner patterns; re-make grain? -* Concrete with bars 2 axis rotation * TV rework #3 (new colours, second static, ...?) * More landmines, land mine base item, create integration for it * Rework cigarette (code and some functionality) * Missing warning stripes? -* Fix banner registration not having items, add crafting recipes ## Pre ~~flight~~ update checklist * Update ru_ru and ru_rpr translations diff --git a/src/main/generated/data/new_soviet/advancements/recipes/misc/grain_pattern.json b/src/main/generated/data/new_soviet/advancements/recipes/misc/grain_pattern.json new file mode 100644 index 0000000..93ab009 --- /dev/null +++ b/src/main/generated/data/new_soviet/advancements/recipes/misc/grain_pattern.json @@ -0,0 +1,48 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_paper": { + "conditions": { + "items": [ + { + "items": [ + "new_soviet:grain_pattern" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "new_soviet:grain_pattern" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_wheat": { + "conditions": { + "items": [ + { + "items": [ + "new_soviet:grain_pattern" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_paper", + "has_wheat", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "new_soviet:grain_pattern" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/advancements/recipes/misc/sickle_pattern.json b/src/main/generated/data/new_soviet/advancements/recipes/misc/sickle_pattern.json new file mode 100644 index 0000000..26535f5 --- /dev/null +++ b/src/main/generated/data/new_soviet/advancements/recipes/misc/sickle_pattern.json @@ -0,0 +1,48 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_paper": { + "conditions": { + "items": [ + { + "items": [ + "new_soviet:sickle_pattern" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_sickle": { + "conditions": { + "items": [ + { + "items": [ + "new_soviet:sickle_pattern" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "new_soviet:sickle_pattern" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_paper", + "has_sickle", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "new_soviet:sickle_pattern" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/advancements/recipes/misc/star_pattern.json b/src/main/generated/data/new_soviet/advancements/recipes/misc/star_pattern.json new file mode 100644 index 0000000..b23744e --- /dev/null +++ b/src/main/generated/data/new_soviet/advancements/recipes/misc/star_pattern.json @@ -0,0 +1,61 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_paper": { + "conditions": { + "items": [ + { + "items": [ + "new_soviet:star_pattern" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_red_dye": { + "conditions": { + "items": [ + { + "items": [ + "new_soviet:star_pattern" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_sickle": { + "conditions": { + "items": [ + { + "items": [ + "new_soviet:star_pattern" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "new_soviet:star_pattern" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_paper", + "has_sickle", + "has_red_dye", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "new_soviet:star_pattern" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/recipes/grain_pattern.json b/src/main/generated/data/new_soviet/recipes/grain_pattern.json new file mode 100644 index 0000000..65656d5 --- /dev/null +++ b/src/main/generated/data/new_soviet/recipes/grain_pattern.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "minecraft:paper" + }, + { + "item": "minecraft:wheat" + } + ], + "result": { + "item": "new_soviet:grain_pattern" + } +} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/recipes/sickle_pattern.json b/src/main/generated/data/new_soviet/recipes/sickle_pattern.json new file mode 100644 index 0000000..17da49b --- /dev/null +++ b/src/main/generated/data/new_soviet/recipes/sickle_pattern.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "minecraft:paper" + }, + { + "item": "new_soviet:sickle" + } + ], + "result": { + "item": "new_soviet:sickle_pattern" + } +} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/recipes/star_pattern.json b/src/main/generated/data/new_soviet/recipes/star_pattern.json new file mode 100644 index 0000000..1e4b48d --- /dev/null +++ b/src/main/generated/data/new_soviet/recipes/star_pattern.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "minecraft:paper" + }, + { + "item": "new_soviet:sickle" + }, + { + "item": "minecraft:red_dye" + } + ], + "result": { + "item": "new_soviet:star_pattern" + } +} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/lamps/DevTableLampBlock.java b/src/main/java/su/a71/new_soviet/blocks/lamps/DevTableLampBlock.java deleted file mode 100644 index d2892b2..0000000 --- a/src/main/java/su/a71/new_soviet/blocks/lamps/DevTableLampBlock.java +++ /dev/null @@ -1,17 +0,0 @@ -package su.a71.new_soviet.blocks.lamps; - -import su.a71.new_soviet.util.Shapes; - -import java.util.List; - -public class DevTableLampBlock extends GoldenTableLampBlock { - - public DevTableLampBlock(Settings settings) { - super(settings); - SHAPE = new Shapes.HorizontalShapeLegacy(List.of( - List.of(5.0, 0.0, 5.0, 11.0, 2.0, 11.0), - List.of(7.0, 2.0, 7.0, 9.0, 4.0, 9.0), - List.of(6.0, 4.0, 6.0, 10.0, 5.0, 10.0), - List.of(3.0, 9.0, 3.0, 13.0, 13.0, 7.0))); - } -} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/datagen/RecipeGenerator.java b/src/main/java/su/a71/new_soviet/datagen/RecipeGenerator.java index 243131e..8fb31d8 100644 --- a/src/main/java/su/a71/new_soviet/datagen/RecipeGenerator.java +++ b/src/main/java/su/a71/new_soviet/datagen/RecipeGenerator.java @@ -913,5 +913,19 @@ public class RecipeGenerator extends FabricRecipeProvider { .criterion(hasItem(Items.IRON_INGOT), conditionsFromItem(Items.IRON_INGOT)) .criterion(hasItem(Items.STICK), conditionsFromItem(Items.STICK)) .offerTo(exporter); + + ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, NSE_Items.SICKLE_PATTERN).input(Items.PAPER).input(NSE_Items.SICKLE) + .criterion(FabricRecipeProvider.hasItem(Items.PAPER), FabricRecipeProvider.conditionsFromItem(NSE_Items.SICKLE_PATTERN)) + .criterion(FabricRecipeProvider.hasItem(NSE_Items.SICKLE), FabricRecipeProvider.conditionsFromItem(NSE_Items.SICKLE_PATTERN)) + .offerTo(exporter); + ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, NSE_Items.STAR_PATTERN).input(Items.PAPER).input(NSE_Items.SICKLE).input(Items.RED_DYE) + .criterion(FabricRecipeProvider.hasItem(Items.PAPER), FabricRecipeProvider.conditionsFromItem(NSE_Items.STAR_PATTERN)) + .criterion(FabricRecipeProvider.hasItem(NSE_Items.SICKLE), FabricRecipeProvider.conditionsFromItem(NSE_Items.STAR_PATTERN)) + .criterion(FabricRecipeProvider.hasItem(Items.RED_DYE), FabricRecipeProvider.conditionsFromItem(NSE_Items.STAR_PATTERN)) + .offerTo(exporter); + ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, NSE_Items.GRAIN_PATTERN).input(Items.PAPER).input(Items.WHEAT) + .criterion(FabricRecipeProvider.hasItem(Items.PAPER), FabricRecipeProvider.conditionsFromItem(NSE_Items.GRAIN_PATTERN)) + .criterion(FabricRecipeProvider.hasItem(Items.WHEAT), FabricRecipeProvider.conditionsFromItem(NSE_Items.GRAIN_PATTERN)) + .offerTo(exporter); } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_BaseRegistration.java b/src/main/java/su/a71/new_soviet/registration/NSE_BaseRegistration.java index dd74146..8de672b 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_BaseRegistration.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_BaseRegistration.java @@ -63,16 +63,17 @@ public class NSE_BaseRegistration { return TagKey.of(RegistryKeys.ITEM, new Identifier(NewSoviet.MOD_ID, name)); } - public static void registerPattern(String name, Rarity rarity, ItemGroup tab) { + public static BannerPatternItem registerPattern(String name, Rarity rarity, ItemGroup tab) { BannerPattern patternThing = new BannerPattern(name); final TagKey bannerTag = TagKey.of(RegistryKeys.BANNER_PATTERN, new Identifier(NewSoviet.MOD_ID, name)); BannerPatternItem patternItem = new BannerPatternItem(bannerTag, new Item.Settings().rarity(rarity)); Registry.register(Registries.ITEM, new Identifier(NewSoviet.MOD_ID, name), patternItem); Registry.register(Registries.BANNER_PATTERN, new Identifier(NewSoviet.MOD_ID, name), patternThing); - if (tab == null) return; // Sanity check for hidden items + if (tab == null) return patternItem; // Sanity check for hidden items Optional> key = Registries.ITEM_GROUP.getKey(tab); key.ifPresent(itemGroupRegistryKey -> ItemGroupEvents.modifyEntriesEvent(itemGroupRegistryKey).register(content -> content.add(patternItem))); + return patternItem; } public static void init() {} diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Items.java b/src/main/java/su/a71/new_soviet/registration/NSE_Items.java index e4b47c0..9e1e965 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Items.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Items.java @@ -39,6 +39,10 @@ public class NSE_Items extends NSE_BaseRegistration { public static final MusicDiscItem MUSIC_DISC_USSR_ANTHEM = new MusicDiscItem(1, NSE_Sounds.MUSIC_USSR_ANTHEM, new Item.Settings().maxCount(1), 206); + public static BannerPatternItem SICKLE_PATTERN; + public static BannerPatternItem STAR_PATTERN; + public static BannerPatternItem GRAIN_PATTERN; + private static final ItemGroup NSE_ITEMS_TAB = FabricItemGroup.builder() .icon(() -> new ItemStack(SICKLE)) .displayName(Text.translatable("itemGroup.new_soviet.items")) @@ -58,9 +62,9 @@ public class NSE_Items extends NSE_BaseRegistration { registerItem("antenna", () -> ANTENNA, NSE_ITEMS_TAB); registerItem("cigarette", ()-> CIGARETTE, NSE_ITEMS_TAB); registerItem("cigarette_butt", ()-> CIGARETTE_BUTT, NSE_ITEMS_TAB); - registerPattern("sickle_pattern", Rarity.UNCOMMON, NSE_ITEMS_TAB); - registerPattern("star_pattern", Rarity.UNCOMMON, NSE_ITEMS_TAB); - registerPattern("grain_pattern", Rarity.UNCOMMON, NSE_ITEMS_TAB); + SICKLE_PATTERN = registerPattern("sickle_pattern", Rarity.UNCOMMON, NSE_ITEMS_TAB); + STAR_PATTERN = registerPattern("star_pattern", Rarity.UNCOMMON, NSE_ITEMS_TAB); + GRAIN_PATTERN = registerPattern("grain_pattern", Rarity.UNCOMMON, NSE_ITEMS_TAB); registerItem("music_disc_ussr_anthem", () -> MUSIC_DISC_USSR_ANTHEM, NSE_ITEMS_TAB); }