Add support for serene seasons. Closes #386

This commit is contained in:
Sollace 2024-09-18 22:51:06 +01:00
parent 3f9d26f4b4
commit 37a7b08e45
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 62 additions and 0 deletions

View file

@ -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<Item> AUTUMN_CROPS = item("autumn_crops");
TagKey<Item> WINTER_CROPS = item("winter_crops");
TagKey<Item> SPRING_CROPS = item("spring_crops");
TagKey<Item> SUMMER_CROPS = item("summer_crops");
private static TagKey<Item> item(String name) {
return TagKey.of(RegistryKeys.ITEM, new Identifier("sereneseasons", name));
}
}
interface Blocks {
TagKey<Block> AUTUMN_CROPS = block("autumn_crops");
TagKey<Block> WINTER_CROPS = block("winter_crops");
TagKey<Block> SPRING_CROPS = block("spring_crops");
TagKey<Block> SUMMER_CROPS = block("summer_crops");
private static TagKey<Block> block(String name) {
return TagKey.of(RegistryKeys.BLOCK, new Identifier("sereneseasons", name));
}
}
}

View file

@ -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() {

View file

@ -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() {