Move a whole bunch of item tags to datagen

This commit is contained in:
Sollace 2024-03-19 20:46:29 +00:00
parent 7bad93044d
commit 672dd72d62
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
50 changed files with 216 additions and 418 deletions

View file

@ -0,0 +1,38 @@
package com.minelittlepony.unicopia;
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 UConventionalTags {
TagKey<Item> APPLES = item("apples");
TagKey<Item> ACORNS = item("acorns");
TagKey<Item> PINECONES = item("pinecones");
TagKey<Item> PINEAPPLES = item("pineapples");
TagKey<Item> BANANAS = item("bananas");
TagKey<Item> STICKS = item("sticks");
TagKey<Item> SEEDS = item("seeds");
TagKey<Item> GRAIN = item("grain");
TagKey<Item> NUTS = item("nuts");
TagKey<Item> MUSHROOMS = item("mushrooms");
TagKey<Item> MUFFINS = item("muffins");
TagKey<Item> MANGOES = item("mangoes");
TagKey<Item> OEATMEALS = item("oatmeals");
TagKey<Item> FRUITS = item("fruits");
TagKey<Item> COOKED_FISH = item("cooked_fish");
TagKey<Item> CROPS_PEANUTS = item("crops/peanuts");
TagKey<Item> TOOL_KNIVES = item("tools/knives");
static TagKey<Item> item(String name) {
return TagKey.of(RegistryKeys.ITEM, new Identifier("c", name));
}
static TagKey<Block> block(String name) {
return TagKey.of(RegistryKeys.BLOCK, new Identifier("c", name));
}
}

View file

@ -11,7 +11,6 @@ import net.minecraft.util.Identifier;
import net.minecraft.world.dimension.DimensionType;
public interface UTags {
TagKey<Item> APPLES = item("apples");
TagKey<Item> FRESH_APPLES = item("fresh_apples");
TagKey<Item> FALLS_SLOWLY = item("falls_slowly");
@ -34,11 +33,11 @@ public interface UTags {
TagKey<Item> HORSE_SHOES = item("horse_shoes");
TagKey<Item> APPLE_SEEDS = item("apple_seeds");
TagKey<Item> ACORNS = item("acorns");
TagKey<Item> BASKETS = item("baskets");
TagKey<Item> BADGES = item("badges");
TagKey<Item> BED_SHEETS = item("bed_sheets");
TagKey<Item> CLOUD_JARS = item("cloud_jars");
TagKey<Block> GLASS_PANES = block("glass_panes");
TagKey<Block> GLASS_BLOCKS = block("glass_blocks");
TagKey<Block> FRAGILE = block("fragile");
TagKey<Block> INTERESTING = block("interesting");
TagKey<Block> CATAPULT_IMMUNE = block("catapult_immune");
@ -59,6 +58,28 @@ public interface UTags {
TagKey<DimensionType> HAS_NO_ATMOSPHERE = dimension("has_no_atmosphere");
interface Items {
TagKey<Item> ZAP_LOGS = item("zap_logs");
TagKey<Item> WAXED_ZAP_LOGS = item("waxed_zap_logs");
TagKey<Item> PALM_LOGS = item("palm_logs");
TagKey<Item> CLOUD_BEDS = item("cloud_beds");
TagKey<Item> CLOUD_SLABS = item("cloud_slabs");
TagKey<Item> CLOUD_STAIRS = item("cloud_stairs");
TagKey<Item> CLOUD_BLOCKS = item("cloud_blocks");
TagKey<Item> CHITIN_BLOCKS = item("chitin_blocks");
}
interface Blocks {
TagKey<Block> ZAP_LOGS = block("zap_logs");
TagKey<Block> WAXED_ZAP_LOGS = block("waxed_zap_logs");
TagKey<Block> PALM_LOGS = block("palm_logs");
TagKey<Block> CLOUD_BEDS = block("cloud_beds");
TagKey<Block> CLOUD_SLABS = block("cloud_slabs");
TagKey<Block> CLOUD_STAIRS = block("cloud_stairs");
TagKey<Block> CLOUD_BLOCKS = block("cloud_blocks");
TagKey<Block> CHITIN_BLOCKS = block("chitin_blocks");
}
static TagKey<Item> item(String name) {
return TagKey.of(RegistryKeys.ITEM, Unicopia.id(name));
}

View file

@ -1,5 +1,8 @@
package com.minelittlepony.unicopia.datagen;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.minelittlepony.unicopia.datagen.providers.UBlockTagProvider;
import com.minelittlepony.unicopia.datagen.providers.UItemTagProvider;
import com.minelittlepony.unicopia.datagen.providers.UModelProvider;
@ -19,6 +22,8 @@ import net.minecraft.world.gen.carver.ConfiguredCarver;
import net.minecraft.world.gen.feature.PlacedFeature;
public class Datagen implements DataGeneratorEntrypoint {
public static final Logger LOGGER = LogManager.getLogger();
@Override
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
final FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();

View file

@ -16,6 +16,7 @@ import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.RegistryWrapper.WrapperLookup;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.TagBuilder;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
@ -24,6 +25,11 @@ public class UBlockTagProvider extends FabricTagProvider.BlockTagProvider {
super(output, registriesFuture);
}
@Override
protected TagBuilder getTagBuilder(TagKey<Block> tag) {
return super.getTagBuilder(tag);
}
@Override
protected void configure(WrapperLookup registries) {
Block[] crops = {
@ -47,7 +53,6 @@ public class UBlockTagProvider extends FabricTagProvider.BlockTagProvider {
addPalmWoodset();
addCloudBlocksets();
addChitinBlocksets();
addHayBlocks();
addFruitTrees();
getOrCreateTagBuilder(UTags.CRYSTAL_HEART_BASE).add(
@ -107,13 +112,10 @@ public class UBlockTagProvider extends FabricTagProvider.BlockTagProvider {
UBlocks.ZAP_STAIRS
);
TagKey<Block> logsTag = UTags.block("zap_logs");
TagKey<Block> waxedLogsTag = UTags.block("waxed_zap_logs");
getOrCreateTagBuilder(logsTag).add(UBlocks.ZAP_LOG, UBlocks.ZAP_WOOD, UBlocks.STRIPPED_ZAP_LOG, UBlocks.STRIPPED_ZAP_WOOD);
getOrCreateTagBuilder(waxedLogsTag).add(UBlocks.WAXED_ZAP_LOG, UBlocks.WAXED_ZAP_WOOD, UBlocks.WAXED_STRIPPED_ZAP_LOG, UBlocks.WAXED_STRIPPED_ZAP_WOOD);
getOrCreateTagBuilder(BlockTags.LOGS).forceAddTag(logsTag).forceAddTag(waxedLogsTag);
getOrCreateTagBuilder(BlockTags.LOGS_THAT_BURN).forceAddTag(logsTag);
getOrCreateTagBuilder(UTags.Blocks.ZAP_LOGS).add(UBlocks.ZAP_LOG, UBlocks.ZAP_WOOD, UBlocks.STRIPPED_ZAP_LOG, UBlocks.STRIPPED_ZAP_WOOD);
getOrCreateTagBuilder(UTags.Blocks.WAXED_ZAP_LOGS).add(UBlocks.WAXED_ZAP_LOG, UBlocks.WAXED_ZAP_WOOD, UBlocks.WAXED_STRIPPED_ZAP_LOG, UBlocks.WAXED_STRIPPED_ZAP_WOOD);
getOrCreateTagBuilder(BlockTags.LOGS).forceAddTag(UTags.Blocks.ZAP_LOGS).forceAddTag(UTags.Blocks.WAXED_ZAP_LOGS);
getOrCreateTagBuilder(BlockTags.LOGS_THAT_BURN).forceAddTag(UTags.Blocks.ZAP_LOGS);
getOrCreateTagBuilder(BlockTags.PLANKS).add(UBlocks.ZAP_PLANKS, UBlocks.WAXED_ZAP_PLANKS);
//getOrCreateTagBuilder(BlockTags.WOODEN_BUTTONS).add(UBlocks.ZAP_BUTTON);
@ -133,12 +135,9 @@ public class UBlockTagProvider extends FabricTagProvider.BlockTagProvider {
private void addPalmWoodset() {
getOrCreateTagBuilder(BlockTags.LEAVES).add(UBlocks.PALM_LEAVES);
getOrCreateTagBuilder(BlockTags.HOE_MINEABLE).add(UBlocks.PALM_LEAVES);
TagKey<Block> logsTag = UTags.block("palm_logs");
getOrCreateTagBuilder(logsTag).add(UBlocks.PALM_LOG, UBlocks.PALM_WOOD, UBlocks.STRIPPED_PALM_LOG, UBlocks.STRIPPED_PALM_WOOD);
getOrCreateTagBuilder(BlockTags.LOGS).forceAddTag(logsTag);
getOrCreateTagBuilder(BlockTags.LOGS_THAT_BURN).forceAddTag(logsTag);
getOrCreateTagBuilder(UTags.Blocks.PALM_LOGS).add(UBlocks.PALM_LOG, UBlocks.PALM_WOOD, UBlocks.STRIPPED_PALM_LOG, UBlocks.STRIPPED_PALM_WOOD);
getOrCreateTagBuilder(BlockTags.LOGS).forceAddTag(UTags.Blocks.PALM_LOGS);
getOrCreateTagBuilder(BlockTags.LOGS_THAT_BURN).forceAddTag(UTags.Blocks.PALM_LOGS);
getOrCreateTagBuilder(BlockTags.PLANKS).add(UBlocks.PALM_PLANKS);
addSign(UBlocks.PALM_SIGN, UBlocks.PALM_WALL_SIGN, UBlocks.PALM_HANGING_SIGN, UBlocks.PALM_WALL_HANGING_SIGN);
getOrCreateTagBuilder(BlockTags.WOODEN_BUTTONS).add(UBlocks.PALM_BUTTON);
@ -163,24 +162,31 @@ public class UBlockTagProvider extends FabricTagProvider.BlockTagProvider {
UBlocks.CLOUD_PLANKS, UBlocks.CLOUD_PLANK_SLAB, UBlocks.CLOUD_PLANK_STAIRS, UBlocks.COMPACTED_CLOUD_PLANKS
);
getOrCreateTagBuilder(UTags.block("cloud_beds")).add(UBlocks.CLOUD_BED);
getOrCreateTagBuilder(UTags.block("cloud_slabs")).add(
getOrCreateTagBuilder(UTags.Blocks.CLOUD_BEDS).add(UBlocks.CLOUD_BED);
getOrCreateTagBuilder(UTags.Blocks.CLOUD_SLABS).add(
UBlocks.CLOUD_SLAB, UBlocks.SOGGY_CLOUD_SLAB, UBlocks.DENSE_CLOUD_SLAB, UBlocks.ETCHED_CLOUD_SLAB,
UBlocks.CLOUD_PLANK_SLAB, UBlocks.CLOUD_BRICK_SLAB
);
getOrCreateTagBuilder(UTags.block("cloud_stairs")).add(
getOrCreateTagBuilder(UTags.Blocks.CLOUD_STAIRS).add(
UBlocks.CLOUD_STAIRS, UBlocks.SOGGY_CLOUD_STAIRS, UBlocks.DENSE_CLOUD_STAIRS, UBlocks.ETCHED_CLOUD_STAIRS,
UBlocks.CLOUD_PLANK_STAIRS, UBlocks.CLOUD_BRICK_STAIRS
);
getOrCreateTagBuilder(UTags.block("clouds")).add(
getOrCreateTagBuilder(UTags.Blocks.CLOUD_BLOCKS).add(
UBlocks.CLOUD, UBlocks.CLOUD_PLANKS, UBlocks.CLOUD_BRICKS, UBlocks.DENSE_CLOUD,
UBlocks.ETCHED_CLOUD, UBlocks.CARVED_CLOUD,
UBlocks.ETCHED_CLOUD, UBlocks.CARVED_CLOUD, UBlocks.CLOUD_PILLAR,
UBlocks.COMPACTED_CLOUD, UBlocks.COMPACTED_CLOUD_PLANKS, UBlocks.COMPACTED_CLOUD_BRICKS,
UBlocks.UNSTABLE_CLOUD, UBlocks.SOGGY_CLOUD
UBlocks.UNSTABLE_CLOUD, UBlocks.SOGGY_CLOUD, UBlocks.SHAPING_BENCH
);
}
private void addChitinBlocksets() {
getOrCreateTagBuilder(UTags.Blocks.CHITIN_BLOCKS).add(
UBlocks.CHITIN, UBlocks.SURFACE_CHITIN,
UBlocks.CHISELLED_CHITIN, UBlocks.CHISELLED_CHITIN_HULL, UBlocks.CHISELLED_CHITIN_SLAB, UBlocks.CHISELLED_CHITIN_STAIRS,
UBlocks.CHITIN_SPIKES
);
getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE).add(
UBlocks.CHITIN_SPIKES,
UBlocks.CHISELLED_CHITIN, UBlocks.CHISELLED_CHITIN_HULL, UBlocks.CHISELLED_CHITIN_SLAB, UBlocks.CHISELLED_CHITIN_STAIRS
@ -195,8 +201,4 @@ public class UBlockTagProvider extends FabricTagProvider.BlockTagProvider {
getOrCreateTagBuilder(BlockTags.CEILING_HANGING_SIGNS).add(hanging);
getOrCreateTagBuilder(BlockTags.WALL_HANGING_SIGNS).add(wallHanging);
}
private void addHayBlocks() {
}
}

View file

@ -1,26 +1,57 @@
package com.minelittlepony.unicopia.datagen.providers;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.UConventionalTags;
import com.minelittlepony.unicopia.UTags;
import com.minelittlepony.unicopia.block.UBlocks;
import com.minelittlepony.unicopia.datagen.Datagen;
import com.minelittlepony.unicopia.item.BedsheetsItem;
import com.minelittlepony.unicopia.item.UItems;
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.item.Item;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.RegistryWrapper.WrapperLookup;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.registry.tag.TagBuilder;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
public UItemTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture, BlockTagProvider blockTagProvider) {
private final UBlockTagProvider blockTagProvider;
public UItemTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture, UBlockTagProvider blockTagProvider) {
super(output, registriesFuture, blockTagProvider);
this.blockTagProvider = blockTagProvider;
}
@Override
public void copy(TagKey<Block> blockTag, TagKey<Item> itemTag) {
TagBuilder blockTagBuilder = Objects.requireNonNull(blockTagProvider, "Pass Block tag provider via constructor to use copy").getTagBuilder(blockTag);
TagBuilder itemTagBuilder = getTagBuilder(itemTag);
blockTagBuilder.build().forEach(entry -> {
if (entry.canAdd(Registries.ITEM::containsId, tagId -> getTagBuilder(TagKey.of(RegistryKeys.ITEM, tagId)) != null)) {
itemTagBuilder.add(entry);
} else {
Datagen.LOGGER.warn("Cannot copy missing entry {} to item tag {}", entry, itemTag.id());
}
});
}
@Override
protected void configure(WrapperLookup arg) {
copyBlockTags();
exportConventionalTags();
getOrCreateTagBuilder(ItemTags.BOOKSHELF_BOOKS).add(UItems.SPELLBOOK);
getOrCreateTagBuilder(ItemTags.BEDS).add(UItems.CLOTH_BED, UItems.CLOUD_BED);
@ -36,6 +67,44 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
getOrCreateTagBuilder(UTags.POLEARMS).add(UItems.WOODEN_POLEARM, UItems.STONE_POLEARM, UItems.IRON_POLEARM, UItems.GOLDEN_POLEARM, UItems.DIAMOND_POLEARM, UItems.NETHERITE_POLEARM);
getOrCreateTagBuilder(ItemTags.TOOLS).addTag(UTags.HORSE_SHOES).addTag(UTags.POLEARMS);
getOrCreateTagBuilder(UTags.BASKETS).add(
UItems.ACACIA_BASKET, UItems.BAMBOO_BASKET, UItems.BIRCH_BASKET, UItems.CHERRY_BASKET, UItems.DARK_OAK_BASKET,
UItems.JUNGLE_BASKET, UItems.MANGROVE_BASKET, UItems.OAK_BASKET, UItems.PALM_BASKET, UItems.SPRUCE_BASKET
);
getOrCreateTagBuilder(UTags.BADGES).add(Race.REGISTRY.stream()
.map(race -> race.getId().withPath(p -> p + "_badge"))
.flatMap(id -> Registries.ITEM.getOrEmpty(id).stream())
.toArray(Item[]::new));
getOrCreateTagBuilder(UTags.BED_SHEETS).add(BedsheetsItem.ITEMS.values().stream().toArray(Item[]::new));
getOrCreateTagBuilder(UTags.APPLE_SEEDS).add(UItems.GREEN_APPLE_SEEDS, UItems.SWEET_APPLE_SEEDS, UItems.SOUR_APPLE_SEEDS);
getOrCreateTagBuilder(UTags.MAGIC_FEATHERS).add(UItems.PEGASUS_FEATHER, UItems.GRYPHON_FEATHER);
getOrCreateTagBuilder(UTags.FRESH_APPLES).add(Items.APPLE, UItems.GREEN_APPLE, UItems.SWEET_APPLE, UItems.SOUR_APPLE);
getOrCreateTagBuilder(UTags.CLOUD_JARS).add(UItems.RAIN_CLOUD_JAR, UItems.STORM_CLOUD_JAR);
getOrCreateTagBuilder(UTags.PIES).add(UItems.APPLE_PIE, UItems.APPLE_PIE_HOOF);
// technical tags
getOrCreateTagBuilder(ItemTags.VILLAGER_PLANTABLE_SEEDS).addTag(UTags.APPLE_SEEDS);
getOrCreateTagBuilder(UTags.CAN_CUT_PIE).forceAddTag(ConventionalItemTags.SHEARS).addOptionalTag(UConventionalTags.TOOL_KNIVES);
getOrCreateTagBuilder(UTags.COOLS_OFF_KIRINS).add(Items.MELON_SLICE, UItems.JUICE).forceAddTag(ConventionalItemTags.WATER_BUCKETS);
getOrCreateTagBuilder(UTags.FALLS_SLOWLY).add(Items.FEATHER, UItems.CLOUD_LUMP).forceAddTag(UTags.MAGIC_FEATHERS);
getOrCreateTagBuilder(UTags.IS_DELIVERED_AGGRESSIVELY).forceAddTag(ItemTags.ANVIL);
getOrCreateTagBuilder(UTags.SPOOKED_MOB_DROPS).add(Items.BRICK);
getOrCreateTagBuilder(UTags.FLOATS_ON_CLOUDS)
.forceAddTag(UTags.Items.CLOUD_BEDS)
.forceAddTag(UTags.Items.CLOUD_SLABS)
.forceAddTag(UTags.Items.CLOUD_STAIRS)
.forceAddTag(UTags.Items.CLOUD_BLOCKS)
.add(UItems.CLOUD_LUMP);
getOrCreateTagBuilder(UTags.HAS_NO_TRAITS).add(
Items.AIR, Items.SPAWNER, Items.STRUCTURE_VOID, Items.STRUCTURE_BLOCK,
Items.COMMAND_BLOCK, Items.CHAIN_COMMAND_BLOCK, Items.REPEATING_COMMAND_BLOCK,
Items.LIGHT, Items.JIGSAW, Items.BARRIER, Items.BEDROCK, Items.END_PORTAL_FRAME,
Items.DEBUG_STICK, Items.COMMAND_BLOCK_MINECART,
UItems.PLUNDER_VINE
).forceAddTag(UTags.BADGES);
exportFarmersDelightItems();
}
private void copyBlockTags() {
@ -55,5 +124,51 @@ public class UItemTagProvider extends FabricTagProvider.ItemTagProvider {
copy(BlockTags.TRAPDOORS, ItemTags.TRAPDOORS);
copy(BlockTags.WOODEN_TRAPDOORS, ItemTags.WOODEN_TRAPDOORS);
copy(BlockTags.SAPLINGS, ItemTags.SAPLINGS);
copy(UTags.Blocks.ZAP_LOGS, UTags.Items.ZAP_LOGS);
copy(UTags.Blocks.WAXED_ZAP_LOGS, UTags.Items.WAXED_ZAP_LOGS);
copy(UTags.Blocks.PALM_LOGS, UTags.Items.PALM_LOGS);
copy(UTags.Blocks.CLOUD_BEDS, UTags.Items.CLOUD_BEDS);
copy(UTags.Blocks.CLOUD_SLABS, UTags.Items.CLOUD_SLABS);
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);
}
private void exportConventionalTags() {
getOrCreateTagBuilder(UConventionalTags.ACORNS).add(UItems.ACORN);
getOrCreateTagBuilder(UConventionalTags.APPLES)
.add(Items.APPLE, Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE, UItems.ROTTEN_APPLE)
.forceAddTag(UTags.FRESH_APPLES)
.addOptionalTag(new Identifier("c", "pyrite_apples")) // no idea which mod add pyrite apples
;
getOrCreateTagBuilder(UConventionalTags.BANANAS).add(UItems.BANANA);
getOrCreateTagBuilder(UConventionalTags.COOKED_FISH).add(Items.COOKED_COD, Items.COOKED_SALMON);
getOrCreateTagBuilder(UConventionalTags.STICKS).add(Items.STICK);
getOrCreateTagBuilder(UConventionalTags.PINECONES).add(UItems.PINECONE);
getOrCreateTagBuilder(UConventionalTags.PINEAPPLES).add(UItems.PINEAPPLE);
getOrCreateTagBuilder(UConventionalTags.MANGOES).add(UItems.MANGO);
getOrCreateTagBuilder(UConventionalTags.MUSHROOMS).add(Items.RED_MUSHROOM, Items.BROWN_MUSHROOM);
getOrCreateTagBuilder(UConventionalTags.MUFFINS).add(UItems.MUFFIN);
getOrCreateTagBuilder(UConventionalTags.SEEDS).add(Items.BEETROOT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.TORCHFLOWER_SEEDS, Items.WHEAT_SEEDS)
.add(UItems.OAT_SEEDS)
.forceAddTag(UTags.APPLE_SEEDS);
getOrCreateTagBuilder(UConventionalTags.OEATMEALS).add(UItems.OATMEAL);
getOrCreateTagBuilder(UConventionalTags.GRAIN).add(Items.WHEAT, UItems.OATS);
getOrCreateTagBuilder(UConventionalTags.NUTS).addOptionalTag(UConventionalTags.CROPS_PEANUTS);
getOrCreateTagBuilder(UConventionalTags.FRUITS)
.forceAddTag(UConventionalTags.MANGOES)
.forceAddTag(UConventionalTags.PINEAPPLES)
.forceAddTag(UConventionalTags.APPLES)
.forceAddTag(UConventionalTags.BANANAS);
}
private void exportFarmersDelightItems() {
getOrCreateTagBuilder(UTags.COOLS_OFF_KIRINS)
.addOptional(new Identifier("farmersdelight:melon_popsicle"))
.addOptional(new Identifier("farmersdelight:melon_juice"));
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier("farmersdelight:cabbage_roll_ingredients"))).add(UItems.OATS, UItems.ROCK, UItems.WHEAT_WORMS);
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier("farmersdelight:comfort_foods"))).add(UItems.OATMEAL, UItems.ROCK_STEW, UItems.MUFFIN);
}
}

View file

@ -29,6 +29,7 @@ import com.minelittlepony.unicopia.server.world.UGameRules;
import com.minelittlepony.unicopia.server.world.WeatherConditions;
import com.minelittlepony.unicopia.util.*;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags;
import net.minecraft.block.*;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityPose;
@ -759,9 +760,9 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
entity.addVelocity(orientation.x, orientation.y, orientation.z);
boolean isEarthPonySmash = pony.getObservedSpecies().canUseEarth() && !isFlying();
int damage = TraceHelper.findBlocks(entity, speed + 4, 1, state -> (isEarthPonySmash && !state.isAir()) || state.isIn(UTags.GLASS_PANES)).stream()
int damage = TraceHelper.findBlocks(entity, speed + 4, 1, state -> (isEarthPonySmash && !state.isAir()) || state.isIn(ConventionalBlockTags.GLASS_PANES)).stream()
.flatMap(pos -> BlockPos.streamOutwards(pos, 2, 2, 2))
.filter(pos -> (isEarthPonySmash && !entity.getWorld().isAir(pos)) || entity.getWorld().getBlockState(pos).isIn(UTags.GLASS_PANES))
.filter(pos -> (isEarthPonySmash && !entity.getWorld().isAir(pos)) || entity.getWorld().getBlockState(pos).isIn(ConventionalBlockTags.GLASS_PANES))
.reduce(0, (u, pos) -> {
if (pony.canModifyAt(pos, ModificationType.PHYSICAL)) {
if (isEarthPonySmash) {

View file

@ -2,7 +2,7 @@ package com.minelittlepony.unicopia.item;
import java.util.List;
import com.minelittlepony.unicopia.UTags;
import com.minelittlepony.unicopia.UConventionalTags;
import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.advancement.UCriteria;
import com.minelittlepony.unicopia.entity.Living;
@ -103,7 +103,7 @@ public class ZapAppleItem extends Item implements ChameleonItem, MultiItem {
public List<ItemStack> getDefaultStacks() {
return Unicopia.SIDE.getPony().map(Pony::asWorld)
.stream()
.flatMap(world -> RegistryUtils.valuesForTag(world, UTags.APPLES))
.flatMap(world -> RegistryUtils.valuesForTag(world, UConventionalTags.APPLES))
.filter(a -> a != this).map(item -> {
ItemStack stack = new ItemStack(this);
stack.getOrCreateNbt().putString("appearance", Registries.ITEM.getId(item).toString());

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:acorn"
]
}

View file

@ -1,9 +0,0 @@
{
"replace": false,
"values": [
"minecraft:apple",
"minecraft:golden_apple",
{ "id": "#c:pyrite_apples", "required": false },
"#unicopia:fresh_apples"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:banana"
]
}

View file

@ -1,15 +0,0 @@
{
"replace": false,
"values": [
"minecraft:oak_boat",
"minecraft:bamboo_raft",
"minecraft:spruce_boat",
"minecraft:birch_boat",
"minecraft:jungle_boat",
"minecraft:acacia_boat",
"minecraft:dark_oak_boat",
"minecraft:mangrove_boat",
"minecraft:cherry_boat",
"unicopia:palm_boat"
]
}

View file

@ -1,8 +0,0 @@
{
"replace": false,
"values": [
"minecraft:cooked_cod",
"minecraft:cooked_salmon",
{ "id": "#c:cooked_fishes", "required": false }
]
}

View file

@ -1,9 +0,0 @@
{
"replace": false,
"values": [
"unicopia:mango",
"#c:pineapples",
"#c:apples",
"#c:bananas"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:oats"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:mango"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:muffin"
]
}

View file

@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"minecraft:red_mushroom",
"minecraft:brown_mushroom"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
{ "id": "#c:crops/peanuts", "require": false }
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:oatmeal"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:pineapple"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:pinecone"
]
}

View file

@ -1,7 +1,6 @@
{
"replace": false,
"values": [
"minecraft:rotten_flesh",
{ "id": "c:rotten_meat", "required": false }
"minecraft:rotten_flesh"
]
}

View file

@ -1,11 +0,0 @@
{
"replace": false,
"values": [
"minecraft:pumpkin_seeds",
"minecraft:melon_seeds",
"unicopia:oat_seeds",
"unicopia:green_apple_seeds",
"unicopia:sweet_apple_seeds",
"unicopia:sour_apple_seeds"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"minecraft:stick"
]
}

View file

@ -1,8 +0,0 @@
{
"replace": false,
"values": [
"unicopia:oats",
"unicopia:rock",
"unicopia:wheat_worms"
]
}

View file

@ -1,8 +0,0 @@
{
"replace": false,
"values": [
"unicopia:oatmeal",
"unicopia:rock_stew",
"unicopia:muffin"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"#c:acorns"
]
}

View file

@ -1,8 +0,0 @@
{
"replace": false,
"values": [
"unicopia:green_apple_seeds",
"unicopia:sweet_apple_seeds",
"unicopia:sour_apple_seeds"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"#c:apples"
]
}

View file

@ -1,13 +0,0 @@
{
"replace": false,
"values": [
"unicopia:earth_badge",
"unicopia:unicorn_badge",
"unicopia:pegasus_badge",
"unicopia:changeling_badge",
"unicopia:bat_badge",
"unicopia:kirin_badge",
"unicopia:alicorn_badge",
"unicopia:hippogriff_badge"
]
}

View file

@ -1,15 +0,0 @@
{
"replace": false,
"values": [
"unicopia:oak_basket",
"unicopia:spruce_basket",
"unicopia:birch_basket",
"unicopia:jungle_basket",
"unicopia:acacia_basket",
"unicopia:cherry_basket",
"unicopia:dark_oak_basket",
"unicopia:mangrove_basket",
"unicopia:bamboo_basket",
"unicopia:palm_basket"
]
}

View file

@ -1,31 +0,0 @@
{
"replace": false,
"values": [
"unicopia:light_gray_bed_sheets",
"unicopia:gray_bed_sheets",
"unicopia:black_bed_sheets",
"unicopia:brown_bed_sheets",
"unicopia:red_bed_sheets",
"unicopia:orange_bed_sheets",
"unicopia:yellow_bed_sheets",
"unicopia:lime_bed_sheets",
"unicopia:green_bed_sheets",
"unicopia:cyan_bed_sheets",
"unicopia:light_blue_bed_sheets",
"unicopia:blue_bed_sheets",
"unicopia:purple_bed_sheets",
"unicopia:magenta_bed_sheets",
"unicopia:pink_bed_sheets",
"unicopia:apple_bed_sheets",
"unicopia:barred_bed_sheets",
"unicopia:checkered_bed_sheets",
"unicopia:kelp_bed_sheets",
"unicopia:rainbow_bed_sheets",
"unicopia:rainbow_bpw_bed_sheets",
"unicopia:rainbow_bpy_bed_sheets",
"unicopia:rainbow_pbg_bed_sheets",
"unicopia:rainbow_pwr_bed_sheets"
]
}

View file

@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"#c:shears",
{ "id": "#c:tools/knives", "required": false }
]
}

View file

@ -1,12 +0,0 @@
{
"replace": false,
"values": [
"unicopia:chitin",
"unicopia:surface_chitin",
"unicopia:chiselled_chitin",
"unicopia:chiselled_chitin_slab",
"unicopia:chiselled_chitin_stairs",
"unicopia:chiselled_chitin_hull",
"unicopia:chitin_spikes"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"unicopia:cloud_bed"
]
}

View file

@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"unicopia:rain_cloud_jar",
"unicopia:storm_cloud_jar"
]
}

View file

@ -1,10 +0,0 @@
{
"replace": false,
"values": [
"unicopia:cloud_slab",
"unicopia:dense_cloud_slab",
"unicopia:cloud_brick_slab",
"unicopia:etched_cloud_slab",
"unicopia:cloud_plank_slab"
]
}

View file

@ -1,11 +0,0 @@
{
"replace": false,
"values": [
"unicopia:cloud_stairs",
"unicopia:dense_cloud_stairs",
"unicopia:cloud_brick_stairs",
"unicopia:etched_cloud_stairs",
"unicopia:cloud_plank_stairs",
"unicopia:cloud_chest"
]
}

View file

@ -1,13 +0,0 @@
{
"replace": false,
"values": [
"unicopia:cloud_lump",
"unicopia:cloud",
"unicopia:cloud_planks",
"unicopia:cloud_bricks",
"unicopia:dense_cloud",
"unicopia:etched_cloud",
"unicopia:unstable_cloud",
"unicopia:cloud_door"
]
}

View file

@ -1,9 +0,0 @@
{
"replace": false,
"values": [
"minecraft:melon_slice",
"unicopia:juice",
{ "id": "farmersdelight:melon_popsicle", "required": false },
{ "id": "farmersdelight:melon_juice", "required": false }
]
}

View file

@ -1,8 +0,0 @@
{
"replace": false,
"values": [
"minecraft:feather",
"#unicopia:magic_feathers",
"unicopia:cloud_lump"
]
}

View file

@ -1,12 +0,0 @@
{
"replace": false,
"values": [
"#unicopia:clouds",
"#unicopia:cloud_slabs",
"#unicopia:cloud_stairs",
"#unicopia:cloud_beds",
"unicopia:cloud_pillar",
"unicopia:carved_cloud",
"unicopia:shaping_bench"
]
}

View file

@ -1,9 +0,0 @@
{
"replace": false,
"values": [
"minecraft:apple",
"unicopia:green_apple",
"unicopia:sweet_apple",
"unicopia:sour_apple"
]
}

View file

@ -1,21 +0,0 @@
{
"replace": false,
"values": [
"minecraft:air",
"minecraft:spawner",
"minecraft:structure_void",
"minecraft:structure_block",
"minecraft:command_block",
"minecraft:chain_command_block",
"minecraft:repeating_command_block",
"minecraft:light",
"minecraft:jigsaw",
"minecraft:barrier",
"minecraft:bedrock",
"minecraft:end_portal_frame",
"minecraft:debug_stick",
"minecraft:command_block_minecart",
"unicopia:plunder_vine",
"#unicopia:badges"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"#minecraft:anvil"
]
}

View file

@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"unicopia:pegasus_feather",
"unicopia:gryphon_feather"
]
}

View file

@ -1,9 +0,0 @@
{
"replace": false,
"values": [
"unicopia:palm_log",
"unicopia:palm_wood",
"unicopia:stripped_palm_log",
"unicopia:stripped_palm_wood"
]
}

View file

@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"unicopia:apple_pie",
"unicopia:apple_pie_hoof"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"minecraft:brick"
]
}

View file

@ -1,9 +0,0 @@
{
"replace": false,
"values": [
"unicopia:zap_log",
"unicopia:zap_wood",
"unicopia:stripped_zap_log",
"unicopia:stripped_zap_wood"
]
}