Move creative tabs to datagen

This commit is contained in:
Sollace 2024-04-11 18:15:10 +01:00
parent 9c744eb3eb
commit b99c6b6c29
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
9 changed files with 118 additions and 218 deletions

View file

@ -27,6 +27,10 @@ public interface UBlockFamilies {
.slab(UBlocks.CLOUD_SLAB).stairs(UBlocks.CLOUD_STAIRS)
.group("cloud").unlockCriterionName("has_cloud_lump")
.build();
BlockFamily ETCHED_CLOUD = new BlockFamily.Builder(UBlocks.ETCHED_CLOUD)
.slab(UBlocks.ETCHED_CLOUD_SLAB).stairs(UBlocks.ETCHED_CLOUD_STAIRS)
.group("etched_cloud").unlockCriterionName("has_cloud_lump")
.build();
BlockFamily CLOUD_PLANKS = new BlockFamily.Builder(UBlocks.CLOUD_PLANKS)
.slab(UBlocks.CLOUD_PLANK_SLAB).stairs(UBlocks.CLOUD_PLANK_STAIRS)
.group("cloud").unlockCriterionName("has_cloud")

View file

@ -1,5 +1,8 @@
package com.minelittlepony.unicopia.datagen.providers.tag;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
@ -9,14 +12,18 @@ import com.minelittlepony.unicopia.UTags;
import com.minelittlepony.unicopia.block.UBlocks;
import com.minelittlepony.unicopia.datagen.Datagen;
import com.minelittlepony.unicopia.datagen.ItemFamilies;
import com.minelittlepony.unicopia.datagen.UBlockFamilies;
import com.minelittlepony.unicopia.item.BedsheetsItem;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.server.world.UTreeGen;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalItemTags;
import net.minecraft.block.Block;
import net.minecraft.data.family.BlockFamily;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKeys;
@ -138,6 +145,7 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
.forceAddTag(UConventionalTags.Items.CORALS).forceAddTag(UConventionalTags.Items.CORAL_FANS);
exportForagingTags();
exportCreativeTabs();
exportFarmersDelightItems();
}
@ -184,6 +192,112 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
getOrCreateTagBuilder(UTags.Items.FORAGE_STRENGHENING).add(Items.FERN);
getOrCreateTagBuilder(UTags.Items.FORAGE_SEVERE_NAUSEATING).add(Items.PITCHER_PLANT);
getOrCreateTagBuilder(UTags.Items.FORAGE_SEVERE_PRICKLY).add(Items.LARGE_FERN);
getOrCreateTagBuilder(UTags.Items.GROUP_FORAGING)
.forceAddTag(UTags.Items.FORAGE_BLINDING)
.forceAddTag(UTags.Items.FORAGE_DANGEROUS)
.forceAddTag(UTags.Items.FORAGE_FILLING)
.forceAddTag(UTags.Items.FORAGE_SAFE)
.forceAddTag(UTags.Items.FORAGE_NAUSEATING)
.forceAddTag(UTags.Items.FORAGE_PRICKLY)
.forceAddTag(UTags.Items.FORAGE_GLOWING)
.forceAddTag(UTags.Items.FORAGE_RISKY)
.forceAddTag(UTags.Items.FORAGE_STRENGHENING)
.forceAddTag(UTags.Items.FORAGE_SEVERE_NAUSEATING)
.forceAddTag(UTags.Items.FORAGE_SEVERE_PRICKLY);
}
private void exportCreativeTabs() {
getOrCreateTagBuilder(UTags.Items.GROUP_UNICORN).add(
UItems.SPELLBOOK, UItems.GEMSTONE, UItems.BOTCHED_GEM, UItems.FRIENDSHIP_BRACELET,
UItems.CRYSTAL_HEART, UItems.CRYSTAL_SHARD, UBlocks.CRYSTAL_DOOR.asItem(),
UItems.MEADOWBROOKS_STAFF, UItems.MAGIC_STAFF, UItems.GROGARS_BELL,
UItems.DRAGON_BREATH_SCROLL, UItems.PEGASUS_AMULET, UItems.ALICORN_AMULET,
UItems.BROKEN_ALICORN_AMULET, UItems.UNICORN_AMULET, UItems.SPECTRAL_CLOCK
);
getOrCreateTagBuilder(UTags.Items.GROUP_PEGASUS)
.add(UBlocks.SHAPING_BENCH.asItem(), UBlocks.CLOUD_CHEST.asItem(), UItems.CLOUD_LUMP)
.add(List.of(UBlockFamilies.CLOUD, UBlockFamilies.CLOUD_PLANKS, UBlockFamilies.CLOUD_BRICKS, UBlockFamilies.DENSE_CLOUD, UBlockFamilies.ETCHED_CLOUD)
.stream()
.map(BlockFamily::getVariants)
.map(Map::values)
.flatMap(Collection::stream)
.map(ItemConvertible::asItem)
.filter(Objects::nonNull)
.toArray(Item[]::new))
.add(UBlocks.UNSTABLE_CLOUD.asItem(), UBlocks.CLOUD_PILLAR.asItem(), UBlocks.CLOUD_DOOR.asItem(), UBlocks.CLOUD_BED.asItem())
.forceAddTag(UTags.Items.BED_SHEETS)
.forceAddTag(UConventionalTags.Items.RAW_FISH)
.forceAddTag(UConventionalTags.Items.COOKED_FISH)
.forceAddTag(UConventionalTags.Items.ROTTEN_FISH)
.forceAddTag(UTags.Items.CLOUD_JARS)
.add(UItems.LIGHTNING_JAR)
.forceAddTag(UTags.Items.POLEARMS)
.add(UItems.PEGASUS_FEATHER, UItems.GRYPHON_FEATHER, UItems.GOLDEN_FEATHER, UItems.GOLDEN_WING);
getOrCreateTagBuilder(UTags.Items.GROUP_EARTH_PONY)
.add(
UBlocks.GREEN_APPLE_LEAVES.asItem(), UBlocks.SWEET_APPLE_LEAVES.asItem(), UBlocks.SOUR_APPLE_LEAVES.asItem(), UBlocks.ZAP_LEAVES.asItem(), UBlocks.FLOWERING_ZAP_LEAVES.asItem(),
UBlocks.ZAP_LOG.asItem(), UBlocks.ZAP_WOOD.asItem(),
UBlocks.STRIPPED_ZAP_LOG.asItem(), UBlocks.STRIPPED_ZAP_WOOD.asItem(),
UBlocks.ZAP_PLANKS.asItem(), UBlocks.ZAP_STAIRS.asItem(), UBlocks.ZAP_SLAB.asItem(), UBlocks.ZAP_FENCE.asItem(), UBlocks.ZAP_FENCE_GATE.asItem(),
UBlocks.WAXED_ZAP_LOG.asItem(), UBlocks.WAXED_ZAP_WOOD.asItem(),
UBlocks.WAXED_STRIPPED_ZAP_LOG.asItem(), UBlocks.WAXED_STRIPPED_ZAP_WOOD.asItem(),
UBlocks.WAXED_ZAP_PLANKS.asItem(), UBlocks.WAXED_ZAP_STAIRS.asItem(), UBlocks.WAXED_ZAP_SLAB.asItem(), UBlocks.WAXED_ZAP_FENCE.asItem(), UBlocks.WAXED_ZAP_FENCE_GATE.asItem(),
UItems.CANDIED_APPLE, UBlocks.STABLE_DOOR.asItem(), UBlocks.DARK_OAK_DOOR.asItem())
.forceAddTag(UTags.Items.FRESH_APPLES)
.add(
UItems.ZAP_APPLE, UItems.ZAP_BULB, UItems.ROTTEN_APPLE,
UItems.GREEN_APPLE_SEEDS, UItems.SWEET_APPLE_SEEDS, UItems.SOUR_APPLE_SEEDS,
UTreeGen.ZAP_APPLE_TREE.sapling().get().asItem(),
UTreeGen.BANANA_TREE.sapling().get().asItem(),
UItems.CURING_JOKE, UItems.MANGO, UItems.EMPTY_JAR, UItems.COOKED_ZAP_APPLE,
UItems.ZAP_APPLE_JAM_JAR,
UItems.OAT_SEEDS, UItems.OATS, UItems.IMPORTED_OATS,
UItems.OATMEAL, UItems.OATMEAL_COOKIE, UItems.CHOCOLATE_OATMEAL_COOKIE,
UItems.DAFFODIL_DAISY_SANDWICH, UItems.HAY_BURGER, UItems.HAY_BURGER, UItems.HAY_FRIES,
UItems.CRISPY_HAY_FRIES, UItems.HORSE_SHOE_FRIES, UItems.WHEAT_WORMS,
UItems.BAITED_FISHING_ROD, UBlocks.WORM_BLOCK.asItem(),
UItems.MUFFIN, UItems.SCONE, UItems.ACORN, UItems.PINECONE, UItems.PINECONE_COOKIE,
UItems.BOWL_OF_NUTS, UItems.CRYSTAL_SHARD, UItems.PEBBLES, UItems.ROCK, UItems.WEIRD_ROCK,
UItems.ROCK_STEW, UItems.ROCK_CANDY, UItems.SALT_CUBE, UItems.MUG, UItems.CIDER, UItems.JUICE,
UItems.BURNED_JUICE, UItems.TOAST, UItems.JAM_TOAST, UItems.BURNED_TOAST, UItems.APPLE_PIE,
UItems.APPLE_PIE_HOOF, UItems.APPLE_PIE_SLICE, UBlocks.WEATHER_VANE.asItem()
)
.forceAddTag(UTags.Items.BASKETS)
.add(UItems.GIANT_BALLOON, UBlocks.CLOTH_BED.asItem())
.forceAddTag(UTags.Items.BED_SHEETS);
getOrCreateTagBuilder(UTags.Items.GROUP_BAT_PONY)
.forceAddTag(UConventionalTags.Items.RAW_INSECT)
.forceAddTag(UConventionalTags.Items.COOKED_INSECT)
.forceAddTag(UTags.Items.POLEARMS)
.add(
UBlocks.MANGO_LEAVES.asItem(), UTreeGen.MANGO_TREE.sapling().get().asItem(), UItems.MANGO,
UItems.PINEAPPLE, UItems.PINEAPPLE_CROWN, UItems.BANANA, UItems.SUNGLASSES, UItems.BROKEN_SUNGLASSES
);
getOrCreateTagBuilder(UTags.Items.GROUP_CHANGELING)
.add(
UItems.CARAPACE, UBlocks.SURFACE_CHITIN.asItem(), UBlocks.CHITIN.asItem()
).add(UBlockFamilies.CHISELED_CHITIN.getVariants().values().stream().map(ItemConvertible::asItem).toArray(Item[]::new))
.add(
UBlocks.CHISELLED_CHITIN_HULL.asItem(), UBlocks.CHITIN_SPIKES.asItem(),
UBlocks.SLIME_PUSTULE.asItem(),
UBlocks.MYSTERIOUS_EGG.asItem(), UItems.GREEN_FRIED_EGG,
UBlocks.HIVE.asItem()
)
.forceAddTag(UConventionalTags.Items.RAW_MEAT)
.forceAddTag(UConventionalTags.Items.COOKED_MEAT)
.forceAddTag(UConventionalTags.Items.ROTTEN_MEAT)
.forceAddTag(UConventionalTags.Items.RAW_INSECT)
.forceAddTag(UConventionalTags.Items.COOKED_INSECT)
.forceAddTag(UConventionalTags.Items.ROTTEN_INSECT)
.forceAddTag(UTags.Items.CONTAINER_WITH_LOVE);
getOrCreateTagBuilder(UTags.Items.GROUP_SEA_PONY)
.add(UItems.PEARL_NECKLACE)
.forceAddTag(UTags.Items.SHELLS)
.forceAddTag(UTags.Items.SPECIAL_SHELLS)
.forceAddTag(UTags.Items.LOW_QUALITY_SEA_VEGETABLES)
.forceAddTag(UTags.Items.HIGH_QUALITY_SEA_VEGETABLES);
}
private void exportConventionalTags() {

View file

@ -1,16 +0,0 @@
{
"replace": false,
"values": [
"#c:raw_insect",
"#c:cooked_insect",
"#unicopia:polearms",
"unicopia:mango_leaves",
"unicopia:mango_sapling",
"unicopia:mango",
"unicopia:pineapple",
"unicopia:pineapple_crown",
"unicopia:banana",
"unicopia:sunglasses",
"unicopia:broken_sunglasses"
]
}

View file

@ -1,23 +0,0 @@
{
"replace": false,
"values": [
"unicopia:carapace",
"unicopia:surface_chitin",
"unicopia:chitin",
"unicopia:chiselled_chitin",
"unicopia:chiselled_chitin_slab",
"unicopia:chiselled_chitin_stairs",
"unicopia:chiselled_chitin_hull",
"unicopia:chitin_spikes",
"unicopia:mysterious_egg",
"unicopia:green_fried_egg",
"unicopia:hive",
"unicopia:dark_oak_stable_door",
"#c:cooked_meat",
"#c:raw_meat",
"#c:raw_insect",
"#c:cooked_insect",
"#c:rotten_meat",
"#unicopia:container_with_love"
]
}

View file

@ -1,93 +0,0 @@
{
"replace": false,
"values": [
"unicopia:green_apple_leaves",
"unicopia:sweet_apple_leaves",
"unicopia:sour_apple_leaves",
"unicopia:zap_leaves",
"unicopia:flowering_zap_leaves",
"unicopia:zap_log",
"unicopia:zap_wood",
"unicopia:stripped_zap_log",
"unicopia:stripped_zap_wood",
"unicopia:zap_planks",
"unicopia:zap_stairs",
"unicopia:zap_slab",
"unicopia:zap_fence",
"unicopia:zap_fence_gate",
"unicopia:waxed_zap_log",
"unicopia:waxed_zap_wood",
"unicopia:waxed_stripped_zap_log",
"unicopia:waxed_stripped_zap_wood",
"unicopia:waxed_zap_planks",
"unicopia:waxed_zap_stairs",
"unicopia:waxed_zap_slab",
"unicopia:waxed_zap_fence",
"unicopia:waxed_zap_fence_gate",
"unicopia:candied_apple",
"unicopia:stable_door",
"unicopia:dark_oak_stable_door",
"minecraft:apple",
"unicopia:green_apple",
"unicopia:sweet_apple",
"unicopia:sour_apple",
"unicopia:zap_apple",
"unicopia:zap_bulb",
"unicopia:rotten_apple",
"unicopia:green_apple_seeds",
"unicopia:sweet_apple_seeds",
"unicopia:sour_apple_seeds",
"unicopia:green_apple_sapling",
"unicopia:sweet_apple_sapling",
"unicopia:sour_apple_sapling",
"unicopia:zapling",
"unicopia:palm_sapling",
"unicopia:curing_joke",
"unicopia:mango",
"unicopia:empty_jar",
"unicopia:cooked_zap_apple",
"unicopia:zap_apple_jam_jar",
"unicopia:oat_seeds",
"unicopia:oats",
"unicopia:imported_oats",
"unicopia:oatmeal",
"unicopia:oatmeal_cookie",
"unicopia:chocolate_oatmeal_cookie",
"unicopia:daffodil_daisy_sandwich",
"unicopia:hay_burger",
"unicopia:hay_fries",
"unicopia:crispy_hay_fries",
"unicopia:horse_shoe_fries",
"unicopia:wheat_worms",
"unicopia:baited_fishing_rod",
"unicopia:worm_block",
"unicopia:muffin",
"unicopia:scone",
"unicopia:acorn",
"unicopia:pinecone",
"unicopia:pinecone_cookie",
"unicopia:bowl_of_nuts",
"unicopia:crystal_shard",
"unicopia:pebbles",
"unicopia:rock",
"unicopia:weird_rock",
"unicopia:rock_stew",
"unicopia:rock_candy",
"unicopia:salt_cube",
"unicopia:mug",
"unicopia:cider",
"unicopia:juice",
"unicopia:burned_juice",
"unicopia:toast",
"unicopia:jam_toast",
"unicopia:burned_toast",
"unicopia:apple_pie",
"unicopia:apple_pie_hoof",
"unicopia:apple_pie_slice",
"unicopia:weather_vane",
"#unicopia:baskets",
"unicopia:giant_balloon",
"unicopia:cloth_bed",
"#unicopia:bed_sheets"
]
}

View file

@ -1,16 +0,0 @@
{
"replace": false,
"values": [
"#unicopia:forage/dangerous",
"#unicopia:forage/filling",
"#unicopia:forage/safe",
"#unicopia:forage/nauseating",
"#unicopia:forage/blinding",
"#unicopia:forage/prickly",
"#unicopia:forage/glowing",
"#unicopia:forage/risky",
"#unicopia:forage/severe/nauseating",
"#unicopia:forage/severe/prickly",
"#unicopia:forage/strenghtening"
]
}

View file

@ -1,39 +0,0 @@
{
"replace": false,
"values": [
"unicopia:shaping_bench",
"unicopia:cloud_chest",
"unicopia:cloud_lump",
"unicopia:cloud",
"unicopia:cloud_slab",
"unicopia:cloud_stairs",
"unicopia:cloud_planks",
"unicopia:cloud_plank_slab",
"unicopia:cloud_plank_stairs",
"unicopia:cloud_bricks",
"unicopia:cloud_brick_slab",
"unicopia:cloud_brick_stairs",
"unicopia:dense_cloud",
"unicopia:dense_cloud_slab",
"unicopia:dense_cloud_stairs",
"unicopia:etched_cloud",
"unicopia:etched_cloud_slab",
"unicopia:etched_cloud_stairs",
"unicopia:unstable_cloud",
"unicopia:cloud_pillar",
"unicopia:cloud_door",
"unicopia:cloud_bed",
"#unicopia:bed_sheets",
"#c:raw_fish",
"#c:cooked_fish",
"#c:rotten_fish",
"unicopia:rain_cloud_jar",
"unicopia:storm_cloud_jar",
"unicopia:lightning_jar",
"#unicopia:polearms",
"unicopia:pegasus_feather",
"unicopia:gryphon_feather",
"unicopia:golden_feather",
"unicopia:golden_wing"
]
}

View file

@ -1,10 +0,0 @@
{
"replace": false,
"values": [
"unicopia:pearl_necklace",
"#unicopia:shells",
"#unicopia:special_shells",
"#unicopia:food_types/low_quality_sea_vegetables",
"#unicopia:food_types/high_quality_sea_vegetables"
]
}

View file

@ -1,21 +0,0 @@
{
"replace": false,
"values": [
"unicopia:spellbook",
"unicopia:gemstone",
"unicopia:botched_gem",
"unicopia:friendship_bracelet",
"unicopia:crystal_heart",
"unicopia:crystal_shard",
"unicopia:crystal_door",
"unicopia:meadowbrooks_staff",
"unicopia:magic_staff",
"unicopia:grogars_bell",
"unicopia:dragon_breath_scroll",
"unicopia:pegasus_amulet",
"unicopia:alicorn_amulet",
"unicopia:broken_alicorn_amulet",
"unicopia:unicorn_amulet",
"unicopia:spectral_clock"
]
}