From 37a7b08e45e7901c29a95d7257eb78935a96e381 Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 18 Sep 2024 22:51:06 +0100 Subject: [PATCH] Add support for serene seasons. Closes #386 --- .../providers/tag/SereneSeasonsTags.java | 32 +++++++++++++++++++ .../providers/tag/UBlockTagProvider.java | 25 +++++++++++++++ .../providers/tag/UItemTagProvider.java | 5 +++ 3 files changed, 62 insertions(+) create mode 100644 src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/SereneSeasonsTags.java diff --git a/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/SereneSeasonsTags.java b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/SereneSeasonsTags.java new file mode 100644 index 00000000..100dcc99 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/SereneSeasonsTags.java @@ -0,0 +1,32 @@ +package com.minelittlepony.unicopia.datagen.providers.tag; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.util.Identifier; + +public interface SereneSeasonsTags { + interface Items { + TagKey AUTUMN_CROPS = item("autumn_crops"); + TagKey WINTER_CROPS = item("winter_crops"); + TagKey SPRING_CROPS = item("spring_crops"); + TagKey SUMMER_CROPS = item("summer_crops"); + + private static TagKey item(String name) { + return TagKey.of(RegistryKeys.ITEM, new Identifier("sereneseasons", name)); + } + } + + interface Blocks { + TagKey AUTUMN_CROPS = block("autumn_crops"); + TagKey WINTER_CROPS = block("winter_crops"); + TagKey SPRING_CROPS = block("spring_crops"); + TagKey SUMMER_CROPS = block("summer_crops"); + + private static TagKey block(String name) { + return TagKey.of(RegistryKeys.BLOCK, new Identifier("sereneseasons", name)); + } + } + +} diff --git a/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UBlockTagProvider.java b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UBlockTagProvider.java index 66ea54f0..b741612e 100644 --- a/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UBlockTagProvider.java +++ b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UBlockTagProvider.java @@ -8,6 +8,7 @@ import com.minelittlepony.unicopia.UTags; import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.block.UBlocks; import com.minelittlepony.unicopia.server.world.Tree; +import com.minelittlepony.unicopia.server.world.UTreeGen; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; @@ -103,6 +104,30 @@ public class UBlockTagProvider extends FabricTagProvider.BlockTagProvider { ).forceAddTag(TagKey.of(RegistryKeys.BLOCK, new Identifier("c", "concrete_powders"))); getOrCreateTagBuilder(UTags.Blocks.UNAFFECTED_BY_GROW_ABILITY).add(Blocks.GRASS_BLOCK); + addSeasonalCrops(); + } + + private void addSeasonalCrops() { + getOrCreateTagBuilder(SereneSeasonsTags.Blocks.AUTUMN_CROPS).add( + UBlocks.GREEN_APPLE_LEAVES, UBlocks.GREEN_APPLE_SPROUT, UTreeGen.GREEN_APPLE_TREE.sapling().get(), + UBlocks.SOUR_APPLE_LEAVES, UBlocks.SOUR_APPLE_SPROUT, UTreeGen.SOUR_APPLE_TREE.sapling().get(), + UBlocks.OATS_CROWN, UBlocks.OATS_STEM, UBlocks.OATS, + UBlocks.ROCKS + ); + getOrCreateTagBuilder(SereneSeasonsTags.Blocks.WINTER_CROPS).add(UBlocks.ROCKS); + getOrCreateTagBuilder(SereneSeasonsTags.Blocks.SPRING_CROPS).add( + UBlocks.SWEET_APPLE_LEAVES, UBlocks.SWEET_APPLE_SPROUT, UTreeGen.SWEET_APPLE_TREE.sapling().get(), + UBlocks.GOLDEN_OAK_LEAVES, UBlocks.GOLDEN_OAK_SPROUT, UTreeGen.GOLDEN_APPLE_TREE.sapling().get(), + UBlocks.PALM_LEAVES, UBlocks.BANANAS, UTreeGen.BANANA_TREE.sapling().get(), + UBlocks.PINEAPPLE, + UBlocks.ROCKS + ); + getOrCreateTagBuilder(SereneSeasonsTags.Blocks.SUMMER_CROPS).add( + UBlocks.SWEET_APPLE_LEAVES, UBlocks.SWEET_APPLE_SPROUT, UTreeGen.SWEET_APPLE_TREE.sapling().get(), + UBlocks.MANGO_LEAVES, UTreeGen.MANGO_TREE.sapling().get(), + UBlocks.OATS_CROWN, UBlocks.OATS_STEM, UBlocks.OATS, + UBlocks.ROCKS + ); } private void addFruitTrees() { diff --git a/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UItemTagProvider.java b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UItemTagProvider.java index 44d1db03..9e579480 100644 --- a/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UItemTagProvider.java +++ b/src/main/java/com/minelittlepony/unicopia/datagen/providers/tag/UItemTagProvider.java @@ -175,6 +175,11 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider { copy(UTags.Blocks.CLOUD_STAIRS, UTags.Items.CLOUD_STAIRS); copy(UTags.Blocks.CLOUD_BLOCKS, UTags.Items.CLOUD_BLOCKS); copy(UTags.Blocks.CHITIN_BLOCKS, UTags.Items.CHITIN_BLOCKS); + + copy(SereneSeasonsTags.Blocks.AUTUMN_CROPS, SereneSeasonsTags.Items.AUTUMN_CROPS); + copy(SereneSeasonsTags.Blocks.WINTER_CROPS, SereneSeasonsTags.Items.WINTER_CROPS); + copy(SereneSeasonsTags.Blocks.SPRING_CROPS, SereneSeasonsTags.Items.SPRING_CROPS); + copy(SereneSeasonsTags.Blocks.SUMMER_CROPS, SereneSeasonsTags.Items.SUMMER_CROPS); } private void exportForagingTags() {