Refactor convention tags (#3310)

This commit is contained in:
TelepathicGrunt 2024-04-16 13:01:57 -04:00 committed by GitHub
parent 18de49c6d7
commit 7f945d5bb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
412 changed files with 5198 additions and 1618 deletions

View file

@ -287,7 +287,7 @@ Fabric API is organized in different modules. Each module is located in a specif
- Module names should be named after the exposed functionality. - Module names should be named after the exposed functionality.
- Consider future developments when naming a module: they might later be expanded. - Consider future developments when naming a module: they might later be expanded.
- Module names should usually be suffixed by `-api`. - Module names should usually be suffixed by `-api`.
- Modules whose primary purpose is not interaction with their API do not need this suffix. For example, `fabric-transitive-access-wideners-v1` or `fabric-convention-tags-v1`. - Modules whose primary purpose is not interaction with their API do not need this suffix. For example, `fabric-transitive-access-wideners-v1` or `fabric-convention-tags-v2`.
- Event modules should have the `-events` suffix instead. - Event modules should have the `-events` suffix instead.
- Module names should always be suffixed by a major version (`-v1`, `-v2`, etc). - Module names should always be suffixed by a major version (`-v1`, `-v2`, etc).
- The major version starts at `v1` for new functionality, unless they replace a module with equivalent functionality, in which case the version is incremented. - The major version starts at `v1` for new functionality, unless they replace a module with equivalent functionality, in which case the version is incremented.

View file

@ -0,0 +1,6 @@
version = getSubprojectVersion(project)
moduleDependencies(project, [
'fabric-api-base',
'fabric-convention-tags-v2'
])

View file

@ -22,11 +22,9 @@ import net.minecraft.world.biome.Biome;
import net.fabricmc.fabric.impl.tag.convention.TagRegistration; import net.fabricmc.fabric.impl.tag.convention.TagRegistration;
/** /**
* See {@link net.minecraft.registry.tag.BiomeTags} for vanilla tags. * @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags}
* Note that addition to some vanilla tags implies having certain functionality,
* and as such certain biome tags exist to mirror vanilla tags, and should be preferred
* over vanilla unless its behavior is desired.
*/ */
@Deprecated
public final class ConventionalBiomeTags { public final class ConventionalBiomeTags {
private ConventionalBiomeTags() { private ConventionalBiomeTags() {
} }
@ -136,6 +134,6 @@ public final class ConventionalBiomeTags {
public static final TagKey<Biome> SHALLOW_OCEAN = register("shallow_ocean"); public static final TagKey<Biome> SHALLOW_OCEAN = register("shallow_ocean");
private static TagKey<Biome> register(String tagID) { private static TagKey<Biome> register(String tagID) {
return TagRegistration.BIOME_TAG_REGISTRATION.registerCommon(tagID); return TagRegistration.BIOME_TAG_REGISTRATION.registerC(tagID);
} }
} }

View file

@ -23,9 +23,9 @@ import net.minecraft.registry.tag.TagKey;
import net.fabricmc.fabric.impl.tag.convention.TagRegistration; import net.fabricmc.fabric.impl.tag.convention.TagRegistration;
/** /**
* See {@link net.minecraft.registry.tag.BlockTags} for vanilla tags. * @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags}
* Note that addition to some vanilla tags implies having certain functionality.
*/ */
@Deprecated
public final class ConventionalBlockTags { public final class ConventionalBlockTags {
private ConventionalBlockTags() { private ConventionalBlockTags() {
} }
@ -68,6 +68,6 @@ public final class ConventionalBlockTags {
public static final TagKey<Block> MOVEMENT_RESTRICTED = register("movement_restricted"); public static final TagKey<Block> MOVEMENT_RESTRICTED = register("movement_restricted");
private static TagKey<Block> register(String tagID) { private static TagKey<Block> register(String tagID) {
return TagRegistration.BLOCK_TAG_REGISTRATION.registerCommon(tagID); return TagRegistration.BLOCK_TAG_REGISTRATION.registerC(tagID);
} }
} }

View file

@ -21,6 +21,10 @@ import net.minecraft.registry.tag.TagKey;
import net.fabricmc.fabric.impl.tag.convention.TagRegistration; import net.fabricmc.fabric.impl.tag.convention.TagRegistration;
/**
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalEnchantmentTags}
*/
@Deprecated
public final class ConventionalEnchantmentTags { public final class ConventionalEnchantmentTags {
private ConventionalEnchantmentTags() { private ConventionalEnchantmentTags() {
} }
@ -49,6 +53,6 @@ public final class ConventionalEnchantmentTags {
public static final TagKey<Enchantment> ENTITY_DEFENSE_ENHANCEMENT = register("entity_defense_enhancement"); public static final TagKey<Enchantment> ENTITY_DEFENSE_ENHANCEMENT = register("entity_defense_enhancement");
private static TagKey<Enchantment> register(String tagID) { private static TagKey<Enchantment> register(String tagID) {
return TagRegistration.ENCHANTMENT_TAG_REGISTRATION.registerCommon(tagID); return TagRegistration.ENCHANTMENT_TAG_REGISTRATION.registerC(tagID);
} }
} }

View file

@ -22,9 +22,9 @@ import net.minecraft.registry.tag.TagKey;
import net.fabricmc.fabric.impl.tag.convention.TagRegistration; import net.fabricmc.fabric.impl.tag.convention.TagRegistration;
/** /**
* See {@link net.minecraft.registry.tag.EntityTypeTags} for vanilla tags. * @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalEntityTypeTags}
* Note that addition to some vanilla tags implies having certain functionality.
*/ */
@Deprecated
public final class ConventionalEntityTypeTags { public final class ConventionalEntityTypeTags {
private ConventionalEntityTypeTags() { private ConventionalEntityTypeTags() {
} }
@ -37,6 +37,6 @@ public final class ConventionalEntityTypeTags {
public static final TagKey<EntityType<?>> BOATS = register("boats"); public static final TagKey<EntityType<?>> BOATS = register("boats");
private static TagKey<EntityType<?>> register(String tagID) { private static TagKey<EntityType<?>> register(String tagID) {
return TagRegistration.ENTITY_TYPE_TAG_REGISTRATION.registerCommon(tagID); return TagRegistration.ENTITY_TYPE_TAG_REGISTRATION.registerC(tagID);
} }
} }

View file

@ -22,9 +22,9 @@ import net.minecraft.registry.tag.TagKey;
import net.fabricmc.fabric.impl.tag.convention.TagRegistration; import net.fabricmc.fabric.impl.tag.convention.TagRegistration;
/** /**
* See {@link net.minecraft.registry.tag.FluidTags} for vanilla tags. * @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalFluidTags}
* Note that addition to some vanilla tags implies having certain functionality.
*/ */
@Deprecated
public final class ConventionalFluidTags { public final class ConventionalFluidTags {
private ConventionalFluidTags() { private ConventionalFluidTags() {
} }
@ -35,6 +35,6 @@ public final class ConventionalFluidTags {
public static final TagKey<Fluid> HONEY = register("honey"); public static final TagKey<Fluid> HONEY = register("honey");
private static TagKey<Fluid> register(String tagID) { private static TagKey<Fluid> register(String tagID) {
return TagRegistration.FLUID_TAG_REGISTRATION.registerCommon(tagID); return TagRegistration.FLUID_TAG_REGISTRATION.registerC(tagID);
} }
} }

View file

@ -23,9 +23,9 @@ import net.minecraft.registry.tag.TagKey;
import net.fabricmc.fabric.impl.tag.convention.TagRegistration; import net.fabricmc.fabric.impl.tag.convention.TagRegistration;
/** /**
* See {@link net.minecraft.registry.tag.ItemTags} for vanilla tags. * @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags}
* Note that addition to some vanilla tags implies having certain functionality.
*/ */
@Deprecated
public final class ConventionalItemTags { public final class ConventionalItemTags {
private ConventionalItemTags() { private ConventionalItemTags() {
} }
@ -151,6 +151,6 @@ public final class ConventionalItemTags {
public static final TagKey<Item> SWORDS = register("swords"); public static final TagKey<Item> SWORDS = register("swords");
private static TagKey<Item> register(String tagID) { private static TagKey<Item> register(String tagID) {
return TagRegistration.ITEM_TAG_REGISTRATION.registerCommon(tagID); return TagRegistration.ITEM_TAG_REGISTRATION.registerC(tagID);
} }
} }

View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.api.tag.convention.v1;
import org.jetbrains.annotations.Nullable;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.tag.TagKey;
/**
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.TagUtil}
*/
@Deprecated
public final class TagUtil {
private TagUtil() {
}
/**
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.TagUtil#isIn}
*/
@Deprecated
public static <T> boolean isIn(TagKey<T> tagKey, T entry) {
return net.fabricmc.fabric.api.tag.convention.v2.TagUtil.isIn(null, tagKey, entry);
}
/**
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.TagUtil#isIn}
*/
@Deprecated
@SuppressWarnings("unchecked")
public static <T> boolean isIn(@Nullable DynamicRegistryManager registryManager, TagKey<T> tagKey, T entry) {
return net.fabricmc.fabric.api.tag.convention.v2.TagUtil.isIn(registryManager, tagKey, entry);
}
}

View file

@ -0,0 +1,280 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.tag.convention;
import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBiomeTags;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalEnchantmentTags;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalFluidTags;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalItemTags;
import net.fabricmc.fabric.api.tag.convention.v2.TagUtil;
import net.fabricmc.loader.api.FabricLoader;
public class ConventionLogWarnings implements ModInitializer {
private static final String LOG_LEGACY_WARNING_MODE = System.getProperty("fabric-tag-conventions-v1.legacyTagWarning", LOG_WARNING_MODES.DEV_SHORT.name());
private enum LOG_WARNING_MODES {
SILENCED,
DEV_SHORT,
DEV_VERBOSE
}
private static final Logger LOGGER = LoggerFactory.getLogger(ConventionLogWarnings.class);
/**
* Old `c` tags that we migrated to a new tag under a new convention.
* May also contain commonly used `c` tags that are not following convention.
*/
private static final Map<TagKey<?>, TagKey<?>> LEGACY_C_TAGS = Map.<TagKey<?>, TagKey<?>>ofEntries(
// Old v1 tags that are discouraged
createMapEntry(ConventionalBlockTags.MOVEMENT_RESTRICTED, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.RELOCATION_NOT_SUPPORTED),
createMapEntry(ConventionalBlockTags.QUARTZ_ORES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.QUARTZ_ORES),
createMapEntry(ConventionalBlockTags.WOODEN_BARRELS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.WOODEN_BARRELS),
createMapEntry(ConventionalBlockTags.SANDSTONE_BLOCKS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.SANDSTONE_BLOCKS),
createMapEntry(ConventionalBlockTags.SANDSTONE_STAIRS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.SANDSTONE_STAIRS),
createMapEntry(ConventionalBlockTags.SANDSTONE_SLABS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.SANDSTONE_SLABS),
createMapEntry(ConventionalBlockTags.RED_SANDSTONE_BLOCKS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.RED_SANDSTONE_BLOCKS),
createMapEntry(ConventionalBlockTags.RED_SANDSTONE_STAIRS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.RED_SANDSTONE_STAIRS),
createMapEntry(ConventionalBlockTags.RED_SANDSTONE_SLABS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.RED_SANDSTONE_SLABS),
createMapEntry(ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS),
createMapEntry(ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS),
createMapEntry(ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS),
createMapEntry(ConventionalItemTags.QUARTZ_ORES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.QUARTZ_ORES),
createMapEntry(ConventionalItemTags.WOODEN_BARRELS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.WOODEN_BARRELS),
createMapEntry(ConventionalItemTags.SANDSTONE_BLOCKS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SANDSTONE_BLOCKS),
createMapEntry(ConventionalItemTags.SANDSTONE_STAIRS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SANDSTONE_STAIRS),
createMapEntry(ConventionalItemTags.SANDSTONE_SLABS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SANDSTONE_SLABS),
createMapEntry(ConventionalItemTags.RED_SANDSTONE_BLOCKS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.RED_SANDSTONE_BLOCKS),
createMapEntry(ConventionalItemTags.RED_SANDSTONE_STAIRS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.RED_SANDSTONE_STAIRS),
createMapEntry(ConventionalItemTags.RED_SANDSTONE_SLABS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.RED_SANDSTONE_SLABS),
createMapEntry(ConventionalItemTags.UNCOLORED_SANDSTONE_BLOCKS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.UNCOLORED_SANDSTONE_BLOCKS),
createMapEntry(ConventionalItemTags.UNCOLORED_SANDSTONE_STAIRS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.UNCOLORED_SANDSTONE_STAIRS),
createMapEntry(ConventionalItemTags.BLACK_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.BLACK_DYES),
createMapEntry(ConventionalItemTags.BLUE_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.BLUE_DYES),
createMapEntry(ConventionalItemTags.BROWN_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.BROWN_DYES),
createMapEntry(ConventionalItemTags.GREEN_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.GREEN_DYES),
createMapEntry(ConventionalItemTags.RED_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.RED_DYES),
createMapEntry(ConventionalItemTags.WHITE_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.WHITE_DYES),
createMapEntry(ConventionalItemTags.YELLOW_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.YELLOW_DYES),
createMapEntry(ConventionalItemTags.LIGHT_BLUE_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.LIGHT_BLUE_DYES),
createMapEntry(ConventionalItemTags.LIGHT_GRAY_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.LIGHT_GRAY_DYES),
createMapEntry(ConventionalItemTags.LIME_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.LIME_DYES),
createMapEntry(ConventionalItemTags.MAGENTA_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.MAGENTA_DYES),
createMapEntry(ConventionalItemTags.ORANGE_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.ORANGE_DYES),
createMapEntry(ConventionalItemTags.PINK_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.PINK_DYES),
createMapEntry(ConventionalItemTags.CYAN_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.CYAN_DYES),
createMapEntry(ConventionalItemTags.GRAY_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.GRAY_DYES),
createMapEntry(ConventionalItemTags.PURPLE_DYES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.PURPLE_DYES),
createMapEntry(ConventionalItemTags.RAW_IRON_ORES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.IRON_RAW_MATERIALS),
createMapEntry(ConventionalItemTags.RAW_GOLD_ORES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.GOLD_RAW_MATERIALS),
createMapEntry(ConventionalItemTags.DIAMONDS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.DIAMOND_GEMS),
createMapEntry(ConventionalItemTags.LAPIS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.LAPIS_GEMS),
createMapEntry(ConventionalItemTags.EMERALDS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.EMERALD_GEMS),
createMapEntry(ConventionalItemTags.QUARTZ, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.QUARTZ_GEMS),
createMapEntry(ConventionalItemTags.SHEARS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SHEARS_TOOLS),
createMapEntry(ConventionalItemTags.SPEARS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SPEARS_TOOLS),
createMapEntry(ConventionalItemTags.BOWS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.BOWS_TOOLS),
createMapEntry(ConventionalItemTags.SHIELDS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SHIELDS_TOOLS),
createMapEntry(ConventionalFluidTags.WATER, net.fabricmc.fabric.api.tag.convention.v2.ConventionalFluidTags.WATER),
createMapEntry(ConventionalFluidTags.LAVA, net.fabricmc.fabric.api.tag.convention.v2.ConventionalFluidTags.LAVA),
createMapEntry(ConventionalFluidTags.MILK, net.fabricmc.fabric.api.tag.convention.v2.ConventionalFluidTags.MILK),
createMapEntry(ConventionalFluidTags.HONEY, net.fabricmc.fabric.api.tag.convention.v2.ConventionalFluidTags.HONEY),
createMapEntry(ConventionalEnchantmentTags.INCREASES_BLOCK_DROPS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalEnchantmentTags.INCREASE_BLOCK_DROPS),
createMapEntry(ConventionalEnchantmentTags.INCREASES_ENTITY_DROPS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalEnchantmentTags.INCREASE_ENTITY_DROPS),
createMapEntry(ConventionalEnchantmentTags.ENTITY_MOVEMENT_ENHANCEMENT, net.fabricmc.fabric.api.tag.convention.v2.ConventionalEnchantmentTags.ENTITY_SPEED_ENHANCEMENTS),
createMapEntry(ConventionalBiomeTags.IN_NETHER, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_NETHER),
createMapEntry(ConventionalBiomeTags.IN_THE_END, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_END),
createMapEntry(ConventionalBiomeTags.IN_OVERWORLD, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_OVERWORLD),
createMapEntry(ConventionalBiomeTags.CAVES, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_CAVE),
createMapEntry(ConventionalBiomeTags.CLIMATE_COLD, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_COLD),
createMapEntry(ConventionalBiomeTags.CLIMATE_TEMPERATE, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_TEMPERATE),
createMapEntry(ConventionalBiomeTags.CLIMATE_HOT, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_HOT),
createMapEntry(ConventionalBiomeTags.CLIMATE_WET, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_WET),
createMapEntry(ConventionalBiomeTags.CLIMATE_DRY, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_DRY),
createMapEntry(ConventionalBiomeTags.VEGETATION_DENSE, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_VEGETATION_DENSE),
createMapEntry(ConventionalBiomeTags.VEGETATION_SPARSE, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_VEGETATION_SPARSE),
createMapEntry(ConventionalBiomeTags.TREE_CONIFEROUS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_CONIFEROUS_TREE),
createMapEntry(ConventionalBiomeTags.TREE_DECIDUOUS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_DECIDUOUS_TREE),
createMapEntry(ConventionalBiomeTags.TREE_JUNGLE, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_JUNGLE_TREE),
createMapEntry(ConventionalBiomeTags.TREE_SAVANNA, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_SAVANNA_TREE),
createMapEntry(ConventionalBiomeTags.MOUNTAIN_PEAK, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_MOUNTAIN_PEAK),
createMapEntry(ConventionalBiomeTags.MOUNTAIN_SLOPE, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_MOUNTAIN_SLOPE),
createMapEntry(ConventionalBiomeTags.END_ISLANDS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_OUTER_END_ISLAND),
createMapEntry(ConventionalBiomeTags.NETHER_FORESTS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_NETHER_FOREST),
createMapEntry(ConventionalBiomeTags.FLOWER_FORESTS, net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags.IS_FLOWER_FOREST),
// Commonly used `c` tags that are using discouraged conventions. (Not plural or not folder form)
createMapEntry(RegistryKeys.BLOCK, "barrel", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.BARRELS),
createMapEntry(RegistryKeys.BLOCK, "chest", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.CHESTS),
createMapEntry(RegistryKeys.BLOCK, "wooden_chests", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.WOODEN_CHESTS),
createMapEntry(RegistryKeys.BLOCK, "glass", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.GLASS_BLOCKS),
createMapEntry(RegistryKeys.BLOCK, "glass_pane", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.GLASS_PANES),
createMapEntry(RegistryKeys.BLOCK, "immobile", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.RELOCATION_NOT_SUPPORTED),
createMapEntry(RegistryKeys.BLOCK, "stone", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.STONES),
createMapEntry(RegistryKeys.BLOCK, "cobblestone", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.COBBLESTONES),
createMapEntry(RegistryKeys.BLOCK, "workbench", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.VILLAGER_JOB_SITES),
createMapEntry(RegistryKeys.BLOCK, "workbenches", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.VILLAGER_JOB_SITES),
createMapEntry(RegistryKeys.BLOCK, "workstation", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.VILLAGER_JOB_SITES),
createMapEntry(RegistryKeys.BLOCK, "workstations", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.VILLAGER_JOB_SITES),
createMapEntry(RegistryKeys.BLOCK, "crafting_table", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.PLAYER_WORKSTATIONS_CRAFTING_TABLES),
createMapEntry(RegistryKeys.BLOCK, "crafting_tables", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.PLAYER_WORKSTATIONS_CRAFTING_TABLES),
createMapEntry(RegistryKeys.BLOCK, "furnace", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.PLAYER_WORKSTATIONS_FURNACES),
createMapEntry(RegistryKeys.BLOCK, "furnaces", net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags.PLAYER_WORKSTATIONS_FURNACES),
createMapEntry(RegistryKeys.ITEM, "axes", ItemTags.AXES),
createMapEntry(RegistryKeys.ITEM, "pickaxes", ItemTags.PICKAXES),
createMapEntry(RegistryKeys.ITEM, "hoes", ItemTags.HOES),
createMapEntry(RegistryKeys.ITEM, "shovels", ItemTags.SHOVELS),
createMapEntry(RegistryKeys.ITEM, "swords", ItemTags.SWORDS),
createMapEntry(RegistryKeys.ITEM, "wrenches", "tools/wrenches"),
createMapEntry(createTagKeyUnderFabric(RegistryKeys.ITEM, "axes"), ItemTags.AXES),
createMapEntry(createTagKeyUnderFabric(RegistryKeys.ITEM, "pickaxes"), ItemTags.PICKAXES),
createMapEntry(createTagKeyUnderFabric(RegistryKeys.ITEM, "hoes"), ItemTags.HOES),
createMapEntry(createTagKeyUnderFabric(RegistryKeys.ITEM, "shovels"), ItemTags.SHOVELS),
createMapEntry(createTagKeyUnderFabric(RegistryKeys.ITEM, "swords"), ItemTags.SWORDS),
createMapEntry(RegistryKeys.ITEM, "barrel", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.BARRELS),
createMapEntry(RegistryKeys.ITEM, "chest", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.CHESTS),
createMapEntry(RegistryKeys.ITEM, "glass", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.GLASS_BLOCKS),
createMapEntry(RegistryKeys.ITEM, "glass_pane", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.GLASS_PANES),
createMapEntry(RegistryKeys.ITEM, "glowstone_dusts", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.GLOWSTONE_DUSTS),
createMapEntry(RegistryKeys.ITEM, "redstone_dusts", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.REDSTONE_DUSTS),
createMapEntry(RegistryKeys.ITEM, "stone", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.STONES),
createMapEntry(RegistryKeys.ITEM, "string", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.STRINGS),
createMapEntry(RegistryKeys.ITEM, "sticks", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.WOODEN_RODS),
createMapEntry(RegistryKeys.ITEM, "wooden_rods", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.WOODEN_RODS),
createMapEntry(RegistryKeys.ITEM, "food", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.FOODS),
createMapEntry(RegistryKeys.ITEM, "fruit", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.FRUITS_FOODS),
createMapEntry(RegistryKeys.ITEM, "fruits", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.FRUITS_FOODS),
createMapEntry(RegistryKeys.ITEM, "vegetable", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.VEGETABLES_FOODS),
createMapEntry(RegistryKeys.ITEM, "vegetables", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.VEGETABLES_FOODS),
createMapEntry(RegistryKeys.ITEM, "berry", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.BERRIES_FOODS),
createMapEntry(RegistryKeys.ITEM, "berries", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.BERRIES_FOODS),
createMapEntry(RegistryKeys.ITEM, "bread", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.BREADS_FOODS),
createMapEntry(RegistryKeys.ITEM, "breads", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.BREADS_FOODS),
createMapEntry(RegistryKeys.ITEM, "cookie", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.COOKIES_FOODS),
createMapEntry(RegistryKeys.ITEM, "cookies", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.COOKIES_FOODS),
createMapEntry(RegistryKeys.ITEM, "raw_meat", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.RAW_MEATS_FOODS),
createMapEntry(RegistryKeys.ITEM, "raw_meats", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.RAW_MEATS_FOODS),
createMapEntry(RegistryKeys.ITEM, "raw_fish", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.RAW_FISHES_FOODS),
createMapEntry(RegistryKeys.ITEM, "raw_fishes", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.RAW_FISHES_FOODS),
createMapEntry(RegistryKeys.ITEM, "cooked_meat", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.COOKED_MEATS_FOODS),
createMapEntry(RegistryKeys.ITEM, "cooked_meats", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.COOKED_MEATS_FOODS),
createMapEntry(RegistryKeys.ITEM, "cooked_fish", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.COOKED_FISHES_FOODS),
createMapEntry(RegistryKeys.ITEM, "cooked_fishes", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.COOKED_FISHES_FOODS),
createMapEntry(RegistryKeys.ITEM, "soup", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SOUPS_FOODS),
createMapEntry(RegistryKeys.ITEM, "soups", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SOUPS_FOODS),
createMapEntry(RegistryKeys.ITEM, "stew", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SOUPS_FOODS),
createMapEntry(RegistryKeys.ITEM, "stews", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.SOUPS_FOODS),
createMapEntry(RegistryKeys.ITEM, "candy", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.CANDIES_FOODS),
createMapEntry(RegistryKeys.ITEM, "candies", net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags.CANDIES_FOODS)
);
@Override
public void onInitialize() {
if (FabricLoader.getInstance().isDevelopmentEnvironment() && !LOG_LEGACY_WARNING_MODE.equalsIgnoreCase(LOG_WARNING_MODES.SILENCED.name())) {
setupLegacyTagWarning();
}
}
private static void setupLegacyTagWarning() {
// Log tags that are still using legacy conventions under 'c' namespace
ServerLifecycleEvents.SERVER_STARTED.register(server -> {
List<TagKey<?>> legacyTags = new ObjectArrayList<>();
DynamicRegistryManager.Immutable dynamicRegistries = server.getRegistryManager();
// We only care about vanilla registries
dynamicRegistries.streamAllRegistries().forEach(registryEntry -> {
if (registryEntry.key().getValue().getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) {
registryEntry.value().streamTags().forEach(tagKey -> {
// Grab legacy tags we migrated or discourage
if (LEGACY_C_TAGS.containsKey(tagKey)) {
legacyTags.add(tagKey);
}
});
}
});
if (!legacyTags.isEmpty()) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("""
\n Dev warning - Legacy Tags detected. Please migrate your old tags to our new format that follows better conventions!
See classes under net.fabricmc.fabric.api.tag.convention.v2 package for all tags.
NOTE: Many tags have been moved around or renamed. Some new ones were added so please review the new tags.
And make sure you follow tag conventions for new tags! The convention is `c` with nouns generally being plural and adjectives being singular.
You can disable this message by this system property to your runs: `-Dfabric-tag-conventions-v1.legacyTagWarning=SILENCED`.
To see individual legacy tags found, set the system property to `-Dfabric-tag-conventions-v1.legacyTagWarning=DEV_VERBOSE` instead. Default is `DEV_SHORT`.
""");
// Print out all legacy tags when desired.
boolean isConfigSetToVerbose = LOG_LEGACY_WARNING_MODE.equalsIgnoreCase(LOG_WARNING_MODES.DEV_VERBOSE.name());
if (isConfigSetToVerbose) {
stringBuilder.append("\nLegacy tags and their replacement:");
for (TagKey<?> tagKey : legacyTags) {
stringBuilder.append("\n ").append(tagKey).append(" -> ").append(LEGACY_C_TAGS.get(tagKey));
}
}
LOGGER.warn(stringBuilder.toString());
}
});
}
private static <T> AbstractMap.SimpleEntry<TagKey<T>, TagKey<T>> createMapEntry(TagKey<T> tag1, TagKey<T> tag2) {
return new AbstractMap.SimpleEntry<>(tag1, tag2);
}
private static <T> AbstractMap.SimpleEntry<TagKey<T>, TagKey<T>> createMapEntry(RegistryKey<Registry<T>> registryKey, String tagId1, TagKey<T> tag2) {
return new AbstractMap.SimpleEntry<>(createTagKeyUnderC(registryKey, tagId1), tag2);
}
private static <T> AbstractMap.SimpleEntry<TagKey<T>, TagKey<T>> createMapEntry(RegistryKey<Registry<T>> registryKey, String tagId1, String tagId2) {
return new AbstractMap.SimpleEntry<>(createTagKeyUnderC(registryKey, tagId1), createTagKeyUnderC(registryKey, tagId2));
}
private static <T> TagKey<T> createTagKeyUnderC(RegistryKey<Registry<T>> registryKey, String tagId) {
return TagKey.of(registryKey, new Identifier(TagUtil.C_TAG_NAMESPACE, tagId));
}
private static <T> TagKey<T> createTagKeyUnderFabric(RegistryKey<Registry<T>> registryKey, String tagId) {
return TagKey.of(registryKey, new Identifier(TagUtil.FABRIC_TAG_NAMESPACE, tagId));
}
}

View file

@ -28,6 +28,7 @@ import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
@Deprecated
public class TagRegistration<T> { public class TagRegistration<T> {
public static final TagRegistration<Item> ITEM_TAG_REGISTRATION = new TagRegistration<>(RegistryKeys.ITEM); public static final TagRegistration<Item> ITEM_TAG_REGISTRATION = new TagRegistration<>(RegistryKeys.ITEM);
public static final TagRegistration<Block> BLOCK_TAG_REGISTRATION = new TagRegistration<>(RegistryKeys.BLOCK); public static final TagRegistration<Block> BLOCK_TAG_REGISTRATION = new TagRegistration<>(RegistryKeys.BLOCK);
@ -41,11 +42,13 @@ public class TagRegistration<T> {
registryKey = registry; registryKey = registry;
} }
@Deprecated
public TagKey<T> registerFabric(String tagId) { public TagKey<T> registerFabric(String tagId) {
return TagKey.of(registryKey, new Identifier("fabric", tagId)); return TagKey.of(registryKey, new Identifier("fabric", tagId));
} }
public TagKey<T> registerCommon(String tagId) { @Deprecated
public TagKey<T> registerC(String tagId) {
return TagKey.of(registryKey, new Identifier("c", tagId)); return TagKey.of(registryKey, new Identifier("c", tagId));
} }
} }

View file

@ -15,6 +15,11 @@
"authors": [ "authors": [
"FabricMC" "FabricMC"
], ],
"entrypoints": {
"main": [
"net.fabricmc.fabric.impl.tag.convention.ConventionLogWarnings"
]
},
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.6",
"minecraft": ">=1.18.2" "minecraft": ">=1.18.2"

View file

@ -3,7 +3,7 @@ version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base']) moduleDependencies(project, ['fabric-api-base'])
testDependencies(project, [ testDependencies(project, [
':fabric-convention-tags-v1', ':fabric-convention-tags-v2',
':fabric-lifecycle-events-v1', ':fabric-lifecycle-events-v1',
':fabric-resource-loader-v0', ':fabric-resource-loader-v0',
]) ])

View file

@ -35,7 +35,7 @@ import net.fabricmc.fabric.impl.tag.client.ClientTagsImpl;
* query it. * query it.
* *
* <p>Client Tags resolve that issue by lazily reading the tag json files within the mods on the side of the caller, * <p>Client Tags resolve that issue by lazily reading the tag json files within the mods on the side of the caller,
* directly, allowing for mods to query tags such as {@link net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags} * directly, allowing for mods to query tags such as {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags}
* even when connected to a vanilla server. * even when connected to a vanilla server.
*/ */
public final class ClientTags { public final class ClientTags {

View file

@ -31,9 +31,9 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.fabric.api.resource.ResourcePackActivationType; import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
import net.fabricmc.fabric.api.tag.client.v1.ClientTags; import net.fabricmc.fabric.api.tag.client.v1.ClientTags;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBiomeTags; import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags; import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalEnchantmentTags; import net.fabricmc.fabric.api.tag.convention.v2.ConventionalEnchantmentTags;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.ModContainer;
@ -51,7 +51,7 @@ public class ClientTagTest implements ClientModInitializer {
} }
ClientLifecycleEvents.CLIENT_STARTED.register(client -> { ClientLifecycleEvents.CLIENT_STARTED.register(client -> {
if (ClientTags.getOrCreateLocalTag(ConventionalEnchantmentTags.INCREASES_BLOCK_DROPS) == null) { if (ClientTags.getOrCreateLocalTag(ConventionalEnchantmentTags.INCREASE_BLOCK_DROPS) == null) {
throw new AssertionError("Expected to load c:fortune, but it was not found!"); throw new AssertionError("Expected to load c:fortune, but it was not found!");
} }
@ -63,7 +63,7 @@ public class ClientTagTest implements ClientModInitializer {
throw new AssertionError("Did not expect to find diamond block in c:ores, but it was found!"); throw new AssertionError("Did not expect to find diamond block in c:ores, but it was found!");
} }
if (!ClientTags.isInLocal(ConventionalBiomeTags.FOREST, BiomeKeys.FOREST)) { if (!ClientTags.isInLocal(ConventionalBiomeTags.IS_FOREST, BiomeKeys.FOREST)) {
throw new AssertionError("Expected to find forest in c:forest, but it was not found!"); throw new AssertionError("Expected to find forest in c:forest, but it was not found!");
} }

View file

@ -6,7 +6,7 @@
"environment": "*", "environment": "*",
"license": "Apache-2.0", "license": "Apache-2.0",
"depends": { "depends": {
"fabric-convention-tags-v1": "*" "fabric-convention-tags-v2": "*"
}, },
"entrypoints": { "entrypoints": {
"client": [ "client": [

View file

@ -1,265 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.tag.convention.datagen.generators;
import java.util.concurrent.CompletableFuture;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.BiomeTags;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
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.ConventionalBiomeTags;
public class BiomeTagGenerator extends FabricTagProvider<Biome> {
public BiomeTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
super(output, RegistryKeys.BIOME, completableFuture);
}
@Override
protected void configure(RegistryWrapper.WrapperLookup arg) {
generateDimensionTags();
generateCategoryTags();
generateOtherBiomeTypes();
generateClimateAndVegetationTags();
generateTerrainDescriptorTags();
}
private void generateDimensionTags() {
getOrCreateTagBuilder(ConventionalBiomeTags.IN_NETHER)
.addOptionalTag(BiomeTags.IS_NETHER)
.add(BiomeKeys.CRIMSON_FOREST)
.add(BiomeKeys.WARPED_FOREST)
.add(BiomeKeys.NETHER_WASTES)
.add(BiomeKeys.SOUL_SAND_VALLEY)
.add(BiomeKeys.BASALT_DELTAS);
getOrCreateTagBuilder(ConventionalBiomeTags.IN_THE_END)
.addOptionalTag(BiomeTags.IS_END)
.add(BiomeKeys.END_BARRENS)
.add(BiomeKeys.END_MIDLANDS)
.add(BiomeKeys.END_HIGHLANDS)
.add(BiomeKeys.THE_END)
.add(BiomeKeys.SMALL_END_ISLANDS);
// We avoid the vanilla group tags here as mods may add to them without actually spawning them in the overworld
getOrCreateTagBuilder(ConventionalBiomeTags.IN_OVERWORLD)
.addOptionalTag(BiomeTags.IS_OVERWORLD)
.add(BiomeKeys.RIVER).add(BiomeKeys.FROZEN_RIVER)
.add(BiomeKeys.COLD_OCEAN).add(BiomeKeys.DEEP_COLD_OCEAN)
.add(BiomeKeys.DEEP_FROZEN_OCEAN).add(BiomeKeys.DEEP_OCEAN)
.add(BiomeKeys.DEEP_LUKEWARM_OCEAN).add(BiomeKeys.WARM_OCEAN).add(BiomeKeys.LUKEWARM_OCEAN)
.add(BiomeKeys.FROZEN_OCEAN).add(BiomeKeys.OCEAN)
.add(BiomeKeys.BEACH).add(BiomeKeys.PLAINS)
.add(BiomeKeys.SUNFLOWER_PLAINS).add(BiomeKeys.SNOWY_PLAINS)
.add(BiomeKeys.ICE_SPIKES).add(BiomeKeys.DESERT)
.add(BiomeKeys.FOREST).add(BiomeKeys.FLOWER_FOREST)
.add(BiomeKeys.BIRCH_FOREST).add(BiomeKeys.DARK_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST).add(BiomeKeys.OLD_GROWTH_PINE_TAIGA)
.add(BiomeKeys.OLD_GROWTH_SPRUCE_TAIGA).add(BiomeKeys.TAIGA)
.add(BiomeKeys.SNOWY_TAIGA).add(BiomeKeys.SAVANNA)
.add(BiomeKeys.SAVANNA_PLATEAU).add(BiomeKeys.WINDSWEPT_HILLS)
.add(BiomeKeys.WINDSWEPT_GRAVELLY_HILLS).add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.WINDSWEPT_SAVANNA).add(BiomeKeys.JUNGLE).add(BiomeKeys.SPARSE_JUNGLE)
.add(BiomeKeys.BAMBOO_JUNGLE).add(BiomeKeys.BADLANDS).add(BiomeKeys.ERODED_BADLANDS)
.add(BiomeKeys.WOODED_BADLANDS).add(BiomeKeys.MEADOW).add(BiomeKeys.GROVE)
.add(BiomeKeys.SNOWY_SLOPES).add(BiomeKeys.FROZEN_PEAKS).add(BiomeKeys.JAGGED_PEAKS)
.add(BiomeKeys.STONY_PEAKS).add(BiomeKeys.MUSHROOM_FIELDS).add(BiomeKeys.DRIPSTONE_CAVES)
.add(BiomeKeys.LUSH_CAVES).add(BiomeKeys.SNOWY_BEACH).add(BiomeKeys.SWAMP).add(BiomeKeys.STONY_SHORE)
.add(BiomeKeys.DEEP_DARK).add(BiomeKeys.MANGROVE_SWAMP)
.add(BiomeKeys.CHERRY_GROVE);
}
private void generateCategoryTags() {
getOrCreateTagBuilder(ConventionalBiomeTags.TAIGA)
.addOptionalTag(BiomeTags.IS_TAIGA);
getOrCreateTagBuilder(ConventionalBiomeTags.EXTREME_HILLS)
.add(BiomeKeys.WINDSWEPT_GRAVELLY_HILLS)
.add(BiomeKeys.WINDSWEPT_HILLS);
getOrCreateTagBuilder(ConventionalBiomeTags.WINDSWEPT)
.add(BiomeKeys.WINDSWEPT_HILLS)
.add(BiomeKeys.WINDSWEPT_GRAVELLY_HILLS)
.add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.WINDSWEPT_SAVANNA);
getOrCreateTagBuilder(ConventionalBiomeTags.JUNGLE)
.addOptionalTag(BiomeTags.IS_JUNGLE);
getOrCreateTagBuilder(ConventionalBiomeTags.MESA)
.add(BiomeKeys.WOODED_BADLANDS)
.add(BiomeKeys.ERODED_BADLANDS)
.add(BiomeKeys.BADLANDS);
getOrCreateTagBuilder(ConventionalBiomeTags.PLAINS)
.add(BiomeKeys.SUNFLOWER_PLAINS)
.add(BiomeKeys.PLAINS);
getOrCreateTagBuilder(ConventionalBiomeTags.SAVANNA)
.addOptionalTag(BiomeTags.IS_SAVANNA)
.add(BiomeKeys.SAVANNA_PLATEAU)
.add(BiomeKeys.WINDSWEPT_SAVANNA)
.add(BiomeKeys.SAVANNA);
getOrCreateTagBuilder(ConventionalBiomeTags.ICY)
.add(BiomeKeys.FROZEN_PEAKS)
.add(BiomeKeys.ICE_SPIKES);
getOrCreateTagBuilder(ConventionalBiomeTags.AQUATIC_ICY)
.add(BiomeKeys.FROZEN_RIVER)
.add(BiomeKeys.DEEP_FROZEN_OCEAN)
.add(BiomeKeys.FROZEN_OCEAN);
getOrCreateTagBuilder(ConventionalBiomeTags.SNOWY)
.add(BiomeKeys.SNOWY_BEACH)
.add(BiomeKeys.SNOWY_PLAINS)
.add(BiomeKeys.SNOWY_SLOPES)
.add(BiomeKeys.SNOWY_TAIGA);
getOrCreateTagBuilder(ConventionalBiomeTags.BEACH)
.addOptionalTag(BiomeTags.IS_BEACH)
.add(BiomeKeys.STONY_SHORE);
getOrCreateTagBuilder(ConventionalBiomeTags.FOREST)
.addOptionalTag(BiomeTags.IS_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.BIRCH_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.OCEAN)
.addOptionalTag(ConventionalBiomeTags.DEEP_OCEAN)
.addOptionalTag(ConventionalBiomeTags.SHALLOW_OCEAN)
.addOptionalTag(BiomeTags.IS_OCEAN);
getOrCreateTagBuilder(ConventionalBiomeTags.DESERT)
.add(BiomeKeys.DESERT);
getOrCreateTagBuilder(ConventionalBiomeTags.RIVER)
.addOptionalTag(BiomeTags.IS_RIVER);
getOrCreateTagBuilder(ConventionalBiomeTags.SWAMP)
.add(BiomeKeys.MANGROVE_SWAMP)
.add(BiomeKeys.SWAMP);
getOrCreateTagBuilder(ConventionalBiomeTags.MUSHROOM)
.add(BiomeKeys.MUSHROOM_FIELDS);
getOrCreateTagBuilder(ConventionalBiomeTags.UNDERGROUND)
.addOptionalTag(ConventionalBiomeTags.CAVES);
getOrCreateTagBuilder(ConventionalBiomeTags.MOUNTAIN)
.addOptionalTag(BiomeTags.IS_MOUNTAIN);
}
private void generateOtherBiomeTypes() {
getOrCreateTagBuilder(ConventionalBiomeTags.BADLANDS)
.addOptionalTag(ConventionalBiomeTags.MESA)
.addOptionalTag(BiomeTags.IS_BADLANDS);
getOrCreateTagBuilder(ConventionalBiomeTags.CAVES)
.add(BiomeKeys.DEEP_DARK)
.add(BiomeKeys.DRIPSTONE_CAVES)
.add(BiomeKeys.LUSH_CAVES);
getOrCreateTagBuilder(ConventionalBiomeTags.VOID)
.add(BiomeKeys.THE_VOID);
getOrCreateTagBuilder(ConventionalBiomeTags.DEEP_OCEAN)
.add(BiomeKeys.DEEP_FROZEN_OCEAN)
.add(BiomeKeys.DEEP_LUKEWARM_OCEAN)
.add(BiomeKeys.DEEP_COLD_OCEAN)
.add(BiomeKeys.DEEP_OCEAN);
getOrCreateTagBuilder(ConventionalBiomeTags.SHALLOW_OCEAN)
.add(BiomeKeys.OCEAN)
.add(BiomeKeys.LUKEWARM_OCEAN)
.add(BiomeKeys.FROZEN_OCEAN)
.add(BiomeKeys.COLD_OCEAN)
.add(BiomeKeys.WARM_OCEAN);
}
private void generateClimateAndVegetationTags() {
getOrCreateTagBuilder(ConventionalBiomeTags.CLIMATE_COLD)
.add(BiomeKeys.SNOWY_PLAINS)
.add(BiomeKeys.GROVE)
.add(BiomeKeys.JAGGED_PEAKS)
.add(BiomeKeys.TAIGA).add(BiomeKeys.SNOWY_TAIGA)
.add(BiomeKeys.OLD_GROWTH_SPRUCE_TAIGA).add(BiomeKeys.OLD_GROWTH_PINE_TAIGA)
.addOptionalTag(ConventionalBiomeTags.ICY);
getOrCreateTagBuilder(ConventionalBiomeTags.CLIMATE_TEMPERATE)
.add(BiomeKeys.FOREST)
.add(BiomeKeys.SUNFLOWER_PLAINS)
.add(BiomeKeys.SWAMP)
.add(BiomeKeys.STONY_SHORE)
.add(BiomeKeys.DARK_FOREST)
.add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST)
.add(BiomeKeys.MEADOW)
.add(BiomeKeys.PLAINS);
getOrCreateTagBuilder(ConventionalBiomeTags.CLIMATE_HOT)
.addOptionalTag(ConventionalBiomeTags.JUNGLE)
.addOptionalTag(ConventionalBiomeTags.SAVANNA)
.addOptionalTag(ConventionalBiomeTags.DESERT)
.addOptionalTag(ConventionalBiomeTags.BADLANDS)
.add(BiomeKeys.STONY_PEAKS)
.addOptionalTag(ConventionalBiomeTags.MUSHROOM)
.addOptionalTag(ConventionalBiomeTags.IN_NETHER);
getOrCreateTagBuilder(ConventionalBiomeTags.CLIMATE_WET)
.addOptionalTag(ConventionalBiomeTags.AQUATIC)
.addOptionalTag(ConventionalBiomeTags.SWAMP)
.add(BiomeKeys.LUSH_CAVES)
.addOptionalTag(ConventionalBiomeTags.JUNGLE);
getOrCreateTagBuilder(ConventionalBiomeTags.CLIMATE_DRY)
.addOptionalTag(ConventionalBiomeTags.IN_NETHER)
.addOptionalTag(ConventionalBiomeTags.BADLANDS)
.addOptionalTag(ConventionalBiomeTags.DESERT)
.addOptionalTag(ConventionalBiomeTags.SAVANNA);
getOrCreateTagBuilder(ConventionalBiomeTags.VEGETATION_DENSE)
.addOptionalTag(ConventionalBiomeTags.JUNGLE)
.add(BiomeKeys.SUNFLOWER_PLAINS);
getOrCreateTagBuilder(ConventionalBiomeTags.VEGETATION_SPARSE)
.addOptionalTag(ConventionalBiomeTags.SAVANNA)
.addOptionalTag(ConventionalBiomeTags.DESERT)
.addOptionalTag(ConventionalBiomeTags.DEAD)
.add(BiomeKeys.LUSH_CAVES)
.addOptionalTag(ConventionalBiomeTags.WASTELAND);
getOrCreateTagBuilder(ConventionalBiomeTags.TREE_CONIFEROUS)
.add(BiomeKeys.GROVE)
.addOptionalTag(ConventionalBiomeTags.TAIGA);
getOrCreateTagBuilder(ConventionalBiomeTags.TREE_DECIDUOUS)
.add(BiomeKeys.FOREST)
.add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.FLOWER_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.DARK_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.TREE_JUNGLE)
.addOptionalTag(ConventionalBiomeTags.JUNGLE);
getOrCreateTagBuilder(ConventionalBiomeTags.TREE_SAVANNA)
.addOptionalTag(ConventionalBiomeTags.SAVANNA);
getOrCreateTagBuilder(ConventionalBiomeTags.FLORAL)
.add(BiomeKeys.SUNFLOWER_PLAINS)
.add(BiomeKeys.MEADOW)
.add(BiomeKeys.CHERRY_GROVE)
.addOptionalTag(ConventionalBiomeTags.FLOWER_FORESTS);
}
private void generateTerrainDescriptorTags() {
getOrCreateTagBuilder(ConventionalBiomeTags.MOUNTAIN_PEAK)
.add(BiomeKeys.FROZEN_PEAKS)
.add(BiomeKeys.JAGGED_PEAKS)
.add(BiomeKeys.STONY_PEAKS);
getOrCreateTagBuilder(ConventionalBiomeTags.MOUNTAIN_SLOPE)
.add(BiomeKeys.SNOWY_SLOPES);
getOrCreateTagBuilder(ConventionalBiomeTags.AQUATIC)
.addOptionalTag(ConventionalBiomeTags.OCEAN)
.addOptionalTag(ConventionalBiomeTags.RIVER);
getOrCreateTagBuilder(ConventionalBiomeTags.DEAD);
getOrCreateTagBuilder(ConventionalBiomeTags.WASTELAND);
getOrCreateTagBuilder(ConventionalBiomeTags.END_ISLANDS);
getOrCreateTagBuilder(ConventionalBiomeTags.NETHER_FORESTS)
.add(BiomeKeys.WARPED_FOREST)
.add(BiomeKeys.CRIMSON_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.SNOWY_PLAINS)
.add(BiomeKeys.SNOWY_PLAINS);
getOrCreateTagBuilder(ConventionalBiomeTags.STONY_SHORES)
.add(BiomeKeys.STONY_SHORE);
getOrCreateTagBuilder(ConventionalBiomeTags.FLOWER_FORESTS)
.add(BiomeKeys.FLOWER_FOREST);
}
}

View file

@ -1,197 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.tag.convention.datagen.generators;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.BlockTags;
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.ConventionalBlockTags;
public class BlockTagGenerator extends FabricTagProvider.BlockTagProvider {
static List<Block> VILLAGER_JOB_SITE_BLOCKS = List.of(
Blocks.BARREL,
Blocks.BLAST_FURNACE,
Blocks.BREWING_STAND,
Blocks.CARTOGRAPHY_TABLE,
Blocks.CAULDRON,
Blocks.LAVA_CAULDRON,
Blocks.WATER_CAULDRON,
Blocks.POWDER_SNOW_CAULDRON,
Blocks.COMPOSTER,
Blocks.FLETCHING_TABLE,
Blocks.GRINDSTONE,
Blocks.LECTERN,
Blocks.LOOM,
Blocks.SMITHING_TABLE,
Blocks.SMOKER,
Blocks.STONECUTTER
);
public BlockTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture);
}
@Override
protected void configure(RegistryWrapper.WrapperLookup registries) {
getOrCreateTagBuilder(ConventionalBlockTags.QUARTZ_ORES)
.add(Blocks.NETHER_QUARTZ_ORE);
getOrCreateTagBuilder(ConventionalBlockTags.ORES)
.addOptionalTag(BlockTags.REDSTONE_ORES)
.addOptionalTag(BlockTags.COPPER_ORES)
.addOptionalTag(BlockTags.GOLD_ORES)
.addOptionalTag(BlockTags.IRON_ORES)
.addOptionalTag(BlockTags.COAL_ORES)
.addOptionalTag(BlockTags.EMERALD_ORES)
.addOptionalTag(BlockTags.LAPIS_ORES)
.addOptionalTag(BlockTags.DIAMOND_ORES)
.addOptionalTag(ConventionalBlockTags.QUARTZ_ORES);
getOrCreateTagBuilder(ConventionalBlockTags.CHESTS)
.add(Blocks.CHEST)
.add(Blocks.ENDER_CHEST)
.add(Blocks.TRAPPED_CHEST);
getOrCreateTagBuilder(ConventionalBlockTags.BOOKSHELVES)
.add(Blocks.BOOKSHELF);
generateGlassTags();
generateShulkerTag();
getOrCreateTagBuilder(ConventionalBlockTags.WOODEN_BARRELS)
.add(Blocks.BARREL);
generateBuddingTags();
VILLAGER_JOB_SITE_BLOCKS.forEach(getOrCreateTagBuilder(ConventionalBlockTags.VILLAGER_JOB_SITES)::add);
generateSandstoneTags();
}
private void generateSandstoneTags() {
getOrCreateTagBuilder(ConventionalBlockTags.SANDSTONE_BLOCKS)
.addOptionalTag(ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS)
.addOptionalTag(ConventionalBlockTags.RED_SANDSTONE_BLOCKS);
getOrCreateTagBuilder(ConventionalBlockTags.SANDSTONE_SLABS)
.addOptionalTag(ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS)
.addOptionalTag(ConventionalBlockTags.RED_SANDSTONE_SLABS);
getOrCreateTagBuilder(ConventionalBlockTags.SANDSTONE_STAIRS)
.addOptionalTag(ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS)
.addOptionalTag(ConventionalBlockTags.RED_SANDSTONE_STAIRS);
getOrCreateTagBuilder(ConventionalBlockTags.RED_SANDSTONE_BLOCKS)
.add(Blocks.RED_SANDSTONE)
.add(Blocks.CHISELED_RED_SANDSTONE)
.add(Blocks.CUT_RED_SANDSTONE)
.add(Blocks.SMOOTH_RED_SANDSTONE);
getOrCreateTagBuilder(ConventionalBlockTags.RED_SANDSTONE_SLABS)
.add(Blocks.RED_SANDSTONE_SLAB)
.add(Blocks.CUT_RED_SANDSTONE_SLAB)
.add(Blocks.SMOOTH_RED_SANDSTONE_SLAB);
getOrCreateTagBuilder(ConventionalBlockTags.RED_SANDSTONE_STAIRS)
.add(Blocks.RED_SANDSTONE_STAIRS)
.add(Blocks.SMOOTH_RED_SANDSTONE_STAIRS);
getOrCreateTagBuilder(ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS)
.add(Blocks.SANDSTONE)
.add(Blocks.CHISELED_SANDSTONE)
.add(Blocks.CUT_SANDSTONE)
.add(Blocks.SMOOTH_SANDSTONE);
getOrCreateTagBuilder(ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS)
.add(Blocks.SANDSTONE_SLAB)
.add(Blocks.CUT_SANDSTONE_SLAB)
.add(Blocks.SMOOTH_SANDSTONE_SLAB);
getOrCreateTagBuilder(ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS)
.add(Blocks.SANDSTONE_STAIRS)
.add(Blocks.SMOOTH_SANDSTONE_STAIRS);
}
private void generateBuddingTags() {
getOrCreateTagBuilder(ConventionalBlockTags.BUDDING_BLOCKS)
.add(Blocks.BUDDING_AMETHYST);
getOrCreateTagBuilder(ConventionalBlockTags.BUDS)
.add(Blocks.SMALL_AMETHYST_BUD)
.add(Blocks.MEDIUM_AMETHYST_BUD)
.add(Blocks.LARGE_AMETHYST_BUD);
getOrCreateTagBuilder(ConventionalBlockTags.CLUSTERS)
.add(Blocks.AMETHYST_CLUSTER);
}
private void generateShulkerTag() {
getOrCreateTagBuilder(ConventionalBlockTags.SHULKER_BOXES)
.add(Blocks.SHULKER_BOX)
.add(Blocks.BLUE_SHULKER_BOX)
.add(Blocks.BROWN_SHULKER_BOX)
.add(Blocks.CYAN_SHULKER_BOX)
.add(Blocks.GRAY_SHULKER_BOX)
.add(Blocks.GREEN_SHULKER_BOX)
.add(Blocks.LIGHT_BLUE_SHULKER_BOX)
.add(Blocks.LIGHT_GRAY_SHULKER_BOX)
.add(Blocks.LIME_SHULKER_BOX)
.add(Blocks.MAGENTA_SHULKER_BOX)
.add(Blocks.ORANGE_SHULKER_BOX)
.add(Blocks.PINK_SHULKER_BOX)
.add(Blocks.PURPLE_SHULKER_BOX)
.add(Blocks.RED_SHULKER_BOX)
.add(Blocks.WHITE_SHULKER_BOX)
.add(Blocks.YELLOW_SHULKER_BOX)
.add(Blocks.BLACK_SHULKER_BOX);
}
private void generateGlassTags() {
getOrCreateTagBuilder(ConventionalBlockTags.GLASS_BLOCKS)
.add(Blocks.GLASS)
.add(Blocks.GRAY_STAINED_GLASS)
.add(Blocks.BLACK_STAINED_GLASS)
.add(Blocks.ORANGE_STAINED_GLASS)
.add(Blocks.BLUE_STAINED_GLASS)
.add(Blocks.BROWN_STAINED_GLASS)
.add(Blocks.CYAN_STAINED_GLASS)
.add(Blocks.GREEN_STAINED_GLASS)
.add(Blocks.LIGHT_BLUE_STAINED_GLASS)
.add(Blocks.LIGHT_GRAY_STAINED_GLASS)
.add(Blocks.LIME_STAINED_GLASS)
.add(Blocks.MAGENTA_STAINED_GLASS)
.add(Blocks.PINK_STAINED_GLASS)
.add(Blocks.PURPLE_STAINED_GLASS)
.add(Blocks.RED_STAINED_GLASS)
.add(Blocks.TINTED_GLASS)
.add(Blocks.WHITE_STAINED_GLASS)
.add(Blocks.YELLOW_STAINED_GLASS);
getOrCreateTagBuilder(ConventionalBlockTags.GLASS_PANES)
.add(Blocks.GLASS_PANE)
.add(Blocks.GRAY_STAINED_GLASS_PANE)
.add(Blocks.BLACK_STAINED_GLASS_PANE)
.add(Blocks.ORANGE_STAINED_GLASS_PANE)
.add(Blocks.BLUE_STAINED_GLASS_PANE)
.add(Blocks.BROWN_STAINED_GLASS_PANE)
.add(Blocks.CYAN_STAINED_GLASS_PANE)
.add(Blocks.GREEN_STAINED_GLASS_PANE)
.add(Blocks.LIGHT_BLUE_STAINED_GLASS_PANE)
.add(Blocks.LIGHT_GRAY_STAINED_GLASS_PANE)
.add(Blocks.LIME_STAINED_GLASS_PANE)
.add(Blocks.MAGENTA_STAINED_GLASS_PANE)
.add(Blocks.PINK_STAINED_GLASS_PANE)
.add(Blocks.PURPLE_STAINED_GLASS_PANE)
.add(Blocks.RED_STAINED_GLASS_PANE)
.add(Blocks.WHITE_STAINED_GLASS_PANE)
.add(Blocks.YELLOW_STAINED_GLASS_PANE);
}
}

View file

@ -1,306 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.tag.convention.datagen.generators;
import java.util.concurrent.CompletableFuture;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.Identifier;
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.ConventionalBlockTags;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalItemTags;
public class ItemTagGenerator extends FabricTagProvider.ItemTagProvider {
/** @deprecated Replaced with {@link ItemTags#PICKAXES}. */
@Deprecated
private static final Identifier FABRIC_PICKAXES = createFabricId("pickaxes");
/** @deprecated Replaced with {@link ItemTags#SHOVELS}. */
@Deprecated
private static final Identifier FABRIC_SHOVELS = createFabricId("shovels");
/** @deprecated Replaced with {@link ItemTags#HOES}. */
@Deprecated
private static final Identifier FABRIC_HOES = createFabricId("hoes");
/** @deprecated Replaced with {@link ItemTags#AXES}. */
@Deprecated
private static final Identifier FABRIC_AXES = createFabricId("axes");
/** @deprecated Replaced with {@link ConventionalItemTags#SHEARS}. */
@Deprecated
private static final Identifier FABRIC_SHEARS = createFabricId("shears");
/** @deprecated Replaced with {@link ItemTags#SWORDS}. */
@Deprecated
private static final Identifier FABRIC_SWORDS = createFabricId("swords");
public ItemTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture, FabricTagProvider.BlockTagProvider blockTags) {
super(output, completableFuture, blockTags);
}
@Override
protected void configure(RegistryWrapper.WrapperLookup arg) {
generateToolTags();
generateBucketTags();
generateOreAndRelatedTags();
generateConsumableTags();
generateDyeTags();
generateVillagerJobSites();
copyItemTags();
}
private void copyItemTags() {
copy(ConventionalBlockTags.BOOKSHELVES, ConventionalItemTags.BOOKSHELVES);
copy(ConventionalBlockTags.CHESTS, ConventionalItemTags.CHESTS);
copy(ConventionalBlockTags.GLASS_BLOCKS, ConventionalItemTags.GLASS_BLOCKS);
copy(ConventionalBlockTags.GLASS_PANES, ConventionalItemTags.GLASS_PANES);
copy(ConventionalBlockTags.SHULKER_BOXES, ConventionalItemTags.SHULKER_BOXES);
copy(ConventionalBlockTags.WOODEN_BARRELS, ConventionalItemTags.WOODEN_BARRELS);
copy(ConventionalBlockTags.BUDDING_BLOCKS, ConventionalItemTags.BUDDING_BLOCKS);
copy(ConventionalBlockTags.BUDS, ConventionalItemTags.BUDS);
copy(ConventionalBlockTags.CLUSTERS, ConventionalItemTags.CLUSTERS);
copy(ConventionalBlockTags.SANDSTONE_BLOCKS, ConventionalItemTags.SANDSTONE_BLOCKS);
copy(ConventionalBlockTags.SANDSTONE_SLABS, ConventionalItemTags.SANDSTONE_SLABS);
copy(ConventionalBlockTags.SANDSTONE_STAIRS, ConventionalItemTags.SANDSTONE_STAIRS);
copy(ConventionalBlockTags.RED_SANDSTONE_BLOCKS, ConventionalItemTags.RED_SANDSTONE_BLOCKS);
copy(ConventionalBlockTags.RED_SANDSTONE_SLABS, ConventionalItemTags.RED_SANDSTONE_SLABS);
copy(ConventionalBlockTags.RED_SANDSTONE_STAIRS, ConventionalItemTags.RED_SANDSTONE_STAIRS);
copy(ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS, ConventionalItemTags.UNCOLORED_SANDSTONE_BLOCKS);
copy(ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS, ConventionalItemTags.UNCOLORED_SANDSTONE_SLABS);
copy(ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS, ConventionalItemTags.UNCOLORED_SANDSTONE_STAIRS);
}
private void generateDyeTags() {
getOrCreateTagBuilder(ConventionalItemTags.DYES)
.addOptionalTag(ConventionalItemTags.BLACK_DYES)
.addOptionalTag(ConventionalItemTags.BLUE_DYES)
.addOptionalTag(ConventionalItemTags.BROWN_DYES)
.addOptionalTag(ConventionalItemTags.GREEN_DYES)
.addOptionalTag(ConventionalItemTags.RED_DYES)
.addOptionalTag(ConventionalItemTags.WHITE_DYES)
.addOptionalTag(ConventionalItemTags.YELLOW_DYES)
.addOptionalTag(ConventionalItemTags.LIGHT_GRAY_DYES)
.addOptionalTag(ConventionalItemTags.LIGHT_BLUE_DYES)
.addOptionalTag(ConventionalItemTags.LIME_DYES)
.addOptionalTag(ConventionalItemTags.MAGENTA_DYES)
.addOptionalTag(ConventionalItemTags.ORANGE_DYES)
.addOptionalTag(ConventionalItemTags.PINK_DYES)
.addOptionalTag(ConventionalItemTags.CYAN_DYES)
.addOptionalTag(ConventionalItemTags.GRAY_DYES)
.addOptionalTag(ConventionalItemTags.PURPLE_DYES);
getOrCreateTagBuilder(ConventionalItemTags.BLACK_DYES)
.add(Items.BLACK_DYE);
getOrCreateTagBuilder(ConventionalItemTags.BLUE_DYES)
.add(Items.BLUE_DYE);
getOrCreateTagBuilder(ConventionalItemTags.BROWN_DYES)
.add(Items.BROWN_DYE);
getOrCreateTagBuilder(ConventionalItemTags.GREEN_DYES)
.add(Items.GREEN_DYE);
getOrCreateTagBuilder(ConventionalItemTags.RED_DYES)
.add(Items.RED_DYE);
getOrCreateTagBuilder(ConventionalItemTags.WHITE_DYES)
.add(Items.WHITE_DYE);
getOrCreateTagBuilder(ConventionalItemTags.YELLOW_DYES)
.add(Items.YELLOW_DYE);
getOrCreateTagBuilder(ConventionalItemTags.LIGHT_BLUE_DYES)
.add(Items.LIGHT_BLUE_DYE);
getOrCreateTagBuilder(ConventionalItemTags.LIGHT_GRAY_DYES)
.add(Items.LIGHT_GRAY_DYE);
getOrCreateTagBuilder(ConventionalItemTags.LIME_DYES)
.add(Items.LIME_DYE);
getOrCreateTagBuilder(ConventionalItemTags.MAGENTA_DYES)
.add(Items.MAGENTA_DYE);
getOrCreateTagBuilder(ConventionalItemTags.ORANGE_DYES)
.add(Items.ORANGE_DYE);
getOrCreateTagBuilder(ConventionalItemTags.PINK_DYES)
.add(Items.PINK_DYE);
getOrCreateTagBuilder(ConventionalItemTags.CYAN_DYES)
.add(Items.CYAN_DYE);
getOrCreateTagBuilder(ConventionalItemTags.GRAY_DYES)
.add(Items.GRAY_DYE);
getOrCreateTagBuilder(ConventionalItemTags.PURPLE_DYES)
.add(Items.PURPLE_DYE);
}
private void generateConsumableTags() {
Registries.ITEM.forEach(item -> {
if (item.getDefaultStack().contains(DataComponentTypes.FOOD)) {
getOrCreateTagBuilder(ConventionalItemTags.FOODS).add(item);
}
});
getOrCreateTagBuilder(ConventionalItemTags.POTIONS)
.add(Items.LINGERING_POTION)
.add(Items.SPLASH_POTION)
.add(Items.POTION);
}
private void generateBucketTags() {
getOrCreateTagBuilder(ConventionalItemTags.EMPTY_BUCKETS)
.add(Items.BUCKET);
getOrCreateTagBuilder(ConventionalItemTags.LAVA_BUCKETS)
.add(Items.LAVA_BUCKET);
getOrCreateTagBuilder(ConventionalItemTags.ENTITY_WATER_BUCKETS)
.add(Items.AXOLOTL_BUCKET)
.add(Items.COD_BUCKET)
.add(Items.PUFFERFISH_BUCKET)
.add(Items.TROPICAL_FISH_BUCKET)
.add(Items.SALMON_BUCKET)
.add(Items.TADPOLE_BUCKET);
getOrCreateTagBuilder(ConventionalItemTags.WATER_BUCKETS)
.add(Items.WATER_BUCKET);
getOrCreateTagBuilder(ConventionalItemTags.MILK_BUCKETS)
.add(Items.MILK_BUCKET);
}
private void generateOreAndRelatedTags() {
// Categories
getOrCreateTagBuilder(ConventionalItemTags.DUSTS)
.add(Items.GLOWSTONE_DUST)
.add(Items.REDSTONE);
getOrCreateTagBuilder(ConventionalItemTags.GEMS)
.add(Items.DIAMOND, Items.EMERALD, Items.AMETHYST_SHARD, Items.LAPIS_LAZULI);
getOrCreateTagBuilder(ConventionalItemTags.INGOTS)
.add(Items.COPPER_INGOT, Items.GOLD_INGOT, Items.IRON_INGOT, Items.NETHERITE_INGOT);
getOrCreateTagBuilder(ConventionalItemTags.NUGGETS)
.add(Items.GOLD_NUGGET, Items.IRON_NUGGET);
copy(ConventionalBlockTags.ORES, ConventionalItemTags.ORES);
getOrCreateTagBuilder(ConventionalItemTags.RAW_ORES)
.addOptionalTag(ConventionalItemTags.RAW_IRON_ORES)
.addOptionalTag(ConventionalItemTags.RAW_COPPER_ORES)
.addOptionalTag(ConventionalItemTags.RAW_GOLD_ORES);
// Vanilla instances
getOrCreateTagBuilder(ConventionalItemTags.IRON_INGOTS)
.add(Items.IRON_INGOT);
getOrCreateTagBuilder(ConventionalItemTags.COPPER_INGOTS)
.add(Items.COPPER_INGOT);
getOrCreateTagBuilder(ConventionalItemTags.GOLD_INGOTS)
.add(Items.GOLD_INGOT);
getOrCreateTagBuilder(ConventionalItemTags.NETHERITE_INGOTS)
.add(Items.NETHERITE_INGOT);
getOrCreateTagBuilder(ConventionalItemTags.REDSTONE_DUSTS)
.add(Items.REDSTONE);
getOrCreateTagBuilder(ConventionalItemTags.QUARTZ_ORES)
.add(Items.NETHER_QUARTZ_ORE);
getOrCreateTagBuilder(ConventionalItemTags.QUARTZ)
.add(Items.QUARTZ);
getOrCreateTagBuilder(ConventionalItemTags.RAW_IRON_ORES)
.add(Items.RAW_IRON);
getOrCreateTagBuilder(ConventionalItemTags.RAW_COPPER_ORES)
.add(Items.RAW_COPPER);
getOrCreateTagBuilder(ConventionalItemTags.RAW_GOLD_ORES)
.add(Items.RAW_GOLD);
getOrCreateTagBuilder(ConventionalItemTags.RAW_IRON_BLOCKS)
.add(Items.RAW_IRON_BLOCK);
getOrCreateTagBuilder(ConventionalItemTags.RAW_COPPER_BLOCKS)
.add(Items.RAW_COPPER_BLOCK);
getOrCreateTagBuilder(ConventionalItemTags.RAW_GOLD_BLOCKS)
.add(Items.RAW_GOLD_BLOCK);
getOrCreateTagBuilder(ConventionalItemTags.COAL)
.addOptionalTag(ItemTags.COALS);
getOrCreateTagBuilder(ConventionalItemTags.EMERALDS)
.add(Items.EMERALD);
getOrCreateTagBuilder(ConventionalItemTags.LAPIS)
.add(Items.LAPIS_LAZULI);
getOrCreateTagBuilder(ConventionalItemTags.DIAMONDS)
.add(Items.DIAMOND);
}
private void generateToolTags() {
getOrCreateTagBuilder(ConventionalItemTags.AXES)
.addOptionalTag(FABRIC_AXES)
.add(Items.DIAMOND_AXE)
.add(Items.GOLDEN_AXE)
.add(Items.WOODEN_AXE)
.add(Items.STONE_AXE)
.add(Items.IRON_AXE)
.add(Items.NETHERITE_AXE);
getOrCreateTagBuilder(ConventionalItemTags.PICKAXES)
.addOptionalTag(FABRIC_PICKAXES)
.add(Items.DIAMOND_PICKAXE)
.add(Items.GOLDEN_PICKAXE)
.add(Items.WOODEN_PICKAXE)
.add(Items.STONE_PICKAXE)
.add(Items.IRON_PICKAXE)
.add(Items.NETHERITE_PICKAXE);
getOrCreateTagBuilder(ConventionalItemTags.HOES)
.addOptionalTag(FABRIC_HOES)
.add(Items.DIAMOND_HOE)
.add(Items.GOLDEN_HOE)
.add(Items.WOODEN_HOE)
.add(Items.STONE_HOE)
.add(Items.IRON_HOE)
.add(Items.NETHERITE_HOE);
getOrCreateTagBuilder(ConventionalItemTags.SWORDS)
.addOptionalTag(FABRIC_SWORDS)
.add(Items.DIAMOND_SWORD)
.add(Items.GOLDEN_SWORD)
.add(Items.WOODEN_SWORD)
.add(Items.STONE_SWORD)
.add(Items.IRON_SWORD)
.add(Items.NETHERITE_SWORD);
getOrCreateTagBuilder(ConventionalItemTags.SHOVELS)
.addOptionalTag(FABRIC_SHOVELS)
.add(Items.DIAMOND_SHOVEL)
.add(Items.GOLDEN_SHOVEL)
.add(Items.WOODEN_SHOVEL)
.add(Items.STONE_SHOVEL)
.add(Items.IRON_SHOVEL)
.add(Items.NETHERITE_SHOVEL);
getOrCreateTagBuilder(ItemTags.AXES)
.addOptionalTag(ConventionalItemTags.AXES)
.addOptionalTag(FABRIC_AXES);
getOrCreateTagBuilder(ItemTags.PICKAXES)
.addOptionalTag(ConventionalItemTags.PICKAXES)
.addOptionalTag(FABRIC_PICKAXES);
getOrCreateTagBuilder(ItemTags.HOES)
.addOptionalTag(ConventionalItemTags.HOES)
.addOptionalTag(FABRIC_HOES);
getOrCreateTagBuilder(ItemTags.SWORDS)
.addOptionalTag(ConventionalItemTags.SWORDS)
.addOptionalTag(FABRIC_SWORDS);
getOrCreateTagBuilder(ItemTags.SHOVELS)
.addOptionalTag(ConventionalItemTags.SHOVELS)
.addOptionalTag(FABRIC_SHOVELS);
getOrCreateTagBuilder(ConventionalItemTags.SHEARS)
.addOptionalTag(FABRIC_SHEARS)
.add(Items.SHEARS);
getOrCreateTagBuilder(ConventionalItemTags.SPEARS)
.add(Items.TRIDENT);
getOrCreateTagBuilder(ConventionalItemTags.BOWS)
.add(Items.CROSSBOW)
.add(Items.BOW);
getOrCreateTagBuilder(ConventionalItemTags.SHIELDS)
.add(Items.SHIELD);
}
private void generateVillagerJobSites() {
BlockTagGenerator.VILLAGER_JOB_SITE_BLOCKS.stream()
.map(ItemConvertible::asItem)
.distinct() // cauldron blocks have the same item
.forEach(getOrCreateTagBuilder(ConventionalItemTags.VILLAGER_JOB_SITES)::add);
}
private static Identifier createFabricId(String id) {
return new Identifier("fabric", id);
}
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:chest",
"minecraft:ender_chest",
"minecraft:trapped_chest"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:red_sandstone_slab",
"minecraft:cut_red_sandstone_slab",
"minecraft:smooth_red_sandstone_slab"
]
}

View file

@ -1,6 +0,0 @@
{
"values": [
"minecraft:red_sandstone_stairs",
"minecraft:smooth_red_sandstone_stairs"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:sandstone_slab",
"minecraft:cut_sandstone_slab",
"minecraft:smooth_sandstone_slab"
]
}

View file

@ -1,6 +0,0 @@
{
"values": [
"minecraft:sandstone_stairs",
"minecraft:smooth_sandstone_stairs"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:barrel"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:swift_sneak",
"minecraft:depth_strider",
"minecraft:soul_speed"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:black_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:blue_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:brown_dye"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:chest",
"minecraft:ender_chest",
"minecraft:trapped_chest"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:cyan_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:diamond"
]
}

View file

@ -1,6 +0,0 @@
{
"values": [
"minecraft:glowstone_dust",
"minecraft:redstone"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:emerald"
]
}

View file

@ -1,45 +0,0 @@
{
"values": [
"minecraft:apple",
"minecraft:mushroom_stew",
"minecraft:bread",
"minecraft:porkchop",
"minecraft:cooked_porkchop",
"minecraft:golden_apple",
"minecraft:enchanted_golden_apple",
"minecraft:cod",
"minecraft:salmon",
"minecraft:tropical_fish",
"minecraft:pufferfish",
"minecraft:cooked_cod",
"minecraft:cooked_salmon",
"minecraft:cookie",
"minecraft:melon_slice",
"minecraft:dried_kelp",
"minecraft:beef",
"minecraft:cooked_beef",
"minecraft:chicken",
"minecraft:cooked_chicken",
"minecraft:rotten_flesh",
"minecraft:spider_eye",
"minecraft:carrot",
"minecraft:potato",
"minecraft:baked_potato",
"minecraft:poisonous_potato",
"minecraft:golden_carrot",
"minecraft:pumpkin_pie",
"minecraft:rabbit",
"minecraft:cooked_rabbit",
"minecraft:rabbit_stew",
"minecraft:mutton",
"minecraft:cooked_mutton",
"minecraft:chorus_fruit",
"minecraft:beetroot",
"minecraft:beetroot_soup",
"minecraft:suspicious_stew",
"minecraft:sweet_berries",
"minecraft:glow_berries",
"minecraft:honey_bottle",
"minecraft:ominous_bottle"
]
}

View file

@ -1,8 +0,0 @@
{
"values": [
"minecraft:diamond",
"minecraft:emerald",
"minecraft:amethyst_shard",
"minecraft:lapis_lazuli"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:gray_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:green_dye"
]
}

View file

@ -1,14 +0,0 @@
{
"values": [
{
"id": "#fabric:hoes",
"required": false
},
"minecraft:diamond_hoe",
"minecraft:golden_hoe",
"minecraft:wooden_hoe",
"minecraft:stone_hoe",
"minecraft:iron_hoe",
"minecraft:netherite_hoe"
]
}

View file

@ -1,8 +0,0 @@
{
"values": [
"minecraft:copper_ingot",
"minecraft:gold_ingot",
"minecraft:iron_ingot",
"minecraft:netherite_ingot"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:lapis_lazuli"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:light_blue_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:light_gray_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:lime_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:magenta_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:orange_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:pink_dye"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:lingering_potion",
"minecraft:splash_potion",
"minecraft:potion"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:purple_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:quartz"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:nether_quartz_ore"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:raw_copper"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:raw_gold"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:raw_iron"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:red_dye"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:red_sandstone_slab",
"minecraft:cut_red_sandstone_slab",
"minecraft:smooth_red_sandstone_slab"
]
}

View file

@ -1,6 +0,0 @@
{
"values": [
"minecraft:red_sandstone_stairs",
"minecraft:smooth_red_sandstone_stairs"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:redstone"
]
}

View file

@ -1,12 +0,0 @@
{
"values": [
{
"id": "#c:uncolored_sandstone_blocks",
"required": false
},
{
"id": "#c:red_sandstone_blocks",
"required": false
}
]
}

View file

@ -1,12 +0,0 @@
{
"values": [
{
"id": "#c:uncolored_sandstone_slabs",
"required": false
},
{
"id": "#c:red_sandstone_slabs",
"required": false
}
]
}

View file

@ -1,9 +0,0 @@
{
"values": [
{
"id": "#fabric:shears",
"required": false
},
"minecraft:shears"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:shield"
]
}

View file

@ -1,14 +0,0 @@
{
"values": [
{
"id": "#fabric:shovels",
"required": false
},
"minecraft:diamond_shovel",
"minecraft:golden_shovel",
"minecraft:wooden_shovel",
"minecraft:stone_shovel",
"minecraft:iron_shovel",
"minecraft:netherite_shovel"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:trident"
]
}

View file

@ -1,14 +0,0 @@
{
"values": [
{
"id": "#fabric:swords",
"required": false
},
"minecraft:diamond_sword",
"minecraft:golden_sword",
"minecraft:wooden_sword",
"minecraft:stone_sword",
"minecraft:iron_sword",
"minecraft:netherite_sword"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:sandstone_slab",
"minecraft:cut_sandstone_slab",
"minecraft:smooth_sandstone_slab"
]
}

View file

@ -1,6 +0,0 @@
{
"values": [
"minecraft:sandstone_stairs",
"minecraft:smooth_sandstone_stairs"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:white_dye"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:barrel"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:yellow_dye"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:deep_dark",
"minecraft:dripstone_caves",
"minecraft:lush_caves"
]
}

View file

@ -1,15 +0,0 @@
{
"values": [
"minecraft:snowy_plains",
"minecraft:grove",
"minecraft:jagged_peaks",
"minecraft:taiga",
"minecraft:snowy_taiga",
"minecraft:old_growth_spruce_taiga",
"minecraft:old_growth_pine_taiga",
{
"id": "#c:icy",
"required": false
}
]
}

View file

@ -1,8 +0,0 @@
{
"values": [
"minecraft:deep_frozen_ocean",
"minecraft:deep_lukewarm_ocean",
"minecraft:deep_cold_ocean",
"minecraft:deep_ocean"
]
}

View file

@ -1,6 +0,0 @@
{
"values": [
"minecraft:windswept_gravelly_hills",
"minecraft:windswept_hills"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:flower_forest"
]
}

View file

@ -1,61 +0,0 @@
{
"values": [
{
"id": "#minecraft:is_overworld",
"required": false
},
"minecraft:river",
"minecraft:frozen_river",
"minecraft:cold_ocean",
"minecraft:deep_cold_ocean",
"minecraft:deep_frozen_ocean",
"minecraft:deep_ocean",
"minecraft:deep_lukewarm_ocean",
"minecraft:warm_ocean",
"minecraft:lukewarm_ocean",
"minecraft:frozen_ocean",
"minecraft:ocean",
"minecraft:beach",
"minecraft:plains",
"minecraft:sunflower_plains",
"minecraft:snowy_plains",
"minecraft:ice_spikes",
"minecraft:desert",
"minecraft:forest",
"minecraft:flower_forest",
"minecraft:birch_forest",
"minecraft:dark_forest",
"minecraft:old_growth_birch_forest",
"minecraft:old_growth_pine_taiga",
"minecraft:old_growth_spruce_taiga",
"minecraft:taiga",
"minecraft:snowy_taiga",
"minecraft:savanna",
"minecraft:savanna_plateau",
"minecraft:windswept_hills",
"minecraft:windswept_gravelly_hills",
"minecraft:windswept_forest",
"minecraft:windswept_savanna",
"minecraft:jungle",
"minecraft:sparse_jungle",
"minecraft:bamboo_jungle",
"minecraft:badlands",
"minecraft:eroded_badlands",
"minecraft:wooded_badlands",
"minecraft:meadow",
"minecraft:grove",
"minecraft:snowy_slopes",
"minecraft:frozen_peaks",
"minecraft:jagged_peaks",
"minecraft:stony_peaks",
"minecraft:mushroom_fields",
"minecraft:dripstone_caves",
"minecraft:lush_caves",
"minecraft:snowy_beach",
"minecraft:swamp",
"minecraft:stony_shore",
"minecraft:deep_dark",
"minecraft:mangrove_swamp",
"minecraft:cherry_grove"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:wooded_badlands",
"minecraft:eroded_badlands",
"minecraft:badlands"
]
}

View file

@ -1,7 +0,0 @@
{
"values": [
"minecraft:frozen_peaks",
"minecraft:jagged_peaks",
"minecraft:stony_peaks"
]
}

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:snowy_slopes"
]
}

View file

@ -1,6 +0,0 @@
{
"values": [
"minecraft:warped_forest",
"minecraft:crimson_forest"
]
}

View file

@ -1,6 +0,0 @@
{
"values": [
"minecraft:sunflower_plains",
"minecraft:plains"
]
}

View file

@ -1,11 +0,0 @@
{
"values": [
{
"id": "#minecraft:is_savanna",
"required": false
},
"minecraft:savanna_plateau",
"minecraft:windswept_savanna",
"minecraft:savanna"
]
}

View file

@ -1,8 +0,0 @@
{
"values": [
"minecraft:snowy_beach",
"minecraft:snowy_plains",
"minecraft:snowy_slopes",
"minecraft:snowy_taiga"
]
}

View file

@ -1,9 +0,0 @@
{
"values": [
{
"id": "#c:jungle",
"required": false
},
"minecraft:sunflower_plains"
]
}

View file

@ -1,12 +0,0 @@
{
"values": [
{
"id": "#c:pickaxes",
"required": false
},
{
"id": "#fabric:pickaxes",
"required": false
}
]
}

View file

@ -1,12 +0,0 @@
{
"values": [
{
"id": "#c:shovels",
"required": false
},
{
"id": "#fabric:shovels",
"required": false
}
]
}

View file

@ -1,12 +0,0 @@
{
"values": [
{
"id": "#c:swords",
"required": false
},
{
"id": "#fabric:swords",
"required": false
}
]
}

View file

@ -1,6 +1,9 @@
version = getSubprojectVersion(project) version = getSubprojectVersion(project)
moduleDependencies(project, ['fabric-api-base']) moduleDependencies(project, [
'fabric-api-base',
'fabric-lifecycle-events-v1'
])
testDependencies(project, [ testDependencies(project, [
':fabric-lifecycle-events-v1', ':fabric-lifecycle-events-v1',

View file

@ -24,6 +24,7 @@ import net.fabricmc.fabric.impl.tag.convention.datagen.generators.EnchantmentTag
import net.fabricmc.fabric.impl.tag.convention.datagen.generators.EntityTypeTagGenerator; import net.fabricmc.fabric.impl.tag.convention.datagen.generators.EntityTypeTagGenerator;
import net.fabricmc.fabric.impl.tag.convention.datagen.generators.FluidTagGenerator; import net.fabricmc.fabric.impl.tag.convention.datagen.generators.FluidTagGenerator;
import net.fabricmc.fabric.impl.tag.convention.datagen.generators.ItemTagGenerator; import net.fabricmc.fabric.impl.tag.convention.datagen.generators.ItemTagGenerator;
import net.fabricmc.fabric.impl.tag.convention.datagen.generators.StructureTagGenerator;
public class DatagenEntrypoint implements DataGeneratorEntrypoint { public class DatagenEntrypoint implements DataGeneratorEntrypoint {
@Override @Override
@ -35,6 +36,7 @@ public class DatagenEntrypoint implements DataGeneratorEntrypoint {
pack.addProvider(FluidTagGenerator::new); pack.addProvider(FluidTagGenerator::new);
pack.addProvider(EnchantmentTagGenerator::new); pack.addProvider(EnchantmentTagGenerator::new);
pack.addProvider(BiomeTagGenerator::new); pack.addProvider(BiomeTagGenerator::new);
pack.addProvider(StructureTagGenerator::new);
pack.addProvider(EntityTypeTagGenerator::new); pack.addProvider(EntityTypeTagGenerator::new);
} }
} }

View file

@ -0,0 +1,346 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.tag.convention.datagen.generators;
import java.util.concurrent.CompletableFuture;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.BiomeTags;
import net.minecraft.util.Identifier;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags;
import net.fabricmc.fabric.api.tag.convention.v2.TagUtil;
public final class BiomeTagGenerator extends FabricTagProvider<Biome> {
public BiomeTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
super(output, RegistryKeys.BIOME, completableFuture);
}
@Override
protected void configure(RegistryWrapper.WrapperLookup arg) {
generateDimensionTags();
generateCategoryTags();
generateOtherBiomeTypes();
generateClimateAndVegetationTags();
generateTerrainDescriptorTags();
generateBackwardsCompatTags();
}
private void generateDimensionTags() {
getOrCreateTagBuilder(ConventionalBiomeTags.IS_NETHER)
.addOptionalTag(BiomeTags.IS_NETHER);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_END)
.addOptionalTag(BiomeTags.IS_END);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_OVERWORLD)
.addOptionalTag(BiomeTags.IS_OVERWORLD);
}
private void generateCategoryTags() {
getOrCreateTagBuilder(ConventionalBiomeTags.IS_TAIGA)
.addOptionalTag(BiomeTags.IS_TAIGA);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_HILL)
.addOptionalTag(BiomeTags.IS_HILL);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_WINDSWEPT)
.add(BiomeKeys.WINDSWEPT_HILLS)
.add(BiomeKeys.WINDSWEPT_GRAVELLY_HILLS)
.add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.WINDSWEPT_SAVANNA);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_JUNGLE)
.addOptionalTag(BiomeTags.IS_JUNGLE);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_PLAINS)
.add(BiomeKeys.PLAINS)
.add(BiomeKeys.SUNFLOWER_PLAINS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_SAVANNA)
.addOptionalTag(BiomeTags.IS_SAVANNA);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_ICY)
.add(BiomeKeys.FROZEN_PEAKS)
.add(BiomeKeys.ICE_SPIKES);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_AQUATIC_ICY)
.add(BiomeKeys.FROZEN_RIVER)
.add(BiomeKeys.DEEP_FROZEN_OCEAN)
.add(BiomeKeys.FROZEN_OCEAN);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_SNOWY)
.add(BiomeKeys.SNOWY_BEACH)
.add(BiomeKeys.SNOWY_PLAINS)
.add(BiomeKeys.ICE_SPIKES)
.add(BiomeKeys.SNOWY_TAIGA)
.add(BiomeKeys.GROVE)
.add(BiomeKeys.SNOWY_SLOPES)
.add(BiomeKeys.JAGGED_PEAKS)
.add(BiomeKeys.FROZEN_PEAKS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_BEACH)
.addOptionalTag(BiomeTags.IS_BEACH);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_FOREST)
.addOptionalTag(BiomeTags.IS_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_BIRCH_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_OCEAN)
.addOptionalTag(BiomeTags.IS_OCEAN)
.addOptionalTag(ConventionalBiomeTags.IS_DEEP_OCEAN)
.addOptionalTag(ConventionalBiomeTags.IS_SHALLOW_OCEAN);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DESERT)
.add(BiomeKeys.DESERT);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_RIVER)
.addOptionalTag(BiomeTags.IS_RIVER);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_SWAMP)
.add(BiomeKeys.MANGROVE_SWAMP)
.add(BiomeKeys.SWAMP);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_MUSHROOM)
.add(BiomeKeys.MUSHROOM_FIELDS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_UNDERGROUND)
.addOptionalTag(ConventionalBiomeTags.IS_CAVE);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_MOUNTAIN)
.addOptionalTag(BiomeTags.IS_MOUNTAIN)
.addOptionalTag(ConventionalBiomeTags.IS_MOUNTAIN_PEAK)
.addOptionalTag(ConventionalBiomeTags.IS_MOUNTAIN_SLOPE);
}
private void generateOtherBiomeTypes() {
getOrCreateTagBuilder(ConventionalBiomeTags.IS_BADLANDS)
.addOptionalTag(BiomeTags.IS_BADLANDS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_CAVE)
.add(BiomeKeys.DEEP_DARK)
.add(BiomeKeys.DRIPSTONE_CAVES)
.add(BiomeKeys.LUSH_CAVES);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_VOID)
.add(BiomeKeys.THE_VOID);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DEEP_OCEAN)
.addOptionalTag(BiomeTags.IS_DEEP_OCEAN);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_SHALLOW_OCEAN)
.add(BiomeKeys.OCEAN)
.add(BiomeKeys.LUKEWARM_OCEAN)
.add(BiomeKeys.WARM_OCEAN)
.add(BiomeKeys.COLD_OCEAN)
.add(BiomeKeys.FROZEN_OCEAN);
getOrCreateTagBuilder(ConventionalBiomeTags.NO_DEFAULT_MONSTERS)
.add(BiomeKeys.MUSHROOM_FIELDS)
.add(BiomeKeys.DEEP_DARK);
getOrCreateTagBuilder(ConventionalBiomeTags.HIDDEN_FROM_LOCATOR_SELECTION); // Create tag file for visibility
}
private void generateClimateAndVegetationTags() {
getOrCreateTagBuilder(ConventionalBiomeTags.IS_COLD_OVERWORLD)
.add(BiomeKeys.TAIGA)
.add(BiomeKeys.OLD_GROWTH_PINE_TAIGA)
.add(BiomeKeys.SNOWY_PLAINS)
.add(BiomeKeys.ICE_SPIKES)
.add(BiomeKeys.GROVE)
.add(BiomeKeys.SNOWY_SLOPES)
.add(BiomeKeys.JAGGED_PEAKS)
.add(BiomeKeys.FROZEN_PEAKS)
.add(BiomeKeys.SNOWY_BEACH)
.add(BiomeKeys.SNOWY_TAIGA)
.add(BiomeKeys.FROZEN_RIVER)
.add(BiomeKeys.COLD_OCEAN)
.add(BiomeKeys.FROZEN_OCEAN)
.add(BiomeKeys.DEEP_COLD_OCEAN)
.add(BiomeKeys.DEEP_FROZEN_OCEAN);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_COLD_END)
.add(BiomeKeys.THE_END)
.add(BiomeKeys.SMALL_END_ISLANDS)
.add(BiomeKeys.END_MIDLANDS)
.add(BiomeKeys.END_HIGHLANDS)
.add(BiomeKeys.END_BARRENS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_COLD)
.addTag(ConventionalBiomeTags.IS_COLD_OVERWORLD);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_TEMPERATE_OVERWORLD)
.add(BiomeKeys.FOREST)
.add(BiomeKeys.SUNFLOWER_PLAINS)
.add(BiomeKeys.SWAMP)
.add(BiomeKeys.STONY_SHORE)
.add(BiomeKeys.DARK_FOREST)
.add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST)
.add(BiomeKeys.MEADOW)
.add(BiomeKeys.PLAINS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_TEMPERATE)
.addTag(ConventionalBiomeTags.IS_TEMPERATE_OVERWORLD);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_HOT_OVERWORLD)
.add(BiomeKeys.SWAMP)
.add(BiomeKeys.MANGROVE_SWAMP)
.add(BiomeKeys.JUNGLE)
.add(BiomeKeys.BAMBOO_JUNGLE)
.add(BiomeKeys.SPARSE_JUNGLE)
.add(BiomeKeys.DESERT)
.add(BiomeKeys.ERODED_BADLANDS)
.add(BiomeKeys.SAVANNA)
.add(BiomeKeys.SAVANNA_PLATEAU)
.add(BiomeKeys.WINDSWEPT_SAVANNA)
.add(BiomeKeys.STONY_PEAKS)
.add(BiomeKeys.WARM_OCEAN);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_HOT_NETHER)
.add(BiomeKeys.NETHER_WASTES)
.add(BiomeKeys.CRIMSON_FOREST)
.add(BiomeKeys.WARPED_FOREST)
.add(BiomeKeys.SOUL_SAND_VALLEY)
.add(BiomeKeys.BASALT_DELTAS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_HOT)
.addTag(ConventionalBiomeTags.IS_HOT_OVERWORLD)
.addTag(ConventionalBiomeTags.IS_HOT_NETHER);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_WET_OVERWORLD)
.add(BiomeKeys.SWAMP)
.add(BiomeKeys.MANGROVE_SWAMP)
.add(BiomeKeys.JUNGLE)
.add(BiomeKeys.BAMBOO_JUNGLE)
.add(BiomeKeys.SPARSE_JUNGLE)
.add(BiomeKeys.BEACH)
.add(BiomeKeys.LUSH_CAVES)
.add(BiomeKeys.DRIPSTONE_CAVES);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_WET)
.addTag(ConventionalBiomeTags.IS_WET_OVERWORLD);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DRY_OVERWORLD)
.add(BiomeKeys.DESERT)
.add(BiomeKeys.BADLANDS)
.add(BiomeKeys.WOODED_BADLANDS)
.add(BiomeKeys.ERODED_BADLANDS)
.add(BiomeKeys.SAVANNA)
.add(BiomeKeys.SAVANNA_PLATEAU)
.add(BiomeKeys.WINDSWEPT_SAVANNA);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DRY_NETHER)
.add(BiomeKeys.NETHER_WASTES)
.add(BiomeKeys.CRIMSON_FOREST)
.add(BiomeKeys.WARPED_FOREST)
.add(BiomeKeys.SOUL_SAND_VALLEY)
.add(BiomeKeys.BASALT_DELTAS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DRY_END)
.add(BiomeKeys.THE_END)
.add(BiomeKeys.SMALL_END_ISLANDS)
.add(BiomeKeys.END_MIDLANDS)
.add(BiomeKeys.END_HIGHLANDS)
.add(BiomeKeys.END_BARRENS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DRY)
.addTag(ConventionalBiomeTags.IS_DRY_OVERWORLD)
.addTag(ConventionalBiomeTags.IS_DRY_NETHER)
.addTag(ConventionalBiomeTags.IS_DRY_END);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_VEGETATION_DENSE_OVERWORLD)
.add(BiomeKeys.DARK_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_SPRUCE_TAIGA)
.add(BiomeKeys.JUNGLE);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_VEGETATION_DENSE)
.addOptionalTag(ConventionalBiomeTags.IS_VEGETATION_DENSE_OVERWORLD);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_VEGETATION_SPARSE_OVERWORLD)
.add(BiomeKeys.WOODED_BADLANDS)
.add(BiomeKeys.ERODED_BADLANDS)
.add(BiomeKeys.SAVANNA)
.add(BiomeKeys.SAVANNA_PLATEAU)
.add(BiomeKeys.WINDSWEPT_SAVANNA)
.add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.WINDSWEPT_HILLS)
.add(BiomeKeys.WINDSWEPT_GRAVELLY_HILLS)
.add(BiomeKeys.SNOWY_SLOPES)
.add(BiomeKeys.JAGGED_PEAKS)
.add(BiomeKeys.FROZEN_PEAKS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_VEGETATION_SPARSE)
.addOptionalTag(ConventionalBiomeTags.IS_VEGETATION_SPARSE_OVERWORLD);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_CONIFEROUS_TREE)
.addOptionalTag(ConventionalBiomeTags.IS_TAIGA)
.add(BiomeKeys.GROVE);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DECIDUOUS_TREE)
.add(BiomeKeys.FOREST)
.add(BiomeKeys.WINDSWEPT_FOREST)
.add(BiomeKeys.FLOWER_FOREST)
.add(BiomeKeys.BIRCH_FOREST)
.add(BiomeKeys.DARK_FOREST)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_JUNGLE_TREE)
.addOptionalTag(ConventionalBiomeTags.IS_JUNGLE);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_SAVANNA_TREE)
.addOptionalTag(ConventionalBiomeTags.IS_SAVANNA);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_FLORAL)
.add(BiomeKeys.SUNFLOWER_PLAINS)
.add(BiomeKeys.MEADOW)
.add(BiomeKeys.CHERRY_GROVE)
.addOptionalTag(ConventionalBiomeTags.IS_FLOWER_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_FLOWER_FOREST)
.add(BiomeKeys.FLOWER_FOREST)
.addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "flower_forests"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_OLD_GROWTH)
.add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST)
.add(BiomeKeys.OLD_GROWTH_PINE_TAIGA)
.add(BiomeKeys.OLD_GROWTH_SPRUCE_TAIGA);
}
private void generateTerrainDescriptorTags() {
getOrCreateTagBuilder(ConventionalBiomeTags.IS_MOUNTAIN_PEAK)
.add(BiomeKeys.FROZEN_PEAKS)
.add(BiomeKeys.JAGGED_PEAKS)
.add(BiomeKeys.STONY_PEAKS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_MOUNTAIN_SLOPE)
.add(BiomeKeys.SNOWY_SLOPES)
.add(BiomeKeys.MEADOW)
.add(BiomeKeys.GROVE)
.add(BiomeKeys.CHERRY_GROVE);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_AQUATIC)
.addOptionalTag(ConventionalBiomeTags.IS_OCEAN)
.addOptionalTag(ConventionalBiomeTags.IS_RIVER);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DEAD);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_WASTELAND);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_OUTER_END_ISLAND)
.add(BiomeKeys.END_HIGHLANDS)
.add(BiomeKeys.END_MIDLANDS)
.add(BiomeKeys.END_BARRENS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_NETHER_FOREST)
.add(BiomeKeys.WARPED_FOREST)
.add(BiomeKeys.CRIMSON_FOREST);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_SNOWY_PLAINS)
.add(BiomeKeys.SNOWY_PLAINS);
getOrCreateTagBuilder(ConventionalBiomeTags.IS_STONY_SHORES)
.add(BiomeKeys.STONY_SHORE);
}
private void generateBackwardsCompatTags() {
// Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability.
// TODO: Remove backwards compat tag entries in 1.22
getOrCreateTagBuilder(ConventionalBiomeTags.IS_NETHER).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "in_nether"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_END).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "in_the_end"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_OVERWORLD).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "in_the_overworld"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_CAVE).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "caves"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_COLD_OVERWORLD).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "climate_cold"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_TEMPERATE_OVERWORLD).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "climate_temperate"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_HOT_OVERWORLD).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "climate_hot"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_WET_OVERWORLD).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "climate_wet"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DRY_OVERWORLD).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "climate_dry"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_VEGETATION_DENSE_OVERWORLD).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "vegetation_dense"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_VEGETATION_SPARSE_OVERWORLD).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "vegetation_sparse"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_CONIFEROUS_TREE).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "tree_coniferous"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_DECIDUOUS_TREE).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "tree_deciduous"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_JUNGLE_TREE).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "tree_jungle"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_SAVANNA_TREE).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "tree_savanna"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_MOUNTAIN_PEAK).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "mountain_peak"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_MOUNTAIN_SLOPE).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "mountain_slope"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_OUTER_END_ISLAND).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "end_islands"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_NETHER_FOREST).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "nether_forests"));
getOrCreateTagBuilder(ConventionalBiomeTags.IS_FLOWER_FOREST).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "flower_forests"));
}
}

View file

@ -0,0 +1,466 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.tag.convention.datagen.generators;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags;
import net.fabricmc.fabric.api.tag.convention.v2.TagUtil;
public final class BlockTagGenerator extends FabricTagProvider.BlockTagProvider {
static List<Block> VILLAGER_JOB_SITE_BLOCKS = List.of(
Blocks.BARREL,
Blocks.BLAST_FURNACE,
Blocks.BREWING_STAND,
Blocks.CARTOGRAPHY_TABLE,
Blocks.CAULDRON,
Blocks.LAVA_CAULDRON,
Blocks.WATER_CAULDRON,
Blocks.POWDER_SNOW_CAULDRON,
Blocks.COMPOSTER,
Blocks.FLETCHING_TABLE,
Blocks.GRINDSTONE,
Blocks.LECTERN,
Blocks.LOOM,
Blocks.SMITHING_TABLE,
Blocks.SMOKER,
Blocks.STONECUTTER
);
public BlockTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture);
}
@Override
protected void configure(RegistryWrapper.WrapperLookup registries) {
getOrCreateTagBuilder(ConventionalBlockTags.STONES)
.add(Blocks.STONE)
.add(Blocks.ANDESITE)
.add(Blocks.DIORITE)
.add(Blocks.GRANITE)
.add(Blocks.TUFF)
.add(Blocks.DEEPSLATE);
getOrCreateTagBuilder(ConventionalBlockTags.COBBLESTONES)
.add(Blocks.COBBLESTONE)
.add(Blocks.MOSSY_COBBLESTONE)
.add(Blocks.COBBLED_DEEPSLATE)
.add(Blocks.INFESTED_COBBLESTONE);
getOrCreateTagBuilder(ConventionalBlockTags.QUARTZ_ORES)
.add(Blocks.NETHER_QUARTZ_ORE);
getOrCreateTagBuilder(ConventionalBlockTags.NETHERITE_SCRAP_ORES)
.add(Blocks.ANCIENT_DEBRIS);
getOrCreateTagBuilder(ConventionalBlockTags.ORES)
.addOptionalTag(BlockTags.COAL_ORES)
.addOptionalTag(BlockTags.COPPER_ORES)
.addOptionalTag(BlockTags.DIAMOND_ORES)
.addOptionalTag(BlockTags.EMERALD_ORES)
.addOptionalTag(BlockTags.GOLD_ORES)
.addOptionalTag(BlockTags.IRON_ORES)
.addOptionalTag(BlockTags.LAPIS_ORES)
.addOptionalTag(ConventionalBlockTags.NETHERITE_SCRAP_ORES)
.addOptionalTag(BlockTags.REDSTONE_ORES)
.addOptionalTag(ConventionalBlockTags.QUARTZ_ORES);
getOrCreateTagBuilder(ConventionalBlockTags.WOODEN_CHESTS)
.add(Blocks.CHEST)
.add(Blocks.TRAPPED_CHEST);
getOrCreateTagBuilder(ConventionalBlockTags.CHESTS)
.addTag(ConventionalBlockTags.WOODEN_CHESTS)
.add(Blocks.ENDER_CHEST);
getOrCreateTagBuilder(ConventionalBlockTags.BOOKSHELVES)
.add(Blocks.BOOKSHELF);
generateGlassTags();
generateShulkerTag();
getOrCreateTagBuilder(ConventionalBlockTags.WOODEN_BARRELS)
.add(Blocks.BARREL);
getOrCreateTagBuilder(ConventionalBlockTags.BARRELS)
.addTag(ConventionalBlockTags.WOODEN_BARRELS);
generateBuddingTags();
generateSandstoneTags();
generateDyedTags();
generateStorageTags();
generateHeadTags();
generateMiscTags();
generateBackwardsCompatTags();
}
private void generateMiscTags() {
getOrCreateTagBuilder(ConventionalBlockTags.PLAYER_WORKSTATIONS_CRAFTING_TABLES)
.add(Blocks.CRAFTING_TABLE);
getOrCreateTagBuilder(ConventionalBlockTags.PLAYER_WORKSTATIONS_FURNACES)
.add(Blocks.FURNACE);
VILLAGER_JOB_SITE_BLOCKS.forEach(getOrCreateTagBuilder(ConventionalBlockTags.VILLAGER_JOB_SITES)::add);
getOrCreateTagBuilder(ConventionalBlockTags.RELOCATION_NOT_SUPPORTED); // Generate tag so others can see it exists through JSON.
getOrCreateTagBuilder(ConventionalBlockTags.ROPES); // Generate tag so others can see it exists through JSON.
getOrCreateTagBuilder(ConventionalBlockTags.CHAINS)
.add(Blocks.CHAIN);
getOrCreateTagBuilder(ConventionalBlockTags.HIDDEN_FROM_RECIPE_VIEWERS); // Generate tag so others can see it exists through JSON.
}
private void generateSandstoneTags() {
getOrCreateTagBuilder(ConventionalBlockTags.SANDSTONE_BLOCKS)
.addOptionalTag(ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS)
.addOptionalTag(ConventionalBlockTags.RED_SANDSTONE_BLOCKS);
getOrCreateTagBuilder(ConventionalBlockTags.SANDSTONE_SLABS)
.addOptionalTag(ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS)
.addOptionalTag(ConventionalBlockTags.RED_SANDSTONE_SLABS);
getOrCreateTagBuilder(ConventionalBlockTags.SANDSTONE_STAIRS)
.addOptionalTag(ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS)
.addOptionalTag(ConventionalBlockTags.RED_SANDSTONE_STAIRS);
getOrCreateTagBuilder(ConventionalBlockTags.RED_SANDSTONE_BLOCKS)
.add(Blocks.RED_SANDSTONE)
.add(Blocks.CUT_RED_SANDSTONE)
.add(Blocks.SMOOTH_RED_SANDSTONE)
.add(Blocks.CHISELED_RED_SANDSTONE);
getOrCreateTagBuilder(ConventionalBlockTags.RED_SANDSTONE_SLABS)
.add(Blocks.RED_SANDSTONE_SLAB)
.add(Blocks.CUT_RED_SANDSTONE_SLAB)
.add(Blocks.SMOOTH_RED_SANDSTONE_SLAB);
getOrCreateTagBuilder(ConventionalBlockTags.RED_SANDSTONE_STAIRS)
.add(Blocks.RED_SANDSTONE_STAIRS)
.add(Blocks.SMOOTH_RED_SANDSTONE_STAIRS);
getOrCreateTagBuilder(ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS)
.add(Blocks.SANDSTONE)
.add(Blocks.CUT_SANDSTONE)
.add(Blocks.SMOOTH_SANDSTONE)
.add(Blocks.CHISELED_SANDSTONE);
getOrCreateTagBuilder(ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS)
.add(Blocks.SANDSTONE_SLAB)
.add(Blocks.CUT_SANDSTONE_SLAB)
.add(Blocks.SMOOTH_SANDSTONE_SLAB);
getOrCreateTagBuilder(ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS)
.add(Blocks.SANDSTONE_STAIRS)
.add(Blocks.SMOOTH_SANDSTONE_STAIRS);
}
private void generateBuddingTags() {
getOrCreateTagBuilder(ConventionalBlockTags.BUDDING_BLOCKS)
.add(Blocks.BUDDING_AMETHYST);
getOrCreateTagBuilder(ConventionalBlockTags.BUDS)
.add(Blocks.SMALL_AMETHYST_BUD)
.add(Blocks.MEDIUM_AMETHYST_BUD)
.add(Blocks.LARGE_AMETHYST_BUD);
getOrCreateTagBuilder(ConventionalBlockTags.CLUSTERS)
.add(Blocks.AMETHYST_CLUSTER);
}
private void generateShulkerTag() {
getOrCreateTagBuilder(ConventionalBlockTags.SHULKER_BOXES)
.add(Blocks.SHULKER_BOX)
.add(Blocks.WHITE_SHULKER_BOX)
.add(Blocks.ORANGE_SHULKER_BOX)
.add(Blocks.MAGENTA_SHULKER_BOX)
.add(Blocks.LIGHT_BLUE_SHULKER_BOX)
.add(Blocks.YELLOW_SHULKER_BOX)
.add(Blocks.LIME_SHULKER_BOX)
.add(Blocks.PINK_SHULKER_BOX)
.add(Blocks.GRAY_SHULKER_BOX)
.add(Blocks.LIGHT_GRAY_SHULKER_BOX)
.add(Blocks.CYAN_SHULKER_BOX)
.add(Blocks.PURPLE_SHULKER_BOX)
.add(Blocks.BLUE_SHULKER_BOX)
.add(Blocks.BROWN_SHULKER_BOX)
.add(Blocks.GREEN_SHULKER_BOX)
.add(Blocks.RED_SHULKER_BOX)
.add(Blocks.BLACK_SHULKER_BOX);
}
private void generateGlassTags() {
getOrCreateTagBuilder(ConventionalBlockTags.GLASS_BLOCKS)
.add(Blocks.GLASS)
.add(Blocks.TINTED_GLASS)
.add(Blocks.WHITE_STAINED_GLASS)
.add(Blocks.ORANGE_STAINED_GLASS)
.add(Blocks.MAGENTA_STAINED_GLASS)
.add(Blocks.LIGHT_BLUE_STAINED_GLASS)
.add(Blocks.YELLOW_STAINED_GLASS)
.add(Blocks.LIME_STAINED_GLASS)
.add(Blocks.PINK_STAINED_GLASS)
.add(Blocks.GRAY_STAINED_GLASS)
.add(Blocks.LIGHT_GRAY_STAINED_GLASS)
.add(Blocks.CYAN_STAINED_GLASS)
.add(Blocks.PURPLE_STAINED_GLASS)
.add(Blocks.BLUE_STAINED_GLASS)
.add(Blocks.BROWN_STAINED_GLASS)
.add(Blocks.GREEN_STAINED_GLASS)
.add(Blocks.BLACK_STAINED_GLASS)
.add(Blocks.RED_STAINED_GLASS);
getOrCreateTagBuilder(ConventionalBlockTags.GLASS_PANES)
.add(Blocks.GLASS_PANE)
.add(Blocks.WHITE_STAINED_GLASS_PANE)
.add(Blocks.ORANGE_STAINED_GLASS_PANE)
.add(Blocks.MAGENTA_STAINED_GLASS_PANE)
.add(Blocks.LIGHT_BLUE_STAINED_GLASS_PANE)
.add(Blocks.YELLOW_STAINED_GLASS_PANE)
.add(Blocks.LIME_STAINED_GLASS_PANE)
.add(Blocks.PINK_STAINED_GLASS_PANE)
.add(Blocks.GRAY_STAINED_GLASS_PANE)
.add(Blocks.LIGHT_GRAY_STAINED_GLASS_PANE)
.add(Blocks.CYAN_STAINED_GLASS_PANE)
.add(Blocks.PURPLE_STAINED_GLASS_PANE)
.add(Blocks.BLUE_STAINED_GLASS_PANE)
.add(Blocks.BROWN_STAINED_GLASS_PANE)
.add(Blocks.GREEN_STAINED_GLASS_PANE)
.add(Blocks.BLACK_STAINED_GLASS_PANE)
.add(Blocks.RED_STAINED_GLASS_PANE);
}
private void generateDyedTags() {
getOrCreateTagBuilder(ConventionalBlockTags.BLACK_DYED)
.add(Blocks.BLACK_BANNER).add(Blocks.BLACK_BED).add(Blocks.BLACK_CANDLE).add(Blocks.BLACK_CARPET)
.add(Blocks.BLACK_CONCRETE).add(Blocks.BLACK_CONCRETE_POWDER).add(Blocks.BLACK_GLAZED_TERRACOTTA)
.add(Blocks.BLACK_SHULKER_BOX).add(Blocks.BLACK_STAINED_GLASS).add(Blocks.BLACK_STAINED_GLASS_PANE)
.add(Blocks.BLACK_TERRACOTTA).add(Blocks.BLACK_WALL_BANNER).add(Blocks.BLACK_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.BLUE_DYED)
.add(Blocks.BLUE_BANNER).add(Blocks.BLUE_BED).add(Blocks.BLUE_CANDLE).add(Blocks.BLUE_CARPET)
.add(Blocks.BLUE_CONCRETE).add(Blocks.BLUE_CONCRETE_POWDER).add(Blocks.BLUE_GLAZED_TERRACOTTA)
.add(Blocks.BLUE_SHULKER_BOX).add(Blocks.BLUE_STAINED_GLASS).add(Blocks.BLUE_STAINED_GLASS_PANE)
.add(Blocks.BLUE_TERRACOTTA).add(Blocks.BLUE_WALL_BANNER).add(Blocks.BLUE_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.BROWN_DYED)
.add(Blocks.BROWN_BANNER).add(Blocks.BROWN_BED).add(Blocks.BROWN_CANDLE).add(Blocks.BROWN_CARPET)
.add(Blocks.BROWN_CONCRETE).add(Blocks.BROWN_CONCRETE_POWDER).add(Blocks.BROWN_GLAZED_TERRACOTTA)
.add(Blocks.BROWN_SHULKER_BOX).add(Blocks.BROWN_STAINED_GLASS).add(Blocks.BROWN_STAINED_GLASS_PANE)
.add(Blocks.BROWN_TERRACOTTA).add(Blocks.BROWN_WALL_BANNER).add(Blocks.BROWN_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.CYAN_DYED)
.add(Blocks.CYAN_BANNER).add(Blocks.CYAN_BED).add(Blocks.CYAN_CANDLE).add(Blocks.CYAN_CARPET)
.add(Blocks.CYAN_CONCRETE).add(Blocks.CYAN_CONCRETE_POWDER).add(Blocks.CYAN_GLAZED_TERRACOTTA)
.add(Blocks.CYAN_SHULKER_BOX).add(Blocks.CYAN_STAINED_GLASS).add(Blocks.CYAN_STAINED_GLASS_PANE)
.add(Blocks.CYAN_TERRACOTTA).add(Blocks.CYAN_WALL_BANNER).add(Blocks.CYAN_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.GRAY_DYED)
.add(Blocks.GRAY_BANNER).add(Blocks.GRAY_BED).add(Blocks.GRAY_CANDLE).add(Blocks.GRAY_CARPET)
.add(Blocks.GRAY_CONCRETE).add(Blocks.GRAY_CONCRETE_POWDER).add(Blocks.GRAY_GLAZED_TERRACOTTA)
.add(Blocks.GRAY_SHULKER_BOX).add(Blocks.GRAY_STAINED_GLASS).add(Blocks.GRAY_STAINED_GLASS_PANE)
.add(Blocks.GRAY_TERRACOTTA).add(Blocks.GRAY_WALL_BANNER).add(Blocks.GRAY_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.GREEN_DYED)
.add(Blocks.GREEN_BANNER).add(Blocks.GREEN_BED).add(Blocks.GREEN_CANDLE).add(Blocks.GREEN_CARPET)
.add(Blocks.GREEN_CONCRETE).add(Blocks.GREEN_CONCRETE_POWDER).add(Blocks.GREEN_GLAZED_TERRACOTTA)
.add(Blocks.GREEN_SHULKER_BOX).add(Blocks.GREEN_STAINED_GLASS).add(Blocks.GREEN_STAINED_GLASS_PANE)
.add(Blocks.GREEN_TERRACOTTA).add(Blocks.GREEN_WALL_BANNER).add(Blocks.GREEN_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.LIGHT_BLUE_DYED)
.add(Blocks.LIGHT_BLUE_BANNER).add(Blocks.LIGHT_BLUE_BED).add(Blocks.LIGHT_BLUE_CANDLE).add(Blocks.LIGHT_BLUE_CARPET)
.add(Blocks.LIGHT_BLUE_CONCRETE).add(Blocks.LIGHT_BLUE_CONCRETE_POWDER).add(Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA)
.add(Blocks.LIGHT_BLUE_SHULKER_BOX).add(Blocks.LIGHT_BLUE_STAINED_GLASS).add(Blocks.LIGHT_BLUE_STAINED_GLASS_PANE)
.add(Blocks.LIGHT_BLUE_TERRACOTTA).add(Blocks.LIGHT_BLUE_WALL_BANNER).add(Blocks.LIGHT_BLUE_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.LIGHT_GRAY_DYED)
.add(Blocks.LIGHT_GRAY_BANNER).add(Blocks.LIGHT_GRAY_BED).add(Blocks.LIGHT_GRAY_CANDLE).add(Blocks.LIGHT_GRAY_CARPET)
.add(Blocks.LIGHT_GRAY_CONCRETE).add(Blocks.LIGHT_GRAY_CONCRETE_POWDER).add(Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA)
.add(Blocks.LIGHT_GRAY_SHULKER_BOX).add(Blocks.LIGHT_GRAY_STAINED_GLASS).add(Blocks.LIGHT_GRAY_STAINED_GLASS_PANE)
.add(Blocks.LIGHT_GRAY_TERRACOTTA).add(Blocks.LIGHT_GRAY_WALL_BANNER).add(Blocks.LIGHT_GRAY_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.LIME_DYED)
.add(Blocks.LIME_BANNER).add(Blocks.LIME_BED).add(Blocks.LIME_CANDLE).add(Blocks.LIME_CARPET)
.add(Blocks.LIME_CONCRETE).add(Blocks.LIME_CONCRETE_POWDER).add(Blocks.LIME_GLAZED_TERRACOTTA)
.add(Blocks.LIME_SHULKER_BOX).add(Blocks.LIME_STAINED_GLASS).add(Blocks.LIME_STAINED_GLASS_PANE)
.add(Blocks.LIME_TERRACOTTA).add(Blocks.LIME_WALL_BANNER).add(Blocks.LIME_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.MAGENTA_DYED)
.add(Blocks.MAGENTA_BANNER).add(Blocks.MAGENTA_BED).add(Blocks.MAGENTA_CANDLE).add(Blocks.MAGENTA_CARPET)
.add(Blocks.MAGENTA_CONCRETE).add(Blocks.MAGENTA_CONCRETE_POWDER).add(Blocks.MAGENTA_GLAZED_TERRACOTTA)
.add(Blocks.MAGENTA_SHULKER_BOX).add(Blocks.MAGENTA_STAINED_GLASS).add(Blocks.MAGENTA_STAINED_GLASS_PANE)
.add(Blocks.MAGENTA_TERRACOTTA).add(Blocks.MAGENTA_WALL_BANNER).add(Blocks.MAGENTA_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.ORANGE_DYED)
.add(Blocks.ORANGE_BANNER).add(Blocks.ORANGE_BED).add(Blocks.ORANGE_CANDLE).add(Blocks.ORANGE_CARPET)
.add(Blocks.ORANGE_CONCRETE).add(Blocks.ORANGE_CONCRETE_POWDER).add(Blocks.ORANGE_GLAZED_TERRACOTTA)
.add(Blocks.ORANGE_SHULKER_BOX).add(Blocks.ORANGE_STAINED_GLASS).add(Blocks.ORANGE_STAINED_GLASS_PANE)
.add(Blocks.ORANGE_TERRACOTTA).add(Blocks.ORANGE_WALL_BANNER).add(Blocks.ORANGE_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.PINK_DYED)
.add(Blocks.PINK_BANNER).add(Blocks.PINK_BED).add(Blocks.PINK_CANDLE).add(Blocks.PINK_CARPET)
.add(Blocks.PINK_CONCRETE).add(Blocks.PINK_CONCRETE_POWDER).add(Blocks.PINK_GLAZED_TERRACOTTA)
.add(Blocks.PINK_SHULKER_BOX).add(Blocks.PINK_STAINED_GLASS).add(Blocks.PINK_STAINED_GLASS_PANE)
.add(Blocks.PINK_TERRACOTTA).add(Blocks.PINK_WALL_BANNER).add(Blocks.PINK_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.PURPLE_DYED)
.add(Blocks.PURPLE_BANNER).add(Blocks.PURPLE_BED).add(Blocks.PURPLE_CANDLE).add(Blocks.PURPLE_CARPET)
.add(Blocks.PURPLE_CONCRETE).add(Blocks.PURPLE_CONCRETE_POWDER).add(Blocks.PURPLE_GLAZED_TERRACOTTA)
.add(Blocks.PURPLE_SHULKER_BOX).add(Blocks.PURPLE_STAINED_GLASS).add(Blocks.PURPLE_STAINED_GLASS_PANE)
.add(Blocks.PURPLE_TERRACOTTA).add(Blocks.PURPLE_WALL_BANNER).add(Blocks.PURPLE_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.RED_DYED)
.add(Blocks.RED_BANNER).add(Blocks.RED_BED).add(Blocks.RED_CANDLE).add(Blocks.RED_CARPET)
.add(Blocks.RED_CONCRETE).add(Blocks.RED_CONCRETE_POWDER).add(Blocks.RED_GLAZED_TERRACOTTA)
.add(Blocks.RED_SHULKER_BOX).add(Blocks.RED_STAINED_GLASS).add(Blocks.RED_STAINED_GLASS_PANE)
.add(Blocks.RED_TERRACOTTA).add(Blocks.RED_WALL_BANNER).add(Blocks.RED_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.WHITE_DYED)
.add(Blocks.WHITE_BANNER).add(Blocks.WHITE_BED).add(Blocks.WHITE_CANDLE).add(Blocks.WHITE_CARPET)
.add(Blocks.WHITE_CONCRETE).add(Blocks.WHITE_CONCRETE_POWDER).add(Blocks.WHITE_GLAZED_TERRACOTTA)
.add(Blocks.WHITE_SHULKER_BOX).add(Blocks.WHITE_STAINED_GLASS).add(Blocks.WHITE_STAINED_GLASS_PANE)
.add(Blocks.WHITE_TERRACOTTA).add(Blocks.WHITE_WALL_BANNER).add(Blocks.WHITE_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.YELLOW_DYED)
.add(Blocks.YELLOW_BANNER).add(Blocks.YELLOW_BED).add(Blocks.YELLOW_CANDLE).add(Blocks.YELLOW_CARPET)
.add(Blocks.YELLOW_CONCRETE).add(Blocks.YELLOW_CONCRETE_POWDER).add(Blocks.YELLOW_GLAZED_TERRACOTTA)
.add(Blocks.YELLOW_SHULKER_BOX).add(Blocks.YELLOW_STAINED_GLASS).add(Blocks.YELLOW_STAINED_GLASS_PANE)
.add(Blocks.YELLOW_TERRACOTTA).add(Blocks.YELLOW_WALL_BANNER).add(Blocks.YELLOW_WOOL);
getOrCreateTagBuilder(ConventionalBlockTags.DYED)
.addTag(ConventionalBlockTags.WHITE_DYED)
.addTag(ConventionalBlockTags.ORANGE_DYED)
.addTag(ConventionalBlockTags.MAGENTA_DYED)
.addTag(ConventionalBlockTags.LIGHT_BLUE_DYED)
.addTag(ConventionalBlockTags.YELLOW_DYED)
.addTag(ConventionalBlockTags.LIME_DYED)
.addTag(ConventionalBlockTags.PINK_DYED)
.addTag(ConventionalBlockTags.GRAY_DYED)
.addTag(ConventionalBlockTags.LIGHT_GRAY_DYED)
.addTag(ConventionalBlockTags.CYAN_DYED)
.addTag(ConventionalBlockTags.PURPLE_DYED)
.addTag(ConventionalBlockTags.BLUE_DYED)
.addTag(ConventionalBlockTags.BROWN_DYED)
.addTag(ConventionalBlockTags.GREEN_DYED)
.addTag(ConventionalBlockTags.RED_DYED)
.addTag(ConventionalBlockTags.BLACK_DYED);
}
private void generateStorageTags() {
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_BONE_MEAL)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_COAL)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_COPPER)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_DIAMOND)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_DRIED_KELP)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_EMERALD)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_GOLD)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_IRON)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_LAPIS)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_NETHERITE)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_RAW_COPPER)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_RAW_GOLD)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_RAW_IRON)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_REDSTONE)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_SLIME)
.addTag(ConventionalBlockTags.STORAGE_BLOCKS_WHEAT);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_BONE_MEAL)
.add(Blocks.BONE_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_COAL)
.add(Blocks.COAL_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_COPPER)
.add(Blocks.COPPER_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_DIAMOND)
.add(Blocks.DIAMOND_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_DRIED_KELP)
.add(Blocks.DRIED_KELP_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_EMERALD)
.add(Blocks.EMERALD_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_GOLD)
.add(Blocks.GOLD_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_IRON)
.add(Blocks.IRON_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_LAPIS)
.add(Blocks.LAPIS_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_NETHERITE)
.add(Blocks.NETHERITE_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_RAW_COPPER)
.add(Blocks.RAW_COPPER_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_RAW_GOLD)
.add(Blocks.RAW_GOLD_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_RAW_IRON)
.add(Blocks.RAW_IRON_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_REDSTONE)
.add(Blocks.REDSTONE_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_SLIME)
.add(Blocks.SLIME_BLOCK);
getOrCreateTagBuilder(ConventionalBlockTags.STORAGE_BLOCKS_WHEAT)
.add(Blocks.HAY_BLOCK);
}
private void generateHeadTags() {
getOrCreateTagBuilder(ConventionalBlockTags.SKULLS)
.add(Blocks.SKELETON_SKULL)
.add(Blocks.SKELETON_WALL_SKULL)
.add(Blocks.WITHER_SKELETON_SKULL)
.add(Blocks.WITHER_SKELETON_WALL_SKULL)
.add(Blocks.PLAYER_HEAD)
.add(Blocks.PLAYER_WALL_HEAD)
.add(Blocks.ZOMBIE_HEAD)
.add(Blocks.ZOMBIE_WALL_HEAD)
.add(Blocks.CREEPER_HEAD)
.add(Blocks.CREEPER_WALL_HEAD)
.add(Blocks.PIGLIN_HEAD)
.add(Blocks.PIGLIN_WALL_HEAD)
.add(Blocks.DRAGON_HEAD)
.add(Blocks.DRAGON_WALL_HEAD);
}
private void generateBackwardsCompatTags() {
// Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability.
// TODO: Remove backwards compat tag entries in 1.22
getOrCreateTagBuilder(ConventionalBlockTags.RELOCATION_NOT_SUPPORTED).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "movement_restricted"));
getOrCreateTagBuilder(ConventionalBlockTags.QUARTZ_ORES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "quartz_ores"));
getOrCreateTagBuilder(ConventionalBlockTags.WOODEN_BARRELS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "wooden_barrels"));
getOrCreateTagBuilder(ConventionalBlockTags.WOODEN_CHESTS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "wooden_chests"));
getOrCreateTagBuilder(ConventionalBlockTags.SANDSTONE_BLOCKS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "sandstone_blocks"));
getOrCreateTagBuilder(ConventionalBlockTags.SANDSTONE_SLABS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "sandstone_slabs"));
getOrCreateTagBuilder(ConventionalBlockTags.SANDSTONE_STAIRS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "sandstone_stairs"));
getOrCreateTagBuilder(ConventionalBlockTags.RED_SANDSTONE_BLOCKS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "red_sandstone_blocks"));
getOrCreateTagBuilder(ConventionalBlockTags.RED_SANDSTONE_SLABS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "red_sandstone_slabs"));
getOrCreateTagBuilder(ConventionalBlockTags.RED_SANDSTONE_STAIRS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "red_sandstone_stairs"));
getOrCreateTagBuilder(ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "uncolored_sandstone_blocks"));
getOrCreateTagBuilder(ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "uncolored_sandstone_slabs"));
getOrCreateTagBuilder(ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "uncolored_sandstone_stairs"));
}
}

View file

@ -20,38 +20,47 @@ import java.util.concurrent.CompletableFuture;
import net.minecraft.enchantment.Enchantments; import net.minecraft.enchantment.Enchantments;
import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.RegistryWrapper;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalEnchantmentTags; import net.fabricmc.fabric.api.tag.convention.v2.ConventionalEnchantmentTags;
public class EnchantmentTagGenerator extends FabricTagProvider.EnchantmentTagProvider { public final class EnchantmentTagGenerator extends FabricTagProvider.EnchantmentTagProvider {
public EnchantmentTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) { public EnchantmentTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture); super(output, registriesFuture);
} }
@Override @Override
protected void configure(RegistryWrapper.WrapperLookup registries) { protected void configure(RegistryWrapper.WrapperLookup registries) {
getOrCreateTagBuilder(ConventionalEnchantmentTags.INCREASES_BLOCK_DROPS) getOrCreateTagBuilder(ConventionalEnchantmentTags.INCREASE_BLOCK_DROPS)
.add(Enchantments.FORTUNE); .add(Enchantments.FORTUNE);
getOrCreateTagBuilder(ConventionalEnchantmentTags.INCREASES_ENTITY_DROPS) getOrCreateTagBuilder(ConventionalEnchantmentTags.INCREASE_ENTITY_DROPS)
.add(Enchantments.LOOTING); .add(Enchantments.LOOTING);
getOrCreateTagBuilder(ConventionalEnchantmentTags.WEAPON_DAMAGE_ENHANCEMENT) getOrCreateTagBuilder(ConventionalEnchantmentTags.WEAPON_DAMAGE_ENHANCEMENTS)
.add(Enchantments.BANE_OF_ARTHROPODS) .add(Enchantments.SHARPNESS)
.add(Enchantments.IMPALING)
.add(Enchantments.SMITE) .add(Enchantments.SMITE)
.add(Enchantments.BANE_OF_ARTHROPODS)
.add(Enchantments.POWER) .add(Enchantments.POWER)
.add(Enchantments.SHARPNESS); .add(Enchantments.IMPALING);
getOrCreateTagBuilder(ConventionalEnchantmentTags.ENTITY_MOVEMENT_ENHANCEMENT) getOrCreateTagBuilder(ConventionalEnchantmentTags.ENTITY_SPEED_ENHANCEMENTS)
.add(Enchantments.SOUL_SPEED)
.add(Enchantments.SWIFT_SNEAK) .add(Enchantments.SWIFT_SNEAK)
.add(Enchantments.DEPTH_STRIDER) .add(Enchantments.DEPTH_STRIDER);
.add(Enchantments.SOUL_SPEED); getOrCreateTagBuilder(ConventionalEnchantmentTags.ENTITY_AUXILIARY_MOVEMENT_ENHANCEMENTS)
getOrCreateTagBuilder(ConventionalEnchantmentTags.ENTITY_DEFENSE_ENHANCEMENT)
.add(Enchantments.FEATHER_FALLING) .add(Enchantments.FEATHER_FALLING)
.add(Enchantments.FROST_WALKER);
getOrCreateTagBuilder(ConventionalEnchantmentTags.ENTITY_DEFENSE_ENHANCEMENT)
.add(Enchantments.PROTECTION) .add(Enchantments.PROTECTION)
.add(Enchantments.BLAST_PROTECTION) .add(Enchantments.BLAST_PROTECTION)
.add(Enchantments.PROJECTILE_PROTECTION) .add(Enchantments.PROJECTILE_PROTECTION)
.add(Enchantments.FIRE_PROTECTION) .add(Enchantments.FIRE_PROTECTION)
.add(Enchantments.RESPIRATION); .add(Enchantments.RESPIRATION)
.add(Enchantments.FEATHER_FALLING);
// Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability.
// TODO: Remove backwards compat tag entries in 1.22
getOrCreateTagBuilder(ConventionalEnchantmentTags.ENTITY_SPEED_ENHANCEMENTS)
.addOptionalTag(new Identifier("c", "entity_movement_enhancement"));
} }
} }

View file

@ -23,9 +23,9 @@ import net.minecraft.registry.RegistryWrapper;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalEntityTypeTags; import net.fabricmc.fabric.api.tag.convention.v2.ConventionalEntityTypeTags;
public class EntityTypeTagGenerator extends FabricTagProvider.EntityTypeTagProvider { public final class EntityTypeTagGenerator extends FabricTagProvider.EntityTypeTagProvider {
public EntityTypeTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) { public EntityTypeTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
super(output, completableFuture); super(output, completableFuture);
} }
@ -46,5 +46,7 @@ public class EntityTypeTagGenerator extends FabricTagProvider.EntityTypeTagProvi
getOrCreateTagBuilder(ConventionalEntityTypeTags.BOATS) getOrCreateTagBuilder(ConventionalEntityTypeTags.BOATS)
.add(EntityType.BOAT) .add(EntityType.BOAT)
.add(EntityType.CHEST_BOAT); .add(EntityType.CHEST_BOAT);
getOrCreateTagBuilder(ConventionalEntityTypeTags.CAPTURING_NOT_SUPPORTED);
getOrCreateTagBuilder(ConventionalEntityTypeTags.TELEPORTING_NOT_SUPPORTED);
} }
} }

View file

@ -23,9 +23,9 @@ import net.minecraft.registry.tag.FluidTags;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalFluidTags; import net.fabricmc.fabric.api.tag.convention.v2.ConventionalFluidTags;
public class FluidTagGenerator extends FabricTagProvider.FluidTagProvider { public final class FluidTagGenerator extends FabricTagProvider.FluidTagProvider {
public FluidTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) { public FluidTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
super(output, completableFuture); super(output, completableFuture);
} }
@ -36,5 +36,8 @@ public class FluidTagGenerator extends FabricTagProvider.FluidTagProvider {
.addOptionalTag(FluidTags.WATER); .addOptionalTag(FluidTags.WATER);
getOrCreateTagBuilder(ConventionalFluidTags.LAVA) getOrCreateTagBuilder(ConventionalFluidTags.LAVA)
.addOptionalTag(FluidTags.LAVA); .addOptionalTag(FluidTags.LAVA);
getOrCreateTagBuilder(ConventionalFluidTags.MILK);
getOrCreateTagBuilder(ConventionalFluidTags.HONEY);
getOrCreateTagBuilder(ConventionalFluidTags.HIDDEN_FROM_RECIPE_VIEWERS);
} }
} }

View file

@ -0,0 +1,628 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.tag.convention.datagen.generators;
import java.util.concurrent.CompletableFuture;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.Items;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags;
import net.fabricmc.fabric.api.tag.convention.v2.TagUtil;
public final class ItemTagGenerator extends FabricTagProvider.ItemTagProvider {
public ItemTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture, FabricTagProvider.BlockTagProvider blockTags) {
super(output, completableFuture, blockTags);
}
@Override
protected void configure(RegistryWrapper.WrapperLookup arg) {
generateToolTags();
generateBucketTags();
generateOreAndRelatedTags();
generateConsumableTags();
generateFoodTags();
generateDyeTags();
generateDyedTags();
generateVillagerJobSites();
generateOtherTags();
copyItemTags();
generateBackwardsCompatTags();
}
private void copyItemTags() {
copy(ConventionalBlockTags.STONES, ConventionalItemTags.STONES);
copy(ConventionalBlockTags.COBBLESTONES, ConventionalItemTags.COBBLESTONES);
copy(ConventionalBlockTags.BARRELS, ConventionalItemTags.BARRELS);
copy(ConventionalBlockTags.WOODEN_BARRELS, ConventionalItemTags.WOODEN_BARRELS);
copy(ConventionalBlockTags.BOOKSHELVES, ConventionalItemTags.BOOKSHELVES);
copy(ConventionalBlockTags.CHESTS, ConventionalItemTags.CHESTS);
copy(ConventionalBlockTags.WOODEN_CHESTS, ConventionalItemTags.WOODEN_CHESTS);
copy(ConventionalBlockTags.GLASS_BLOCKS, ConventionalItemTags.GLASS_BLOCKS);
copy(ConventionalBlockTags.GLASS_PANES, ConventionalItemTags.GLASS_PANES);
copy(ConventionalBlockTags.SHULKER_BOXES, ConventionalItemTags.SHULKER_BOXES);
copy(ConventionalBlockTags.BUDDING_BLOCKS, ConventionalItemTags.BUDDING_BLOCKS);
copy(ConventionalBlockTags.BUDS, ConventionalItemTags.BUDS);
copy(ConventionalBlockTags.CLUSTERS, ConventionalItemTags.CLUSTERS);
copy(ConventionalBlockTags.SANDSTONE_BLOCKS, ConventionalItemTags.SANDSTONE_BLOCKS);
copy(ConventionalBlockTags.SANDSTONE_SLABS, ConventionalItemTags.SANDSTONE_SLABS);
copy(ConventionalBlockTags.SANDSTONE_STAIRS, ConventionalItemTags.SANDSTONE_STAIRS);
copy(ConventionalBlockTags.RED_SANDSTONE_BLOCKS, ConventionalItemTags.RED_SANDSTONE_BLOCKS);
copy(ConventionalBlockTags.RED_SANDSTONE_SLABS, ConventionalItemTags.RED_SANDSTONE_SLABS);
copy(ConventionalBlockTags.RED_SANDSTONE_STAIRS, ConventionalItemTags.RED_SANDSTONE_STAIRS);
copy(ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS, ConventionalItemTags.UNCOLORED_SANDSTONE_BLOCKS);
copy(ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS, ConventionalItemTags.UNCOLORED_SANDSTONE_SLABS);
copy(ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS, ConventionalItemTags.UNCOLORED_SANDSTONE_STAIRS);
copy(ConventionalBlockTags.STORAGE_BLOCKS, ConventionalItemTags.STORAGE_BLOCKS);
copy(ConventionalBlockTags.STORAGE_BLOCKS_BONE_MEAL, ConventionalItemTags.STORAGE_BLOCKS_BONE_MEAL);
copy(ConventionalBlockTags.STORAGE_BLOCKS_COAL, ConventionalItemTags.STORAGE_BLOCKS_COAL);
copy(ConventionalBlockTags.STORAGE_BLOCKS_COPPER, ConventionalItemTags.STORAGE_BLOCKS_COPPER);
copy(ConventionalBlockTags.STORAGE_BLOCKS_DIAMOND, ConventionalItemTags.STORAGE_BLOCKS_DIAMOND);
copy(ConventionalBlockTags.STORAGE_BLOCKS_DRIED_KELP, ConventionalItemTags.STORAGE_BLOCKS_DRIED_KELP);
copy(ConventionalBlockTags.STORAGE_BLOCKS_EMERALD, ConventionalItemTags.STORAGE_BLOCKS_EMERALD);
copy(ConventionalBlockTags.STORAGE_BLOCKS_GOLD, ConventionalItemTags.STORAGE_BLOCKS_GOLD);
copy(ConventionalBlockTags.STORAGE_BLOCKS_IRON, ConventionalItemTags.STORAGE_BLOCKS_IRON);
copy(ConventionalBlockTags.STORAGE_BLOCKS_LAPIS, ConventionalItemTags.STORAGE_BLOCKS_LAPIS);
copy(ConventionalBlockTags.STORAGE_BLOCKS_NETHERITE, ConventionalItemTags.STORAGE_BLOCKS_NETHERITE);
copy(ConventionalBlockTags.STORAGE_BLOCKS_RAW_COPPER, ConventionalItemTags.STORAGE_BLOCKS_RAW_COPPER);
copy(ConventionalBlockTags.STORAGE_BLOCKS_RAW_GOLD, ConventionalItemTags.STORAGE_BLOCKS_RAW_GOLD);
copy(ConventionalBlockTags.STORAGE_BLOCKS_RAW_IRON, ConventionalItemTags.STORAGE_BLOCKS_RAW_IRON);
copy(ConventionalBlockTags.STORAGE_BLOCKS_REDSTONE, ConventionalItemTags.STORAGE_BLOCKS_REDSTONE);
copy(ConventionalBlockTags.STORAGE_BLOCKS_SLIME, ConventionalItemTags.STORAGE_BLOCKS_SLIME);
copy(ConventionalBlockTags.STORAGE_BLOCKS_WHEAT, ConventionalItemTags.STORAGE_BLOCKS_WHEAT);
}
private void generateDyeTags() {
getOrCreateTagBuilder(ConventionalItemTags.DYES)
.addOptionalTag(ConventionalItemTags.WHITE_DYES)
.addOptionalTag(ConventionalItemTags.ORANGE_DYES)
.addOptionalTag(ConventionalItemTags.MAGENTA_DYES)
.addOptionalTag(ConventionalItemTags.LIGHT_BLUE_DYES)
.addOptionalTag(ConventionalItemTags.YELLOW_DYES)
.addOptionalTag(ConventionalItemTags.LIME_DYES)
.addOptionalTag(ConventionalItemTags.PINK_DYES)
.addOptionalTag(ConventionalItemTags.GRAY_DYES)
.addOptionalTag(ConventionalItemTags.LIGHT_GRAY_DYES)
.addOptionalTag(ConventionalItemTags.CYAN_DYES)
.addOptionalTag(ConventionalItemTags.PURPLE_DYES)
.addOptionalTag(ConventionalItemTags.BLUE_DYES)
.addOptionalTag(ConventionalItemTags.BROWN_DYES)
.addOptionalTag(ConventionalItemTags.GREEN_DYES)
.addOptionalTag(ConventionalItemTags.RED_DYES)
.addOptionalTag(ConventionalItemTags.BLACK_DYES);
getOrCreateTagBuilder(ConventionalItemTags.BLACK_DYES)
.add(Items.BLACK_DYE);
getOrCreateTagBuilder(ConventionalItemTags.BLUE_DYES)
.add(Items.BLUE_DYE);
getOrCreateTagBuilder(ConventionalItemTags.BROWN_DYES)
.add(Items.BROWN_DYE);
getOrCreateTagBuilder(ConventionalItemTags.GREEN_DYES)
.add(Items.GREEN_DYE);
getOrCreateTagBuilder(ConventionalItemTags.RED_DYES)
.add(Items.RED_DYE);
getOrCreateTagBuilder(ConventionalItemTags.WHITE_DYES)
.add(Items.WHITE_DYE);
getOrCreateTagBuilder(ConventionalItemTags.YELLOW_DYES)
.add(Items.YELLOW_DYE);
getOrCreateTagBuilder(ConventionalItemTags.LIGHT_BLUE_DYES)
.add(Items.LIGHT_BLUE_DYE);
getOrCreateTagBuilder(ConventionalItemTags.LIGHT_GRAY_DYES)
.add(Items.LIGHT_GRAY_DYE);
getOrCreateTagBuilder(ConventionalItemTags.LIME_DYES)
.add(Items.LIME_DYE);
getOrCreateTagBuilder(ConventionalItemTags.MAGENTA_DYES)
.add(Items.MAGENTA_DYE);
getOrCreateTagBuilder(ConventionalItemTags.ORANGE_DYES)
.add(Items.ORANGE_DYE);
getOrCreateTagBuilder(ConventionalItemTags.PINK_DYES)
.add(Items.PINK_DYE);
getOrCreateTagBuilder(ConventionalItemTags.CYAN_DYES)
.add(Items.CYAN_DYE);
getOrCreateTagBuilder(ConventionalItemTags.GRAY_DYES)
.add(Items.GRAY_DYE);
getOrCreateTagBuilder(ConventionalItemTags.PURPLE_DYES)
.add(Items.PURPLE_DYE);
}
private void generateConsumableTags() {
getOrCreateTagBuilder(ConventionalItemTags.POTIONS)
.add(Items.POTION)
.add(Items.SPLASH_POTION)
.add(Items.LINGERING_POTION);
}
private void generateFoodTags() {
getOrCreateTagBuilder(ConventionalItemTags.FRUITS_FOODS)
.add(Items.APPLE)
.add(Items.GOLDEN_APPLE)
.add(Items.ENCHANTED_GOLDEN_APPLE);
getOrCreateTagBuilder(ConventionalItemTags.VEGETABLES_FOODS)
.add(Items.CARROT)
.add(Items.GOLDEN_CARROT)
.add(Items.POTATO)
.add(Items.MELON_SLICE)
.add(Items.BEETROOT);
getOrCreateTagBuilder(ConventionalItemTags.BERRIES_FOODS)
.add(Items.SWEET_BERRIES)
.add(Items.GLOW_BERRIES);
getOrCreateTagBuilder(ConventionalItemTags.BREADS_FOODS)
.add(Items.BREAD);
getOrCreateTagBuilder(ConventionalItemTags.COOKIES_FOODS)
.add(Items.COOKIE);
getOrCreateTagBuilder(ConventionalItemTags.RAW_MEATS_FOODS)
.add(Items.BEEF)
.add(Items.CHICKEN)
.add(Items.RABBIT)
.add(Items.MUTTON);
getOrCreateTagBuilder(ConventionalItemTags.RAW_FISHES_FOODS)
.add(Items.COD)
.add(Items.SALMON)
.add(Items.TROPICAL_FISH)
.add(Items.PUFFERFISH);
getOrCreateTagBuilder(ConventionalItemTags.COOKED_MEATS_FOODS)
.add(Items.COOKED_BEEF)
.add(Items.COOKED_CHICKEN)
.add(Items.COOKED_RABBIT)
.add(Items.COOKED_MUTTON);
getOrCreateTagBuilder(ConventionalItemTags.COOKED_FISHES_FOODS)
.add(Items.COOKED_COD)
.add(Items.COOKED_SALMON);
getOrCreateTagBuilder(ConventionalItemTags.SOUPS_FOODS)
.add(Items.BEETROOT_SOUP)
.add(Items.MUSHROOM_STEW)
.add(Items.RABBIT_STEW)
.add(Items.SUSPICIOUS_STEW);
getOrCreateTagBuilder(ConventionalItemTags.CANDIES_FOODS);
getOrCreateTagBuilder(ConventionalItemTags.EDIBLE_WHEN_PLACED_FOODS)
.add(Items.CAKE);
getOrCreateTagBuilder(ConventionalItemTags.FOOD_POISONING_FOODS)
.add(Items.POISONOUS_POTATO)
.add(Items.PUFFERFISH)
.add(Items.SPIDER_EYE)
.add(Items.CHICKEN)
.add(Items.ROTTEN_FLESH);
getOrCreateTagBuilder(ConventionalItemTags.FOODS)
.add(Items.BAKED_POTATO)
.add(Items.PUMPKIN_PIE)
.add(Items.HONEY_BOTTLE)
.add(Items.OMINOUS_BOTTLE)
.add(Items.DRIED_KELP)
.addOptionalTag(ConventionalItemTags.FRUITS_FOODS)
.addOptionalTag(ConventionalItemTags.VEGETABLES_FOODS)
.addOptionalTag(ConventionalItemTags.BERRIES_FOODS)
.addOptionalTag(ConventionalItemTags.BREADS_FOODS)
.addOptionalTag(ConventionalItemTags.COOKIES_FOODS)
.addOptionalTag(ConventionalItemTags.RAW_MEATS_FOODS)
.addOptionalTag(ConventionalItemTags.RAW_FISHES_FOODS)
.addOptionalTag(ConventionalItemTags.COOKED_MEATS_FOODS)
.addOptionalTag(ConventionalItemTags.COOKED_FISHES_FOODS)
.addOptionalTag(ConventionalItemTags.SOUPS_FOODS)
.addOptionalTag(ConventionalItemTags.CANDIES_FOODS)
.addOptionalTag(ConventionalItemTags.EDIBLE_WHEN_PLACED_FOODS)
.addOptionalTag(ConventionalItemTags.FOOD_POISONING_FOODS);
}
private void generateBucketTags() {
getOrCreateTagBuilder(ConventionalItemTags.EMPTY_BUCKETS)
.add(Items.BUCKET);
getOrCreateTagBuilder(ConventionalItemTags.LAVA_BUCKETS)
.add(Items.LAVA_BUCKET);
getOrCreateTagBuilder(ConventionalItemTags.ENTITY_WATER_BUCKETS)
.add(Items.AXOLOTL_BUCKET)
.add(Items.COD_BUCKET)
.add(Items.PUFFERFISH_BUCKET)
.add(Items.TADPOLE_BUCKET)
.add(Items.TROPICAL_FISH_BUCKET)
.add(Items.SALMON_BUCKET);
getOrCreateTagBuilder(ConventionalItemTags.WATER_BUCKETS)
.add(Items.WATER_BUCKET);
getOrCreateTagBuilder(ConventionalItemTags.MILK_BUCKETS)
.add(Items.MILK_BUCKET);
}
private void generateOreAndRelatedTags() {
// Categories
getOrCreateTagBuilder(ConventionalItemTags.BRICKS)
.addOptionalTag(ConventionalItemTags.NORMAL_BRICKS)
.addOptionalTag(ConventionalItemTags.NETHER_BRICKS);
getOrCreateTagBuilder(ConventionalItemTags.DUSTS)
.addOptionalTag(ConventionalItemTags.GLOWSTONE_DUSTS)
.addOptionalTag(ConventionalItemTags.REDSTONE_DUSTS);
getOrCreateTagBuilder(ConventionalItemTags.GEMS)
.addOptionalTag(ConventionalItemTags.AMETHYST_GEMS)
.addOptionalTag(ConventionalItemTags.DIAMOND_GEMS)
.addOptionalTag(ConventionalItemTags.EMERALD_GEMS)
.addOptionalTag(ConventionalItemTags.LAPIS_GEMS)
.addOptionalTag(ConventionalItemTags.PRISMARINE_GEMS)
.addOptionalTag(ConventionalItemTags.QUARTZ_GEMS);
getOrCreateTagBuilder(ConventionalItemTags.INGOTS)
.addOptionalTag(ConventionalItemTags.COPPER_INGOTS)
.addOptionalTag(ConventionalItemTags.IRON_INGOTS)
.addOptionalTag(ConventionalItemTags.GOLD_INGOTS)
.addOptionalTag(ConventionalItemTags.NETHERITE_INGOTS);
getOrCreateTagBuilder(ConventionalItemTags.NUGGETS)
.add(Items.GOLD_NUGGET, Items.IRON_NUGGET);
copy(ConventionalBlockTags.ORES, ConventionalItemTags.ORES);
getOrCreateTagBuilder(ConventionalItemTags.ORES)
.addOptionalTag(ConventionalItemTags.NETHERITE_SCRAP_ORES)
.addOptionalTag(ConventionalItemTags.QUARTZ_ORES);
getOrCreateTagBuilder(ConventionalItemTags.RAW_MATERIALS)
.addOptionalTag(ConventionalItemTags.COPPER_RAW_MATERIALS)
.addOptionalTag(ConventionalItemTags.GOLD_RAW_MATERIALS)
.addOptionalTag(ConventionalItemTags.IRON_RAW_MATERIALS);
getOrCreateTagBuilder(ConventionalItemTags.RAW_MATERIALS)
.addOptionalTag(ConventionalItemTags.COPPER_RAW_MATERIALS)
.addOptionalTag(ConventionalItemTags.IRON_RAW_MATERIALS)
.addOptionalTag(ConventionalItemTags.GOLD_RAW_MATERIALS);
getOrCreateTagBuilder(ConventionalItemTags.RAW_BLOCKS)
.addOptionalTag(ConventionalItemTags.COPPER_RAW_BLOCKS)
.addOptionalTag(ConventionalItemTags.GOLD_RAW_BLOCKS)
.addOptionalTag(ConventionalItemTags.IRON_RAW_BLOCKS);
// Vanilla instances
getOrCreateTagBuilder(ConventionalItemTags.NORMAL_BRICKS)
.add(Items.BRICK);
getOrCreateTagBuilder(ConventionalItemTags.NETHER_BRICKS)
.add(Items.NETHER_BRICK);
getOrCreateTagBuilder(ConventionalItemTags.IRON_INGOTS)
.add(Items.IRON_INGOT);
getOrCreateTagBuilder(ConventionalItemTags.COPPER_INGOTS)
.add(Items.COPPER_INGOT);
getOrCreateTagBuilder(ConventionalItemTags.GOLD_INGOTS)
.add(Items.GOLD_INGOT);
getOrCreateTagBuilder(ConventionalItemTags.NETHERITE_INGOTS)
.add(Items.NETHERITE_INGOT);
getOrCreateTagBuilder(ConventionalItemTags.IRON_RAW_BLOCKS)
.add(Items.RAW_IRON_BLOCK);
getOrCreateTagBuilder(ConventionalItemTags.COPPER_RAW_BLOCKS)
.add(Items.RAW_COPPER_BLOCK);
getOrCreateTagBuilder(ConventionalItemTags.GOLD_RAW_BLOCKS)
.add(Items.RAW_GOLD_BLOCK);
getOrCreateTagBuilder(ConventionalItemTags.IRON_RAW_MATERIALS)
.add(Items.RAW_IRON);
getOrCreateTagBuilder(ConventionalItemTags.COPPER_RAW_MATERIALS)
.add(Items.RAW_COPPER);
getOrCreateTagBuilder(ConventionalItemTags.GOLD_RAW_MATERIALS)
.add(Items.RAW_GOLD);
getOrCreateTagBuilder(ConventionalItemTags.REDSTONE_DUSTS)
.add(Items.REDSTONE);
getOrCreateTagBuilder(ConventionalItemTags.GLOWSTONE_DUSTS)
.add(Items.GLOWSTONE_DUST);
getOrCreateTagBuilder(ConventionalItemTags.COAL)
.addOptionalTag(ItemTags.COALS);
getOrCreateTagBuilder(ConventionalItemTags.QUARTZ_ORES)
.add(Items.NETHER_QUARTZ_ORE);
getOrCreateTagBuilder(ConventionalItemTags.NETHERITE_SCRAP_ORES)
.add(Items.ANCIENT_DEBRIS);
getOrCreateTagBuilder(ConventionalItemTags.QUARTZ_GEMS)
.add(Items.QUARTZ);
getOrCreateTagBuilder(ConventionalItemTags.EMERALD_GEMS)
.add(Items.EMERALD);
getOrCreateTagBuilder(ConventionalItemTags.LAPIS_GEMS)
.add(Items.LAPIS_LAZULI);
getOrCreateTagBuilder(ConventionalItemTags.DIAMOND_GEMS)
.add(Items.DIAMOND);
getOrCreateTagBuilder(ConventionalItemTags.AMETHYST_GEMS)
.add(Items.AMETHYST_SHARD);
getOrCreateTagBuilder(ConventionalItemTags.PRISMARINE_GEMS)
.add(Items.PRISMARINE_CRYSTALS);
}
private void generateToolTags() {
getOrCreateTagBuilder(ConventionalItemTags.TOOLS)
.addOptionalTag(ItemTags.AXES)
.addOptionalTag(ItemTags.HOES)
.addOptionalTag(ItemTags.PICKAXES)
.addOptionalTag(ItemTags.SHOVELS)
.addOptionalTag(ItemTags.SWORDS)
.addOptionalTag(ConventionalItemTags.BOWS_TOOLS)
.addOptionalTag(ConventionalItemTags.BRUSHES_TOOLS)
.addOptionalTag(ConventionalItemTags.CROSSBOWS_TOOLS)
.addOptionalTag(ConventionalItemTags.FISHING_RODS_TOOLS)
.addOptionalTag(ConventionalItemTags.SHEARS_TOOLS)
.addOptionalTag(ConventionalItemTags.SHIELDS_TOOLS)
.addOptionalTag(ConventionalItemTags.SPEARS_TOOLS)
.addOptionalTag(ConventionalItemTags.MINING_TOOLS)
.addOptionalTag(ConventionalItemTags.MELEE_WEAPONS_TOOLS)
.addOptionalTag(ConventionalItemTags.RANGED_WEAPONS_TOOLS);
getOrCreateTagBuilder(ConventionalItemTags.BOWS_TOOLS)
.add(Items.BOW);
getOrCreateTagBuilder(ConventionalItemTags.CROSSBOWS_TOOLS)
.add(Items.CROSSBOW);
getOrCreateTagBuilder(ConventionalItemTags.SHEARS_TOOLS)
.add(Items.SHEARS);
getOrCreateTagBuilder(ConventionalItemTags.SHIELDS_TOOLS)
.add(Items.SHIELD);
getOrCreateTagBuilder(ConventionalItemTags.SPEARS_TOOLS)
.add(Items.TRIDENT);
getOrCreateTagBuilder(ConventionalItemTags.FISHING_RODS_TOOLS)
.add(Items.FISHING_ROD);
getOrCreateTagBuilder(ConventionalItemTags.BRUSHES_TOOLS)
.add(Items.BRUSH);
getOrCreateTagBuilder(ConventionalItemTags.MINING_TOOLS)
.add(Items.WOODEN_PICKAXE)
.add(Items.STONE_PICKAXE)
.add(Items.GOLDEN_PICKAXE)
.add(Items.IRON_PICKAXE)
.add(Items.DIAMOND_PICKAXE)
.add(Items.NETHERITE_PICKAXE);
getOrCreateTagBuilder(ConventionalItemTags.MELEE_WEAPONS_TOOLS)
.add(Items.WOODEN_SWORD)
.add(Items.STONE_SWORD)
.add(Items.GOLDEN_SWORD)
.add(Items.IRON_SWORD)
.add(Items.DIAMOND_SWORD)
.add(Items.NETHERITE_SWORD)
.add(Items.WOODEN_AXE)
.add(Items.STONE_AXE)
.add(Items.GOLDEN_AXE)
.add(Items.IRON_AXE)
.add(Items.DIAMOND_AXE)
.add(Items.NETHERITE_AXE);
getOrCreateTagBuilder(ConventionalItemTags.RANGED_WEAPONS_TOOLS)
.add(Items.BOW)
.add(Items.CROSSBOW)
.add(Items.TRIDENT);
getOrCreateTagBuilder(ConventionalItemTags.ARMORS)
.addOptionalTag(ItemTags.HEAD_ARMOR)
.addOptionalTag(ItemTags.CHEST_ARMOR)
.addOptionalTag(ItemTags.LEG_ARMOR)
.addOptionalTag(ItemTags.FOOT_ARMOR);
getOrCreateTagBuilder(ConventionalItemTags.ENCHANTABLES)
.addOptionalTag(ItemTags.ARMOR_ENCHANTABLE)
.addOptionalTag(ItemTags.EQUIPPABLE_ENCHANTABLE)
.addOptionalTag(ItemTags.WEAPON_ENCHANTABLE)
.addOptionalTag(ItemTags.SWORD_ENCHANTABLE)
.addOptionalTag(ItemTags.MINING_ENCHANTABLE)
.addOptionalTag(ItemTags.MINING_LOOT_ENCHANTABLE)
.addOptionalTag(ItemTags.FISHING_ENCHANTABLE)
.addOptionalTag(ItemTags.TRIDENT_ENCHANTABLE)
.addOptionalTag(ItemTags.BOW_ENCHANTABLE)
.addOptionalTag(ItemTags.CROSSBOW_ENCHANTABLE)
.addOptionalTag(ItemTags.MACE_ENCHANTABLE)
.addOptionalTag(ItemTags.FIRE_ASPECT_ENCHANTABLE)
.addOptionalTag(ItemTags.DURABILITY_ENCHANTABLE);
}
private void generateVillagerJobSites() {
BlockTagGenerator.VILLAGER_JOB_SITE_BLOCKS.stream()
.map(ItemConvertible::asItem)
.distinct() // cauldron blocks have the same item
.forEach(getOrCreateTagBuilder(ConventionalItemTags.VILLAGER_JOB_SITES)::add);
}
private void generateOtherTags() {
getOrCreateTagBuilder(ConventionalItemTags.PLAYER_WORKSTATIONS_CRAFTING_TABLES)
.add(Items.CRAFTING_TABLE);
getOrCreateTagBuilder(ConventionalItemTags.PLAYER_WORKSTATIONS_FURNACES)
.add(Items.FURNACE);
getOrCreateTagBuilder(ConventionalItemTags.STRINGS)
.add(Items.STRING);
getOrCreateTagBuilder(ConventionalItemTags.WOODEN_RODS)
.add(Items.STICK);
getOrCreateTagBuilder(ConventionalItemTags.BLAZE_RODS)
.add(Items.BLAZE_ROD);
getOrCreateTagBuilder(ConventionalItemTags.BREEZE_RODS)
.add(Items.BREEZE_ROD);
getOrCreateTagBuilder(ConventionalItemTags.RODS)
.addOptionalTag(ConventionalItemTags.WOODEN_RODS)
.addOptionalTag(ConventionalItemTags.BLAZE_RODS)
.addOptionalTag(ConventionalItemTags.BREEZE_RODS);
getOrCreateTagBuilder(ConventionalItemTags.ROPES); // Generate tag so others can see it exists through JSON.
getOrCreateTagBuilder(ConventionalItemTags.CHAINS)
.add(Items.CHAIN);
getOrCreateTagBuilder(ConventionalItemTags.HIDDEN_FROM_RECIPE_VIEWERS); // Generate tag so others can see it exists through JSON.
}
private void generateDyedTags() {
// Cannot pull entries from block tag because Wall Banners do not have an item form
getOrCreateTagBuilder(ConventionalItemTags.BLACK_DYED)
.add(Items.BLACK_BANNER).add(Items.BLACK_BED).add(Items.BLACK_CANDLE).add(Items.BLACK_CARPET)
.add(Items.BLACK_CONCRETE).add(Items.BLACK_CONCRETE_POWDER).add(Items.BLACK_GLAZED_TERRACOTTA)
.add(Items.BLACK_SHULKER_BOX).add(Items.BLACK_STAINED_GLASS).add(Items.BLACK_STAINED_GLASS_PANE)
.add(Items.BLACK_TERRACOTTA).add(Items.BLACK_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.BLUE_DYED)
.add(Items.BLUE_BANNER).add(Items.BLUE_BED).add(Items.BLUE_CANDLE).add(Items.BLUE_CARPET)
.add(Items.BLUE_CONCRETE).add(Items.BLUE_CONCRETE_POWDER).add(Items.BLUE_GLAZED_TERRACOTTA)
.add(Items.BLUE_SHULKER_BOX).add(Items.BLUE_STAINED_GLASS).add(Items.BLUE_STAINED_GLASS_PANE)
.add(Items.BLUE_TERRACOTTA).add(Items.BLUE_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.BROWN_DYED)
.add(Items.BROWN_BANNER).add(Items.BROWN_BED).add(Items.BROWN_CANDLE).add(Items.BROWN_CARPET)
.add(Items.BROWN_CONCRETE).add(Items.BROWN_CONCRETE_POWDER).add(Items.BROWN_GLAZED_TERRACOTTA)
.add(Items.BROWN_SHULKER_BOX).add(Items.BROWN_STAINED_GLASS).add(Items.BROWN_STAINED_GLASS_PANE)
.add(Items.BROWN_TERRACOTTA).add(Items.BROWN_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.CYAN_DYED)
.add(Items.CYAN_BANNER).add(Items.CYAN_BED).add(Items.CYAN_CANDLE).add(Items.CYAN_CARPET)
.add(Items.CYAN_CONCRETE).add(Items.CYAN_CONCRETE_POWDER).add(Items.CYAN_GLAZED_TERRACOTTA)
.add(Items.CYAN_SHULKER_BOX).add(Items.CYAN_STAINED_GLASS).add(Items.CYAN_STAINED_GLASS_PANE)
.add(Items.CYAN_TERRACOTTA).add(Items.CYAN_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.GRAY_DYED)
.add(Items.GRAY_BANNER).add(Items.GRAY_BED).add(Items.GRAY_CANDLE).add(Items.GRAY_CARPET)
.add(Items.GRAY_CONCRETE).add(Items.GRAY_CONCRETE_POWDER).add(Items.GRAY_GLAZED_TERRACOTTA)
.add(Items.GRAY_SHULKER_BOX).add(Items.GRAY_STAINED_GLASS).add(Items.GRAY_STAINED_GLASS_PANE)
.add(Items.GRAY_TERRACOTTA).add(Items.GRAY_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.GREEN_DYED)
.add(Items.GREEN_BANNER).add(Items.GREEN_BED).add(Items.GREEN_CANDLE).add(Items.GREEN_CARPET)
.add(Items.GREEN_CONCRETE).add(Items.GREEN_CONCRETE_POWDER).add(Items.GREEN_GLAZED_TERRACOTTA)
.add(Items.GREEN_SHULKER_BOX).add(Items.GREEN_STAINED_GLASS).add(Items.GREEN_STAINED_GLASS_PANE)
.add(Items.GREEN_TERRACOTTA).add(Items.GREEN_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.LIGHT_BLUE_DYED)
.add(Items.LIGHT_BLUE_BANNER).add(Items.LIGHT_BLUE_BED).add(Items.LIGHT_BLUE_CANDLE).add(Items.LIGHT_BLUE_CARPET)
.add(Items.LIGHT_BLUE_CONCRETE).add(Items.LIGHT_BLUE_CONCRETE_POWDER).add(Items.LIGHT_BLUE_GLAZED_TERRACOTTA)
.add(Items.LIGHT_BLUE_SHULKER_BOX).add(Items.LIGHT_BLUE_STAINED_GLASS).add(Items.LIGHT_BLUE_STAINED_GLASS_PANE)
.add(Items.LIGHT_BLUE_TERRACOTTA).add(Items.LIGHT_BLUE_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.LIGHT_GRAY_DYED)
.add(Items.LIGHT_GRAY_BANNER).add(Items.LIGHT_GRAY_BED).add(Items.LIGHT_GRAY_CANDLE).add(Items.LIGHT_GRAY_CARPET)
.add(Items.LIGHT_GRAY_CONCRETE).add(Items.LIGHT_GRAY_CONCRETE_POWDER).add(Items.LIGHT_GRAY_GLAZED_TERRACOTTA)
.add(Items.LIGHT_GRAY_SHULKER_BOX).add(Items.LIGHT_GRAY_STAINED_GLASS).add(Items.LIGHT_GRAY_STAINED_GLASS_PANE)
.add(Items.LIGHT_GRAY_TERRACOTTA).add(Items.LIGHT_GRAY_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.LIME_DYED)
.add(Items.LIME_BANNER).add(Items.LIME_BED).add(Items.LIME_CANDLE).add(Items.LIME_CARPET)
.add(Items.LIME_CONCRETE).add(Items.LIME_CONCRETE_POWDER).add(Items.LIME_GLAZED_TERRACOTTA)
.add(Items.LIME_SHULKER_BOX).add(Items.LIME_STAINED_GLASS).add(Items.LIME_STAINED_GLASS_PANE)
.add(Items.LIME_TERRACOTTA).add(Items.LIME_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.MAGENTA_DYED)
.add(Items.MAGENTA_BANNER).add(Items.MAGENTA_BED).add(Items.MAGENTA_CANDLE).add(Items.MAGENTA_CARPET)
.add(Items.MAGENTA_CONCRETE).add(Items.MAGENTA_CONCRETE_POWDER).add(Items.MAGENTA_GLAZED_TERRACOTTA)
.add(Items.MAGENTA_SHULKER_BOX).add(Items.MAGENTA_STAINED_GLASS).add(Items.MAGENTA_STAINED_GLASS_PANE)
.add(Items.MAGENTA_TERRACOTTA).add(Items.MAGENTA_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.ORANGE_DYED)
.add(Items.ORANGE_BANNER).add(Items.ORANGE_BED).add(Items.ORANGE_CANDLE).add(Items.ORANGE_CARPET)
.add(Items.ORANGE_CONCRETE).add(Items.ORANGE_CONCRETE_POWDER).add(Items.ORANGE_GLAZED_TERRACOTTA)
.add(Items.ORANGE_SHULKER_BOX).add(Items.ORANGE_STAINED_GLASS).add(Items.ORANGE_STAINED_GLASS_PANE)
.add(Items.ORANGE_TERRACOTTA).add(Items.ORANGE_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.PINK_DYED)
.add(Items.PINK_BANNER).add(Items.PINK_BED).add(Items.PINK_CANDLE).add(Items.PINK_CARPET)
.add(Items.PINK_CONCRETE).add(Items.PINK_CONCRETE_POWDER).add(Items.PINK_GLAZED_TERRACOTTA)
.add(Items.PINK_SHULKER_BOX).add(Items.PINK_STAINED_GLASS).add(Items.PINK_STAINED_GLASS_PANE)
.add(Items.PINK_TERRACOTTA).add(Items.PINK_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.PURPLE_DYED)
.add(Items.PURPLE_BANNER).add(Items.PURPLE_BED).add(Items.PURPLE_CANDLE).add(Items.PURPLE_CARPET)
.add(Items.PURPLE_CONCRETE).add(Items.PURPLE_CONCRETE_POWDER).add(Items.PURPLE_GLAZED_TERRACOTTA)
.add(Items.PURPLE_SHULKER_BOX).add(Items.PURPLE_STAINED_GLASS).add(Items.PURPLE_STAINED_GLASS_PANE)
.add(Items.PURPLE_TERRACOTTA).add(Items.PURPLE_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.RED_DYED)
.add(Items.RED_BANNER).add(Items.RED_BED).add(Items.RED_CANDLE).add(Items.RED_CARPET)
.add(Items.RED_CONCRETE).add(Items.RED_CONCRETE_POWDER).add(Items.RED_GLAZED_TERRACOTTA)
.add(Items.RED_SHULKER_BOX).add(Items.RED_STAINED_GLASS).add(Items.RED_STAINED_GLASS_PANE)
.add(Items.RED_TERRACOTTA).add(Items.RED_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.WHITE_DYED)
.add(Items.WHITE_BANNER).add(Items.WHITE_BED).add(Items.WHITE_CANDLE).add(Items.WHITE_CARPET)
.add(Items.WHITE_CONCRETE).add(Items.WHITE_CONCRETE_POWDER).add(Items.WHITE_GLAZED_TERRACOTTA)
.add(Items.WHITE_SHULKER_BOX).add(Items.WHITE_STAINED_GLASS).add(Items.WHITE_STAINED_GLASS_PANE)
.add(Items.WHITE_TERRACOTTA).add(Items.WHITE_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.YELLOW_DYED)
.add(Items.YELLOW_BANNER).add(Items.YELLOW_BED).add(Items.YELLOW_CANDLE).add(Items.YELLOW_CARPET)
.add(Items.YELLOW_CONCRETE).add(Items.YELLOW_CONCRETE_POWDER).add(Items.YELLOW_GLAZED_TERRACOTTA)
.add(Items.YELLOW_SHULKER_BOX).add(Items.YELLOW_STAINED_GLASS).add(Items.YELLOW_STAINED_GLASS_PANE)
.add(Items.YELLOW_TERRACOTTA).add(Items.YELLOW_WOOL);
getOrCreateTagBuilder(ConventionalItemTags.DYED)
.addTag(ConventionalItemTags.WHITE_DYED)
.addTag(ConventionalItemTags.ORANGE_DYED)
.addTag(ConventionalItemTags.MAGENTA_DYED)
.addTag(ConventionalItemTags.LIGHT_BLUE_DYED)
.addTag(ConventionalItemTags.YELLOW_DYED)
.addTag(ConventionalItemTags.LIME_DYED)
.addTag(ConventionalItemTags.PINK_DYED)
.addTag(ConventionalItemTags.GRAY_DYED)
.addTag(ConventionalItemTags.LIGHT_GRAY_DYED)
.addTag(ConventionalItemTags.CYAN_DYED)
.addTag(ConventionalItemTags.PURPLE_DYED)
.addTag(ConventionalItemTags.BLUE_DYED)
.addTag(ConventionalItemTags.BROWN_DYED)
.addTag(ConventionalItemTags.GREEN_DYED)
.addTag(ConventionalItemTags.RED_DYED)
.addTag(ConventionalItemTags.BLACK_DYED);
}
private void generateBackwardsCompatTags() {
// Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability.
// TODO: Remove backwards compat tag entries in 1.22
getOrCreateTagBuilder(ConventionalItemTags.WOODEN_BARRELS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "wooden_barrels"));
getOrCreateTagBuilder(ConventionalItemTags.WOODEN_CHESTS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "wooden_chests"));
getOrCreateTagBuilder(ConventionalItemTags.BLACK_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "black_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.BLUE_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "blue_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.BROWN_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "brown_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.GREEN_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "green_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.RED_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "red_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.WHITE_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "white_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.YELLOW_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "yellow_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.LIGHT_BLUE_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "light_blue_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.LIGHT_GRAY_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "light_gray_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.LIME_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "lime_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.MAGENTA_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "magenta_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.ORANGE_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "orange_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.PINK_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "pink_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.CYAN_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "cyan_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.GRAY_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "gray_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.PURPLE_DYES).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "purple_dyes"));
getOrCreateTagBuilder(ConventionalItemTags.IRON_RAW_MATERIALS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "raw_iron_ores"));
getOrCreateTagBuilder(ConventionalItemTags.COPPER_RAW_MATERIALS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "raw_copper_ores"));
getOrCreateTagBuilder(ConventionalItemTags.GOLD_RAW_MATERIALS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "raw_gold_ores"));
getOrCreateTagBuilder(ConventionalItemTags.GLOWSTONE_DUSTS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "glowstone_dusts"));
getOrCreateTagBuilder(ConventionalItemTags.REDSTONE_DUSTS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "redstone_dusts"));
getOrCreateTagBuilder(ConventionalItemTags.DIAMOND_GEMS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "diamonds"));
getOrCreateTagBuilder(ConventionalItemTags.LAPIS_GEMS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "lapis"));
getOrCreateTagBuilder(ConventionalItemTags.EMERALD_GEMS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "emeralds"));
getOrCreateTagBuilder(ConventionalItemTags.QUARTZ_GEMS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "quartz"));
getOrCreateTagBuilder(ConventionalItemTags.SHEARS_TOOLS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "shears"));
getOrCreateTagBuilder(ConventionalItemTags.SPEARS_TOOLS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "spears"));
getOrCreateTagBuilder(ConventionalItemTags.BOWS_TOOLS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "bows"));
getOrCreateTagBuilder(ConventionalItemTags.SHIELDS_TOOLS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "shields"));
getOrCreateTagBuilder(ConventionalItemTags.STRINGS).addOptionalTag(new Identifier(TagUtil.C_TAG_NAMESPACE, "strings"));
}
}

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.impl.tag.convention.datagen.generators;
import java.util.concurrent.CompletableFuture;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.world.gen.structure.Structure;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalStructureTags;
public final class StructureTagGenerator extends FabricTagProvider<Structure> {
public StructureTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
super(output, RegistryKeys.STRUCTURE, completableFuture);
}
@Override
protected void configure(RegistryWrapper.WrapperLookup arg) {
getOrCreateTagBuilder(ConventionalStructureTags.HIDDEN_FROM_DISPLAYERS);
getOrCreateTagBuilder(ConventionalStructureTags.HIDDEN_FROM_LOCATOR_SELECTION);
}
}

View file

@ -1,11 +1,11 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "fabric-convention-tags-v1-datagen", "id": "fabric-convention-tags-v2-datagen",
"name": "Fabric Convention Tags Datagen", "name": "Fabric Convention Tags Datagen",
"version": "1.0.0", "version": "1.0.0",
"environment": "*", "environment": "*",
"license": "Apache-2.0", "license": "Apache-2.0",
"icon": "assets/fabric-convention-tags-v1/icon.png", "icon": "assets/fabric-convention-tags-v2/icon.png",
"contact": { "contact": {
"homepage": "https://fabricmc.net", "homepage": "https://fabricmc.net",
"irc": "irc://irc.esper.net:6667/fabric", "irc": "irc://irc.esper.net:6667/fabric",

View file

@ -0,0 +1,5 @@
{
"values": [
"#c:barrels/wooden"
]
}

Some files were not shown because too many files have changed in this diff Show more