From 619abec242ae6e1e83c5526074eb2eb60ff0920c Mon Sep 17 00:00:00 2001 From: TelepathicGrunt <40846040+TelepathicGrunt@users.noreply.github.com> Date: Tue, 7 May 2024 14:03:18 -0400 Subject: [PATCH] Default English Translations for `c` namespaced tags (#3716) * Created tag translation datagen * generate lang file * Add fruit translation * renamed interface injection * Adjust missing translation message * Fixed for checkStyle * More checkstyle fighting... * Bump version of modules. * Oops wrong module got bumped * moving and renaming files * adjust enum class naming * rename enum and move package * Renamed one more enum * Undo version bump. Will be handled at release * Some suggestions implemented * Added crowdin entry * Update crowdin.yml Co-authored-by: modmuss * Cleanup enum checking * spotless fixes * Added buckets and powder snow bucket tag translation * Some more suggested changes * setup ConventionLogWarnings to match ConventionLogWarningsClient setup * Change property to be usable in prod * Set short as default property * Remove unused import * Fixed copy/paste error * fixed ingot translations * lang and method name fixes * Fixed filepath issue * Fixed redstone name * fixed javadoc whitespace * Move translation warning to server * Move translation class to better file path * trying to pass the regex * put it under impl * Cleanup translation check * Update fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> * Update fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com> * Update fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/api/tag/FabricTagKey.java Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com> * Update fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/api/tag/FabricTagKey.java Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com> --------- Co-authored-by: modmuss Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com> (cherry picked from commit 70fd1b462f02577ccdd27ae0a4a55867001e3111) --- crowdin.yml | 2 + .../tag/convention/ConventionLogWarnings.java | 73 ++-- .../convention/datagen/DatagenEntrypoint.java | 7 + .../generators/EnglishTagLangGenerator.java | 352 ++++++++++++++++++ .../fabric-convention-tags-v2/lang/en_us.json | 300 +++++++++++++++ .../fabricmc/fabric/api/tag/FabricTagKey.java | 78 ++++ .../v2/TranslationConventionLogWarnings.java | 113 ++++++ .../fabric/mixin/tag/TagKeyMixin.java | 27 ++ .../fabric-convention-tags-api-v2.mixins.json | 11 + .../src/main/resources/fabric.mod.json | 14 +- fabric-data-generation-api-v1/build.gradle | 1 + .../v1/provider/FabricLanguageProvider.java | 11 + 12 files changed, 958 insertions(+), 31 deletions(-) create mode 100644 fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/EnglishTagLangGenerator.java create mode 100644 fabric-convention-tags-v2/src/generated/resources/assets/fabric-convention-tags-v2/lang/en_us.json create mode 100644 fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/api/tag/FabricTagKey.java create mode 100644 fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/impl/tag/convention/v2/TranslationConventionLogWarnings.java create mode 100644 fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/mixin/tag/TagKeyMixin.java create mode 100644 fabric-convention-tags-v2/src/main/resources/fabric-convention-tags-api-v2.mixins.json diff --git a/crowdin.yml b/crowdin.yml index 157ce9d75..473c6c23b 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -5,3 +5,5 @@ files: translation: /fabric-item-group-api-v1/src/main/resources/assets/fabric/lang/%locale_with_underscore%.json - source: fabric-registry-sync-v0/src/main/resources/assets/fabric-registry-sync-v0/lang/en_us.json translation: /fabric-registry-sync-v0/src/main/resources/assets/fabric-registry-sync-v0/lang/%locale_with_underscore%.json + - source: fabric-convention-tags-v2/src/generated/resources/assets/fabric-convention-tags-v2/lang/en_us.json + translation: /fabric-convention-tags-v2/src/main/resources/assets/fabric-convention-tags-v2/lang/%locale_with_underscore%.json diff --git a/deprecated/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/impl/tag/convention/ConventionLogWarnings.java b/deprecated/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/impl/tag/convention/ConventionLogWarnings.java index 73a4c3999..314d63a80 100644 --- a/deprecated/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/impl/tag/convention/ConventionLogWarnings.java +++ b/deprecated/fabric-convention-tags-v1/src/main/java/net/fabricmc/fabric/impl/tag/convention/ConventionLogWarnings.java @@ -18,6 +18,7 @@ package net.fabricmc.fabric.impl.tag.convention; import java.util.AbstractMap; import java.util.List; +import java.util.Locale; import java.util.Map; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -42,15 +43,27 @@ 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 { + private static final Logger LOGGER = LoggerFactory.getLogger(ConventionLogWarnings.class); + + private static final LogWarningMode LOG_LEGACY_WARNING_MODE = setupLogWarningModeProperty(); + + private static LogWarningMode setupLogWarningModeProperty() { + String property = System.getProperty("fabric-tag-conventions-v1.legacyTagWarning", LogWarningMode.DEV_SHORT.name()).toUpperCase(Locale.ROOT); + + try { + return LogWarningMode.valueOf(property); + } catch (Exception e) { + LOGGER.error("Unknown entry `{}` for property `fabric-tag-conventions-v1.legacyTagWarning`.", property); + return LogWarningMode.SILENCED; + } + } + + private enum LogWarningMode { 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. @@ -202,7 +215,7 @@ public class ConventionLogWarnings implements ModInitializer { @Override public void onInitialize() { - if (FabricLoader.getInstance().isDevelopmentEnvironment() && !LOG_LEGACY_WARNING_MODE.equalsIgnoreCase(LOG_WARNING_MODES.SILENCED.name())) { + if (FabricLoader.getInstance().isDevelopmentEnvironment() && LOG_LEGACY_WARNING_MODE != LogWarningMode.SILENCED) { setupLegacyTagWarning(); } } @@ -225,31 +238,33 @@ public class ConventionLogWarnings implements ModInitializer { } }); - 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()); + if (legacyTags.isEmpty()) { + return; } + + 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 == LogWarningMode.DEV_VERBOSE; + + 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()); }); } diff --git a/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/DatagenEntrypoint.java b/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/DatagenEntrypoint.java index 6dbd91e7d..19a052184 100644 --- a/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/DatagenEntrypoint.java +++ b/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/DatagenEntrypoint.java @@ -21,6 +21,7 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; import net.fabricmc.fabric.impl.tag.convention.datagen.generators.BiomeTagGenerator; import net.fabricmc.fabric.impl.tag.convention.datagen.generators.BlockTagGenerator; import net.fabricmc.fabric.impl.tag.convention.datagen.generators.EnchantmentTagGenerator; +import net.fabricmc.fabric.impl.tag.convention.datagen.generators.EnglishTagLangGenerator; 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.ItemTagGenerator; @@ -38,5 +39,11 @@ public class DatagenEntrypoint implements DataGeneratorEntrypoint { pack.addProvider(BiomeTagGenerator::new); pack.addProvider(StructureTagGenerator::new); pack.addProvider(EntityTypeTagGenerator::new); + pack.addProvider(EnglishTagLangGenerator::new); + } + + @Override + public String getEffectiveModId() { + return "fabric-convention-tags-v2"; } } diff --git a/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/EnglishTagLangGenerator.java b/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/EnglishTagLangGenerator.java new file mode 100644 index 000000000..aa5897d3a --- /dev/null +++ b/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/EnglishTagLangGenerator.java @@ -0,0 +1,352 @@ +/* + * 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.RegistryWrapper; + +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider; +import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags; +import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags; +import net.fabricmc.fabric.api.tag.convention.v2.ConventionalEnchantmentTags; +import net.fabricmc.fabric.api.tag.convention.v2.ConventionalEntityTypeTags; +import net.fabricmc.fabric.api.tag.convention.v2.ConventionalFluidTags; +import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags; +import net.fabricmc.fabric.api.tag.convention.v2.ConventionalStructureTags; + +public class EnglishTagLangGenerator extends FabricLanguageProvider { + public EnglishTagLangGenerator(FabricDataOutput output, CompletableFuture registryLookup) { + super(output, registryLookup); + } + + @Override + public void generateTranslations(RegistryWrapper.WrapperLookup registryLookup, TranslationBuilder translationBuilder) { + // Blocks + translationBuilder.add(ConventionalBlockTags.STONES, "Stones"); + translationBuilder.add(ConventionalBlockTags.COBBLESTONES, "Cobblestones"); + translationBuilder.add(ConventionalBlockTags.ORES, "Ores"); + translationBuilder.add(ConventionalBlockTags.QUARTZ_ORES, "Quartz Ores"); + translationBuilder.add(ConventionalBlockTags.NETHERITE_SCRAP_ORES, "Netherite Scrap Ores"); + translationBuilder.add(ConventionalBlockTags.BARRELS, "Barrels"); + translationBuilder.add(ConventionalBlockTags.WOODEN_BARRELS, "Wooden Barrels"); + translationBuilder.add(ConventionalBlockTags.BOOKSHELVES, "Bookshelves"); + translationBuilder.add(ConventionalBlockTags.CHESTS, "Chests"); + translationBuilder.add(ConventionalBlockTags.WOODEN_CHESTS, "Wooden Chests"); + translationBuilder.add(ConventionalBlockTags.GLASS_BLOCKS, "Glass Blocks"); + translationBuilder.add(ConventionalBlockTags.GLASS_PANES, "Glass Panes"); + translationBuilder.add(ConventionalBlockTags.SHULKER_BOXES, "Shulker Boxes"); + translationBuilder.add(ConventionalBlockTags.BUDDING_BLOCKS, "Budding Blocks"); + translationBuilder.add(ConventionalBlockTags.BUDS, "Buds"); + translationBuilder.add(ConventionalBlockTags.CLUSTERS, "Clusters"); + translationBuilder.add(ConventionalBlockTags.VILLAGER_JOB_SITES, "Villager Job Sites"); + translationBuilder.add(ConventionalBlockTags.SANDSTONE_BLOCKS, "Sandstone Blocks"); + translationBuilder.add(ConventionalBlockTags.SANDSTONE_SLABS, "Sandstone Slabs"); + translationBuilder.add(ConventionalBlockTags.SANDSTONE_STAIRS, "Sandstone Stairs"); + translationBuilder.add(ConventionalBlockTags.RED_SANDSTONE_BLOCKS, "Red Sandstone Blocks"); + translationBuilder.add(ConventionalBlockTags.RED_SANDSTONE_SLABS, "Red Sandstone Slabs"); + translationBuilder.add(ConventionalBlockTags.RED_SANDSTONE_STAIRS, "Red Sandstone Stairs"); + translationBuilder.add(ConventionalBlockTags.UNCOLORED_SANDSTONE_BLOCKS, "Uncolored Sandstone Blocks"); + translationBuilder.add(ConventionalBlockTags.UNCOLORED_SANDSTONE_SLABS, "Uncolored Sandstone Slabs"); + translationBuilder.add(ConventionalBlockTags.UNCOLORED_SANDSTONE_STAIRS, "Uncolored Sandstone Stairs"); + translationBuilder.add(ConventionalBlockTags.DYED, "Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.BLACK_DYED, "Black Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.BLUE_DYED, "Blue Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.BROWN_DYED, "Brown Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.CYAN_DYED, "Cyan Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.GRAY_DYED, "Gray Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.GREEN_DYED, "Green Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.LIGHT_BLUE_DYED, "Light Blue Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.LIGHT_GRAY_DYED, "Light Gray Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.LIME_DYED, "Lime Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.MAGENTA_DYED, "Magenta Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.ORANGE_DYED, "Orange Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.PINK_DYED, "Pink Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.PURPLE_DYED, "Purple Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.RED_DYED, "Red Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.WHITE_DYED, "White Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.YELLOW_DYED, "Yellow Dyed Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS, "Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_BONE_MEAL, "Bone Meal Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_COAL, "Coal Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_COPPER, "Copper Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_DIAMOND, "Diamond Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_DRIED_KELP, "Dried Kelp Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_EMERALD, "Emerald Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_GOLD, "Gold Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_IRON, "Iron Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_LAPIS, "Lapis Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_NETHERITE, "Netherite Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_RAW_COPPER, "Raw Copper Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_RAW_GOLD, "Raw Gold Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_RAW_IRON, "Raw Iron Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_REDSTONE, "Redstone Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_SLIME, "Slime Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.STORAGE_BLOCKS_WHEAT, "Wheat Storage Blocks"); + translationBuilder.add(ConventionalBlockTags.PLAYER_WORKSTATIONS_CRAFTING_TABLES, "Crafting Tables"); + translationBuilder.add(ConventionalBlockTags.PLAYER_WORKSTATIONS_FURNACES, "Furnaces"); + translationBuilder.add(ConventionalBlockTags.RELOCATION_NOT_SUPPORTED, "Relocation Not Supported"); + translationBuilder.add(ConventionalBlockTags.SKULLS, "Skulls"); + translationBuilder.add(ConventionalBlockTags.ROPES, "Ropes"); + translationBuilder.add(ConventionalBlockTags.CHAINS, "Chains"); + translationBuilder.add(ConventionalBlockTags.HIDDEN_FROM_RECIPE_VIEWERS, "Hidden From Recipe Viewers"); + + // Items + translationBuilder.add(ConventionalItemTags.STONES, "Stones"); + translationBuilder.add(ConventionalItemTags.COBBLESTONES, "Cobblestones"); + translationBuilder.add(ConventionalItemTags.TOOLS, "Tools"); + translationBuilder.add(ConventionalItemTags.SHEARS_TOOLS, "Shears"); + translationBuilder.add(ConventionalItemTags.SPEARS_TOOLS, "Spears"); + translationBuilder.add(ConventionalItemTags.BOWS_TOOLS, "Bows"); + translationBuilder.add(ConventionalItemTags.CROSSBOWS_TOOLS, "Crossbows"); + translationBuilder.add(ConventionalItemTags.SHIELDS_TOOLS, "Shields"); + translationBuilder.add(ConventionalItemTags.FISHING_RODS_TOOLS, "Fishing Rods"); + translationBuilder.add(ConventionalItemTags.BRUSHES_TOOLS, "Brushes"); + translationBuilder.add(ConventionalItemTags.MELEE_WEAPONS_TOOLS, "Melee Weapons"); + translationBuilder.add(ConventionalItemTags.RANGED_WEAPONS_TOOLS, "Ranged Weapons"); + translationBuilder.add(ConventionalItemTags.MINING_TOOLS, "Mining Tools"); + translationBuilder.add(ConventionalItemTags.ARMORS, "Armors"); + translationBuilder.add(ConventionalItemTags.ENCHANTABLES, "Enchantables"); + translationBuilder.add(ConventionalItemTags.BRICKS, "Bricks"); + translationBuilder.add(ConventionalItemTags.DUSTS, "Dusts"); + translationBuilder.add(ConventionalItemTags.GEMS, "Gems"); + translationBuilder.add(ConventionalItemTags.INGOTS, "Ingots"); + translationBuilder.add(ConventionalItemTags.NUGGETS, "Nuggets"); + translationBuilder.add(ConventionalItemTags.ORES, "Ores"); + translationBuilder.add(ConventionalItemTags.RAW_MATERIALS, "Raw Materials"); + translationBuilder.add(ConventionalItemTags.RAW_BLOCKS, "Raw Blocks"); + translationBuilder.add(ConventionalItemTags.IRON_RAW_MATERIALS, "Raw Iron Materials"); + translationBuilder.add(ConventionalItemTags.GOLD_RAW_MATERIALS, "Raw Gold Materials"); + translationBuilder.add(ConventionalItemTags.COPPER_RAW_MATERIALS, "Raw Copper Materials"); + translationBuilder.add(ConventionalItemTags.IRON_RAW_BLOCKS, "Raw Iron Blocks"); + translationBuilder.add(ConventionalItemTags.GOLD_RAW_BLOCKS, "Raw Gold Blocks"); + translationBuilder.add(ConventionalItemTags.COPPER_RAW_BLOCKS, "Raw Copper Blocks"); + translationBuilder.add(ConventionalItemTags.NORMAL_BRICKS, "Bricks"); + translationBuilder.add(ConventionalItemTags.NETHER_BRICKS, "Nether Bricks"); + translationBuilder.add(ConventionalItemTags.IRON_INGOTS, "Iron Ingots"); + translationBuilder.add(ConventionalItemTags.GOLD_INGOTS, "Gold Ingots"); + translationBuilder.add(ConventionalItemTags.COPPER_INGOTS, "Copper Ingots"); + translationBuilder.add(ConventionalItemTags.NETHERITE_INGOTS, "Netherite Ingots"); + translationBuilder.add(ConventionalItemTags.NETHERITE_SCRAP_ORES, "Netherite Scrap Ores"); + translationBuilder.add(ConventionalItemTags.QUARTZ_ORES, "Quartz Ores"); + translationBuilder.add(ConventionalItemTags.QUARTZ_GEMS, "Quartz Gems"); + translationBuilder.add(ConventionalItemTags.LAPIS_GEMS, "Lapis Gems"); + translationBuilder.add(ConventionalItemTags.DIAMOND_GEMS, "Diamond Gems"); + translationBuilder.add(ConventionalItemTags.AMETHYST_GEMS, "Amethyst Gems"); + translationBuilder.add(ConventionalItemTags.EMERALD_GEMS, "Emerald Gems"); + translationBuilder.add(ConventionalItemTags.PRISMARINE_GEMS, "Prismarine Gems"); + translationBuilder.add(ConventionalItemTags.REDSTONE_DUSTS, "Redstone Dusts"); + translationBuilder.add(ConventionalItemTags.GLOWSTONE_DUSTS, "Glowstone Dusts"); + translationBuilder.add(ConventionalItemTags.COAL, "Coal"); + translationBuilder.add(ConventionalItemTags.POTIONS, "Potions"); + translationBuilder.add(ConventionalItemTags.FOODS, "Foods"); + translationBuilder.add(ConventionalItemTags.FRUITS_FOODS, "Fruits"); + translationBuilder.add(ConventionalItemTags.VEGETABLES_FOODS, "Vegetables"); + translationBuilder.add(ConventionalItemTags.BERRIES_FOODS, "Berries"); + translationBuilder.add(ConventionalItemTags.BREADS_FOODS, "Breads"); + translationBuilder.add(ConventionalItemTags.COOKIES_FOODS, "Cookies"); + translationBuilder.add(ConventionalItemTags.RAW_MEATS_FOODS, "Raw Meats"); + translationBuilder.add(ConventionalItemTags.COOKED_MEATS_FOODS, "Cooked Meats"); + translationBuilder.add(ConventionalItemTags.RAW_FISHES_FOODS, "Raw Fishes"); + translationBuilder.add(ConventionalItemTags.COOKED_FISHES_FOODS, "Cooked Fishes"); + translationBuilder.add(ConventionalItemTags.SOUPS_FOODS, "Soups"); + translationBuilder.add(ConventionalItemTags.CANDIES_FOODS, "Candies"); + translationBuilder.add(ConventionalItemTags.EDIBLE_WHEN_PLACED_FOODS, "Edible When Placed"); + translationBuilder.add(ConventionalItemTags.FOOD_POISONING_FOODS, "Food Poisoning"); + translationBuilder.add(ConventionalItemTags.BUCKETS, "Buckets"); + translationBuilder.add(ConventionalItemTags.WATER_BUCKETS, "Water Buckets"); + translationBuilder.add(ConventionalItemTags.ENTITY_WATER_BUCKETS, "Entity Water Buckets"); + translationBuilder.add(ConventionalItemTags.LAVA_BUCKETS, "Lava Buckets"); + translationBuilder.add(ConventionalItemTags.MILK_BUCKETS, "Milk Buckets"); + translationBuilder.add(ConventionalItemTags.POWDER_SNOW_BUCKETS, "Powder Snow Buckets"); + translationBuilder.add(ConventionalItemTags.EMPTY_BUCKETS, "Empty Buckets"); + translationBuilder.add(ConventionalItemTags.BARRELS, "Barrels"); + translationBuilder.add(ConventionalItemTags.WOODEN_BARRELS, "Wooden Barrels"); + translationBuilder.add(ConventionalItemTags.BOOKSHELVES, "Bookshelves"); + translationBuilder.add(ConventionalItemTags.CHESTS, "Chests"); + translationBuilder.add(ConventionalItemTags.WOODEN_CHESTS, "Wooden Chests"); + translationBuilder.add(ConventionalItemTags.GLASS_BLOCKS, "Glass Blocks"); + translationBuilder.add(ConventionalItemTags.GLASS_PANES, "Glass Panes"); + translationBuilder.add(ConventionalItemTags.SHULKER_BOXES, "Shulker Boxes"); + translationBuilder.add(ConventionalItemTags.BUDDING_BLOCKS, "Budding Blocks"); + translationBuilder.add(ConventionalItemTags.BUDS, "Buds"); + translationBuilder.add(ConventionalItemTags.CLUSTERS, "Clusters"); + translationBuilder.add(ConventionalItemTags.VILLAGER_JOB_SITES, "Villager Job Sites"); + translationBuilder.add(ConventionalItemTags.SANDSTONE_BLOCKS, "Sandstone Blocks"); + translationBuilder.add(ConventionalItemTags.SANDSTONE_SLABS, "Sandstone Slabs"); + translationBuilder.add(ConventionalItemTags.SANDSTONE_STAIRS, "Sandstone Stairs"); + translationBuilder.add(ConventionalItemTags.RED_SANDSTONE_BLOCKS, "Red Sandstone Blocks"); + translationBuilder.add(ConventionalItemTags.RED_SANDSTONE_SLABS, "Red Sandstone Slabs"); + translationBuilder.add(ConventionalItemTags.RED_SANDSTONE_STAIRS, "Red Sandstone Stairs"); + translationBuilder.add(ConventionalItemTags.UNCOLORED_SANDSTONE_BLOCKS, "Uncolored Sandstone Blocks"); + translationBuilder.add(ConventionalItemTags.UNCOLORED_SANDSTONE_SLABS, "Uncolored Sandstone Slabs"); + translationBuilder.add(ConventionalItemTags.UNCOLORED_SANDSTONE_STAIRS, "Uncolored Sandstone Stairs"); + translationBuilder.add(ConventionalItemTags.DYES, "Dyes"); + translationBuilder.add(ConventionalItemTags.BLACK_DYES, "Black Dyes"); + translationBuilder.add(ConventionalItemTags.BLUE_DYES, "Blue Dyes"); + translationBuilder.add(ConventionalItemTags.BROWN_DYES, "Brown Dyes"); + translationBuilder.add(ConventionalItemTags.CYAN_DYES, "Cyan Dyes"); + translationBuilder.add(ConventionalItemTags.GRAY_DYES, "Gray Dyes"); + translationBuilder.add(ConventionalItemTags.GREEN_DYES, "Green Dyes"); + translationBuilder.add(ConventionalItemTags.LIGHT_BLUE_DYES, "Light Blue Dyes"); + translationBuilder.add(ConventionalItemTags.LIGHT_GRAY_DYES, "Light Gray Dyes"); + translationBuilder.add(ConventionalItemTags.LIME_DYES, "Lime Dyes"); + translationBuilder.add(ConventionalItemTags.MAGENTA_DYES, "Magenta Dyes"); + translationBuilder.add(ConventionalItemTags.ORANGE_DYES, "Orange Dyes"); + translationBuilder.add(ConventionalItemTags.PINK_DYES, "Pink Dyes"); + translationBuilder.add(ConventionalItemTags.PURPLE_DYES, "Purple Dyes"); + translationBuilder.add(ConventionalItemTags.RED_DYES, "Red Dyes"); + translationBuilder.add(ConventionalItemTags.WHITE_DYES, "White Dyes"); + translationBuilder.add(ConventionalItemTags.YELLOW_DYES, "Yellow Dyes"); + translationBuilder.add(ConventionalItemTags.DYED, "Dyed Items"); + translationBuilder.add(ConventionalItemTags.BLACK_DYED, "Black Dyed Items"); + translationBuilder.add(ConventionalItemTags.BLUE_DYED, "Blue Dyed Items"); + translationBuilder.add(ConventionalItemTags.BROWN_DYED, "Brown Dyed Items"); + translationBuilder.add(ConventionalItemTags.CYAN_DYED, "Cyan Dyed Items"); + translationBuilder.add(ConventionalItemTags.GRAY_DYED, "Gray Dyed Items"); + translationBuilder.add(ConventionalItemTags.GREEN_DYED, "Green Dyed Items"); + translationBuilder.add(ConventionalItemTags.LIGHT_BLUE_DYED, "Light Blue Dyed Items"); + translationBuilder.add(ConventionalItemTags.LIGHT_GRAY_DYED, "Light Gray Dyed Items"); + translationBuilder.add(ConventionalItemTags.LIME_DYED, "Lime Dyed Items"); + translationBuilder.add(ConventionalItemTags.MAGENTA_DYED, "Magenta Dyed Items"); + translationBuilder.add(ConventionalItemTags.ORANGE_DYED, "Orange Dyed Items"); + translationBuilder.add(ConventionalItemTags.PINK_DYED, "Pink Dyed Items"); + translationBuilder.add(ConventionalItemTags.PURPLE_DYED, "Purple Dyed Items"); + translationBuilder.add(ConventionalItemTags.RED_DYED, "Red Dyed Items"); + translationBuilder.add(ConventionalItemTags.WHITE_DYED, "White Dyed Items"); + translationBuilder.add(ConventionalItemTags.YELLOW_DYED, "Yellow Dyed Items"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS, "Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_BONE_MEAL, "Bone Meal Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_COAL, "Coal Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_COPPER, "Copper Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_DIAMOND, "Diamond Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_DRIED_KELP, "Dried Kelp Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_EMERALD, "Emerald Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_GOLD, "Gold Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_IRON, "Iron Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_LAPIS, "Lapis Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_NETHERITE, "Netherite Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_RAW_COPPER, "Raw Copper Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_RAW_GOLD, "Raw Gold Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_RAW_IRON, "Raw Iron Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_REDSTONE, "Redstone Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_SLIME, "Slime Storage Blocks"); + translationBuilder.add(ConventionalItemTags.STORAGE_BLOCKS_WHEAT, "Wheat Storage Blocks"); + translationBuilder.add(ConventionalItemTags.PLAYER_WORKSTATIONS_CRAFTING_TABLES, "Crafting Tables"); + translationBuilder.add(ConventionalItemTags.PLAYER_WORKSTATIONS_FURNACES, "Furnaces"); + translationBuilder.add(ConventionalItemTags.STRINGS, "Strings"); + translationBuilder.add(ConventionalItemTags.RODS, "Rods"); + translationBuilder.add(ConventionalItemTags.WOODEN_RODS, "Wooden Rods"); + translationBuilder.add(ConventionalItemTags.BLAZE_RODS, "Blaze Rods"); + translationBuilder.add(ConventionalItemTags.BREEZE_RODS, "Breeze Rods"); + translationBuilder.add(ConventionalItemTags.ROPES, "Ropes"); + translationBuilder.add(ConventionalItemTags.CHAINS, "Chains"); + translationBuilder.add(ConventionalItemTags.HIDDEN_FROM_RECIPE_VIEWERS, "Hidden From Recipe Viewers"); + + // Enchantments + translationBuilder.add(ConventionalEnchantmentTags.INCREASE_BLOCK_DROPS, "Increases Block Drops"); + translationBuilder.add(ConventionalEnchantmentTags.INCREASE_ENTITY_DROPS, "Increases Entity Drops"); + translationBuilder.add(ConventionalEnchantmentTags.WEAPON_DAMAGE_ENHANCEMENTS, "Weapon Damage Enhancements"); + translationBuilder.add(ConventionalEnchantmentTags.ENTITY_SPEED_ENHANCEMENTS, "Entity Speed Enhancements"); + translationBuilder.add(ConventionalEnchantmentTags.ENTITY_AUXILIARY_MOVEMENT_ENHANCEMENTS, "Entity Auxiliary Movement Enhancements"); + translationBuilder.add(ConventionalEnchantmentTags.ENTITY_DEFENSE_ENHANCEMENTS, "Entity Defense Enhancements"); + + // Entity Types + translationBuilder.add(ConventionalEntityTypeTags.BOSSES, "Bosses"); + translationBuilder.add(ConventionalEntityTypeTags.MINECARTS, "Minecarts"); + translationBuilder.add(ConventionalEntityTypeTags.BOATS, "Boats"); + translationBuilder.add(ConventionalEntityTypeTags.CAPTURING_NOT_SUPPORTED, "Capturing Not Supported"); + translationBuilder.add(ConventionalEntityTypeTags.TELEPORTING_NOT_SUPPORTED, "Teleporting Not Supported"); + + // Fluids + translationBuilder.add(ConventionalFluidTags.LAVA, "Lava"); + translationBuilder.add(ConventionalFluidTags.WATER, "Water"); + translationBuilder.add(ConventionalFluidTags.MILK, "Milk"); + translationBuilder.add(ConventionalFluidTags.HONEY, "Honey"); + translationBuilder.add(ConventionalFluidTags.HIDDEN_FROM_RECIPE_VIEWERS, "Hidden From Recipe Viewers"); + + // Structures + translationBuilder.add(ConventionalStructureTags.HIDDEN_FROM_DISPLAYERS, "Hidden From Displayers"); + translationBuilder.add(ConventionalStructureTags.HIDDEN_FROM_LOCATOR_SELECTION, "Hidden From Locator Selection"); + + // Biomes + translationBuilder.add(ConventionalBiomeTags.NO_DEFAULT_MONSTERS, "No Default Monsters"); + translationBuilder.add(ConventionalBiomeTags.HIDDEN_FROM_LOCATOR_SELECTION, "Hidden From Locator Selection"); + translationBuilder.add(ConventionalBiomeTags.IS_VOID, "Void"); + translationBuilder.add(ConventionalBiomeTags.IS_OVERWORLD, "Overworld"); + translationBuilder.add(ConventionalBiomeTags.IS_HOT, "Hot"); + translationBuilder.add(ConventionalBiomeTags.IS_HOT_OVERWORLD, "Hot Overworld"); + translationBuilder.add(ConventionalBiomeTags.IS_HOT_NETHER, "Hot Nether"); + translationBuilder.add(ConventionalBiomeTags.IS_TEMPERATE, "Temperate"); + translationBuilder.add(ConventionalBiomeTags.IS_TEMPERATE_OVERWORLD, "Temperate Overworld"); + translationBuilder.add(ConventionalBiomeTags.IS_COLD, "Cold"); + translationBuilder.add(ConventionalBiomeTags.IS_COLD_OVERWORLD, "Cold Overworld"); + translationBuilder.add(ConventionalBiomeTags.IS_COLD_END, "Cold End"); + translationBuilder.add(ConventionalBiomeTags.IS_WET, "Wet"); + translationBuilder.add(ConventionalBiomeTags.IS_WET_OVERWORLD, "Wet Overworld"); + translationBuilder.add(ConventionalBiomeTags.IS_DRY, "Dry"); + translationBuilder.add(ConventionalBiomeTags.IS_DRY_OVERWORLD, "Dry Overworld"); + translationBuilder.add(ConventionalBiomeTags.IS_DRY_NETHER, "Dry Nether"); + translationBuilder.add(ConventionalBiomeTags.IS_DRY_END, "Dry End"); + translationBuilder.add(ConventionalBiomeTags.IS_VEGETATION_SPARSE, "Sparse Vegetation"); + translationBuilder.add(ConventionalBiomeTags.IS_VEGETATION_SPARSE_OVERWORLD, "Sparse Overworld Vegetation"); + translationBuilder.add(ConventionalBiomeTags.IS_VEGETATION_DENSE, "Dense Vegetation"); + translationBuilder.add(ConventionalBiomeTags.IS_VEGETATION_DENSE_OVERWORLD, "Dense Overworld Vegetation"); + translationBuilder.add(ConventionalBiomeTags.IS_CONIFEROUS_TREE, "Coniferous Tree"); + translationBuilder.add(ConventionalBiomeTags.IS_SAVANNA_TREE, "Savanna Tree"); + translationBuilder.add(ConventionalBiomeTags.IS_JUNGLE_TREE, "Jungle Tree"); + translationBuilder.add(ConventionalBiomeTags.IS_DECIDUOUS_TREE, "Deciduous Tree"); + translationBuilder.add(ConventionalBiomeTags.IS_MOUNTAIN, "Mountain"); + translationBuilder.add(ConventionalBiomeTags.IS_MOUNTAIN_PEAK, "Mountain Peak"); + translationBuilder.add(ConventionalBiomeTags.IS_MOUNTAIN_SLOPE, "Mountain Slope"); + translationBuilder.add(ConventionalBiomeTags.IS_PLAINS, "Plains"); + translationBuilder.add(ConventionalBiomeTags.IS_SNOWY_PLAINS, "Snowy Plains"); + translationBuilder.add(ConventionalBiomeTags.IS_FOREST, "Forest"); + translationBuilder.add(ConventionalBiomeTags.IS_BIRCH_FOREST, "Birch Forest"); + translationBuilder.add(ConventionalBiomeTags.IS_FLOWER_FOREST, "Flower Forest"); + translationBuilder.add(ConventionalBiomeTags.IS_TAIGA, "Taiga"); + translationBuilder.add(ConventionalBiomeTags.IS_OLD_GROWTH, "Old Growth"); + translationBuilder.add(ConventionalBiomeTags.IS_HILL, "Hills"); + translationBuilder.add(ConventionalBiomeTags.IS_WINDSWEPT, "Windswept"); + translationBuilder.add(ConventionalBiomeTags.IS_JUNGLE, "Jungle"); + translationBuilder.add(ConventionalBiomeTags.IS_SAVANNA, "Savanna"); + translationBuilder.add(ConventionalBiomeTags.IS_SWAMP, "Swamp"); + translationBuilder.add(ConventionalBiomeTags.IS_DESERT, "Desert"); + translationBuilder.add(ConventionalBiomeTags.IS_BADLANDS, "Badlands"); + translationBuilder.add(ConventionalBiomeTags.IS_BEACH, "Beach"); + translationBuilder.add(ConventionalBiomeTags.IS_STONY_SHORES, "Stony Shores"); + translationBuilder.add(ConventionalBiomeTags.IS_MUSHROOM, "Mushroom"); + translationBuilder.add(ConventionalBiomeTags.IS_RIVER, "River"); + translationBuilder.add(ConventionalBiomeTags.IS_OCEAN, "Ocean"); + translationBuilder.add(ConventionalBiomeTags.IS_DEEP_OCEAN, "Deep Ocean"); + translationBuilder.add(ConventionalBiomeTags.IS_SHALLOW_OCEAN, "Shallow Ocean"); + translationBuilder.add(ConventionalBiomeTags.IS_UNDERGROUND, "Underground"); + translationBuilder.add(ConventionalBiomeTags.IS_CAVE, "Cave"); + translationBuilder.add(ConventionalBiomeTags.IS_WASTELAND, "Wasteland"); + translationBuilder.add(ConventionalBiomeTags.IS_DEAD, "Dead"); + translationBuilder.add(ConventionalBiomeTags.IS_FLORAL, "Floral"); + translationBuilder.add(ConventionalBiomeTags.IS_SNOWY, "Snowy"); + translationBuilder.add(ConventionalBiomeTags.IS_ICY, "Icy"); + translationBuilder.add(ConventionalBiomeTags.IS_AQUATIC, "Aquatic"); + translationBuilder.add(ConventionalBiomeTags.IS_AQUATIC_ICY, "Icy Aquatic"); + translationBuilder.add(ConventionalBiomeTags.IS_NETHER, "Nether"); + translationBuilder.add(ConventionalBiomeTags.IS_NETHER_FOREST, "Nether Forest"); + translationBuilder.add(ConventionalBiomeTags.IS_END, "The End"); + translationBuilder.add(ConventionalBiomeTags.IS_OUTER_END_ISLAND, "Outer End Island"); + } +} diff --git a/fabric-convention-tags-v2/src/generated/resources/assets/fabric-convention-tags-v2/lang/en_us.json b/fabric-convention-tags-v2/src/generated/resources/assets/fabric-convention-tags-v2/lang/en_us.json new file mode 100644 index 000000000..8a7931513 --- /dev/null +++ b/fabric-convention-tags-v2/src/generated/resources/assets/fabric-convention-tags-v2/lang/en_us.json @@ -0,0 +1,300 @@ +{ + "tag.block.c.barrels": "Barrels", + "tag.block.c.barrels.wooden": "Wooden Barrels", + "tag.block.c.bookshelves": "Bookshelves", + "tag.block.c.budding_blocks": "Budding Blocks", + "tag.block.c.buds": "Buds", + "tag.block.c.chains": "Chains", + "tag.block.c.chests": "Chests", + "tag.block.c.chests.wooden": "Wooden Chests", + "tag.block.c.clusters": "Clusters", + "tag.block.c.cobblestones": "Cobblestones", + "tag.block.c.dyed": "Dyed Blocks", + "tag.block.c.dyed.black": "Black Dyed Blocks", + "tag.block.c.dyed.blue": "Blue Dyed Blocks", + "tag.block.c.dyed.brown": "Brown Dyed Blocks", + "tag.block.c.dyed.cyan": "Cyan Dyed Blocks", + "tag.block.c.dyed.gray": "Gray Dyed Blocks", + "tag.block.c.dyed.green": "Green Dyed Blocks", + "tag.block.c.dyed.light_blue": "Light Blue Dyed Blocks", + "tag.block.c.dyed.light_gray": "Light Gray Dyed Blocks", + "tag.block.c.dyed.lime": "Lime Dyed Blocks", + "tag.block.c.dyed.magenta": "Magenta Dyed Blocks", + "tag.block.c.dyed.orange": "Orange Dyed Blocks", + "tag.block.c.dyed.pink": "Pink Dyed Blocks", + "tag.block.c.dyed.purple": "Purple Dyed Blocks", + "tag.block.c.dyed.red": "Red Dyed Blocks", + "tag.block.c.dyed.white": "White Dyed Blocks", + "tag.block.c.dyed.yellow": "Yellow Dyed Blocks", + "tag.block.c.glass_blocks": "Glass Blocks", + "tag.block.c.glass_panes": "Glass Panes", + "tag.block.c.hidden_from_recipe_viewers": "Hidden From Recipe Viewers", + "tag.block.c.ores": "Ores", + "tag.block.c.ores.netherite_scrap": "Netherite Scrap Ores", + "tag.block.c.ores.quartz": "Quartz Ores", + "tag.block.c.player_workstations.crafting_tables": "Crafting Tables", + "tag.block.c.player_workstations.furnaces": "Furnaces", + "tag.block.c.relocation_not_supported": "Relocation Not Supported", + "tag.block.c.ropes": "Ropes", + "tag.block.c.sandstone.blocks": "Sandstone Blocks", + "tag.block.c.sandstone.red_blocks": "Red Sandstone Blocks", + "tag.block.c.sandstone.red_slabs": "Red Sandstone Slabs", + "tag.block.c.sandstone.red_stairs": "Red Sandstone Stairs", + "tag.block.c.sandstone.slabs": "Sandstone Slabs", + "tag.block.c.sandstone.stairs": "Sandstone Stairs", + "tag.block.c.sandstone.uncolored_blocks": "Uncolored Sandstone Blocks", + "tag.block.c.sandstone.uncolored_slabs": "Uncolored Sandstone Slabs", + "tag.block.c.sandstone.uncolored_stairs": "Uncolored Sandstone Stairs", + "tag.block.c.shulker_boxes": "Shulker Boxes", + "tag.block.c.skulls": "Skulls", + "tag.block.c.stones": "Stones", + "tag.block.c.storage_blocks": "Storage Blocks", + "tag.block.c.storage_blocks.bone_meal": "Bone Meal Storage Blocks", + "tag.block.c.storage_blocks.coal": "Coal Storage Blocks", + "tag.block.c.storage_blocks.copper": "Copper Storage Blocks", + "tag.block.c.storage_blocks.diamond": "Diamond Storage Blocks", + "tag.block.c.storage_blocks.dried_kelp": "Dried Kelp Storage Blocks", + "tag.block.c.storage_blocks.emerald": "Emerald Storage Blocks", + "tag.block.c.storage_blocks.gold": "Gold Storage Blocks", + "tag.block.c.storage_blocks.iron": "Iron Storage Blocks", + "tag.block.c.storage_blocks.lapis": "Lapis Storage Blocks", + "tag.block.c.storage_blocks.netherite": "Netherite Storage Blocks", + "tag.block.c.storage_blocks.raw_copper": "Raw Copper Storage Blocks", + "tag.block.c.storage_blocks.raw_gold": "Raw Gold Storage Blocks", + "tag.block.c.storage_blocks.raw_iron": "Raw Iron Storage Blocks", + "tag.block.c.storage_blocks.redstone": "Redstone Storage Blocks", + "tag.block.c.storage_blocks.slime": "Slime Storage Blocks", + "tag.block.c.storage_blocks.wheat": "Wheat Storage Blocks", + "tag.block.c.villager_job_sites": "Villager Job Sites", + "tag.enchantment.c.entity_auxiliary_movement_enhancements": "Entity Auxiliary Movement Enhancements", + "tag.enchantment.c.entity_defense_enhancements": "Entity Defense Enhancements", + "tag.enchantment.c.entity_speed_enhancements": "Entity Speed Enhancements", + "tag.enchantment.c.increase_block_drops": "Increases Block Drops", + "tag.enchantment.c.increase_entity_drops": "Increases Entity Drops", + "tag.enchantment.c.weapon_damage_enhancements": "Weapon Damage Enhancements", + "tag.entity_type.c.boats": "Boats", + "tag.entity_type.c.bosses": "Bosses", + "tag.entity_type.c.capturing_not_supported": "Capturing Not Supported", + "tag.entity_type.c.minecarts": "Minecarts", + "tag.entity_type.c.teleporting_not_supported": "Teleporting Not Supported", + "tag.fluid.c.hidden_from_recipe_viewers": "Hidden From Recipe Viewers", + "tag.fluid.c.honey": "Honey", + "tag.fluid.c.lava": "Lava", + "tag.fluid.c.milk": "Milk", + "tag.fluid.c.water": "Water", + "tag.item.c.armors": "Armors", + "tag.item.c.barrels": "Barrels", + "tag.item.c.barrels.wooden": "Wooden Barrels", + "tag.item.c.bookshelves": "Bookshelves", + "tag.item.c.bricks": "Bricks", + "tag.item.c.bricks.nether": "Nether Bricks", + "tag.item.c.bricks.normal": "Bricks", + "tag.item.c.buckets": "Buckets", + "tag.item.c.buckets.empty": "Empty Buckets", + "tag.item.c.buckets.entity_water": "Entity Water Buckets", + "tag.item.c.buckets.lava": "Lava Buckets", + "tag.item.c.buckets.milk": "Milk Buckets", + "tag.item.c.buckets.powder_snow": "Powder Snow Buckets", + "tag.item.c.buckets.water": "Water Buckets", + "tag.item.c.budding_blocks": "Budding Blocks", + "tag.item.c.buds": "Buds", + "tag.item.c.chains": "Chains", + "tag.item.c.chests": "Chests", + "tag.item.c.chests.wooden": "Wooden Chests", + "tag.item.c.clusters": "Clusters", + "tag.item.c.coal": "Coal", + "tag.item.c.cobblestones": "Cobblestones", + "tag.item.c.dusts": "Dusts", + "tag.item.c.dusts.glowstone": "Glowstone Dusts", + "tag.item.c.dusts.redstone": "Redstone Dusts", + "tag.item.c.dyed": "Dyed Items", + "tag.item.c.dyed.black": "Black Dyed Items", + "tag.item.c.dyed.blue": "Blue Dyed Items", + "tag.item.c.dyed.brown": "Brown Dyed Items", + "tag.item.c.dyed.cyan": "Cyan Dyed Items", + "tag.item.c.dyed.gray": "Gray Dyed Items", + "tag.item.c.dyed.green": "Green Dyed Items", + "tag.item.c.dyed.light_blue": "Light Blue Dyed Items", + "tag.item.c.dyed.light_gray": "Light Gray Dyed Items", + "tag.item.c.dyed.lime": "Lime Dyed Items", + "tag.item.c.dyed.magenta": "Magenta Dyed Items", + "tag.item.c.dyed.orange": "Orange Dyed Items", + "tag.item.c.dyed.pink": "Pink Dyed Items", + "tag.item.c.dyed.purple": "Purple Dyed Items", + "tag.item.c.dyed.red": "Red Dyed Items", + "tag.item.c.dyed.white": "White Dyed Items", + "tag.item.c.dyed.yellow": "Yellow Dyed Items", + "tag.item.c.dyes": "Dyes", + "tag.item.c.dyes.black": "Black Dyes", + "tag.item.c.dyes.blue": "Blue Dyes", + "tag.item.c.dyes.brown": "Brown Dyes", + "tag.item.c.dyes.cyan": "Cyan Dyes", + "tag.item.c.dyes.gray": "Gray Dyes", + "tag.item.c.dyes.green": "Green Dyes", + "tag.item.c.dyes.light_blue": "Light Blue Dyes", + "tag.item.c.dyes.light_gray": "Light Gray Dyes", + "tag.item.c.dyes.lime": "Lime Dyes", + "tag.item.c.dyes.magenta": "Magenta Dyes", + "tag.item.c.dyes.orange": "Orange Dyes", + "tag.item.c.dyes.pink": "Pink Dyes", + "tag.item.c.dyes.purple": "Purple Dyes", + "tag.item.c.dyes.red": "Red Dyes", + "tag.item.c.dyes.white": "White Dyes", + "tag.item.c.dyes.yellow": "Yellow Dyes", + "tag.item.c.enchantables": "Enchantables", + "tag.item.c.foods": "Foods", + "tag.item.c.foods.berries": "Berries", + "tag.item.c.foods.breads": "Breads", + "tag.item.c.foods.candies": "Candies", + "tag.item.c.foods.cooked_fishes": "Cooked Fishes", + "tag.item.c.foods.cooked_meats": "Cooked Meats", + "tag.item.c.foods.cookies": "Cookies", + "tag.item.c.foods.edible_when_placed": "Edible When Placed", + "tag.item.c.foods.food_poisoning": "Food Poisoning", + "tag.item.c.foods.fruits": "Fruits", + "tag.item.c.foods.raw_fishes": "Raw Fishes", + "tag.item.c.foods.raw_meats": "Raw Meats", + "tag.item.c.foods.soups": "Soups", + "tag.item.c.foods.vegetables": "Vegetables", + "tag.item.c.gems": "Gems", + "tag.item.c.gems.amethyst": "Amethyst Gems", + "tag.item.c.gems.diamond": "Diamond Gems", + "tag.item.c.gems.emerald": "Emerald Gems", + "tag.item.c.gems.lapis": "Lapis Gems", + "tag.item.c.gems.prismarine": "Prismarine Gems", + "tag.item.c.gems.quartz": "Quartz Gems", + "tag.item.c.glass_blocks": "Glass Blocks", + "tag.item.c.glass_panes": "Glass Panes", + "tag.item.c.hidden_from_recipe_viewers": "Hidden From Recipe Viewers", + "tag.item.c.ingots": "Ingots", + "tag.item.c.ingots.copper": "Copper Ingots", + "tag.item.c.ingots.gold": "Gold Ingots", + "tag.item.c.ingots.iron": "Iron Ingots", + "tag.item.c.ingots.netherite": "Netherite Ingots", + "tag.item.c.nuggets": "Nuggets", + "tag.item.c.ores": "Ores", + "tag.item.c.ores.netherite_scrap": "Netherite Scrap Ores", + "tag.item.c.ores.quartz": "Quartz Ores", + "tag.item.c.player_workstations.crafting_tables": "Crafting Tables", + "tag.item.c.player_workstations.furnaces": "Furnaces", + "tag.item.c.potions": "Potions", + "tag.item.c.raw_blocks": "Raw Blocks", + "tag.item.c.raw_blocks.copper": "Raw Copper Blocks", + "tag.item.c.raw_blocks.gold": "Raw Gold Blocks", + "tag.item.c.raw_blocks.iron": "Raw Iron Blocks", + "tag.item.c.raw_materials": "Raw Materials", + "tag.item.c.raw_materials.copper": "Raw Copper Materials", + "tag.item.c.raw_materials.gold": "Raw Gold Materials", + "tag.item.c.raw_materials.iron": "Raw Iron Materials", + "tag.item.c.rods": "Rods", + "tag.item.c.rods.blaze": "Blaze Rods", + "tag.item.c.rods.breeze": "Breeze Rods", + "tag.item.c.rods.wooden": "Wooden Rods", + "tag.item.c.ropes": "Ropes", + "tag.item.c.sandstone.blocks": "Sandstone Blocks", + "tag.item.c.sandstone.red_blocks": "Red Sandstone Blocks", + "tag.item.c.sandstone.red_slabs": "Red Sandstone Slabs", + "tag.item.c.sandstone.red_stairs": "Red Sandstone Stairs", + "tag.item.c.sandstone.slabs": "Sandstone Slabs", + "tag.item.c.sandstone.stairs": "Sandstone Stairs", + "tag.item.c.sandstone.uncolored_blocks": "Uncolored Sandstone Blocks", + "tag.item.c.sandstone.uncolored_slabs": "Uncolored Sandstone Slabs", + "tag.item.c.sandstone.uncolored_stairs": "Uncolored Sandstone Stairs", + "tag.item.c.shulker_boxes": "Shulker Boxes", + "tag.item.c.stones": "Stones", + "tag.item.c.storage_blocks": "Storage Blocks", + "tag.item.c.storage_blocks.bone_meal": "Bone Meal Storage Blocks", + "tag.item.c.storage_blocks.coal": "Coal Storage Blocks", + "tag.item.c.storage_blocks.copper": "Copper Storage Blocks", + "tag.item.c.storage_blocks.diamond": "Diamond Storage Blocks", + "tag.item.c.storage_blocks.dried_kelp": "Dried Kelp Storage Blocks", + "tag.item.c.storage_blocks.emerald": "Emerald Storage Blocks", + "tag.item.c.storage_blocks.gold": "Gold Storage Blocks", + "tag.item.c.storage_blocks.iron": "Iron Storage Blocks", + "tag.item.c.storage_blocks.lapis": "Lapis Storage Blocks", + "tag.item.c.storage_blocks.netherite": "Netherite Storage Blocks", + "tag.item.c.storage_blocks.raw_copper": "Raw Copper Storage Blocks", + "tag.item.c.storage_blocks.raw_gold": "Raw Gold Storage Blocks", + "tag.item.c.storage_blocks.raw_iron": "Raw Iron Storage Blocks", + "tag.item.c.storage_blocks.redstone": "Redstone Storage Blocks", + "tag.item.c.storage_blocks.slime": "Slime Storage Blocks", + "tag.item.c.storage_blocks.wheat": "Wheat Storage Blocks", + "tag.item.c.strings": "Strings", + "tag.item.c.tools": "Tools", + "tag.item.c.tools.bows": "Bows", + "tag.item.c.tools.brushes": "Brushes", + "tag.item.c.tools.crossbows": "Crossbows", + "tag.item.c.tools.fishing_rods": "Fishing Rods", + "tag.item.c.tools.melee_weapons": "Melee Weapons", + "tag.item.c.tools.mining_tools": "Mining Tools", + "tag.item.c.tools.ranged_weapons": "Ranged Weapons", + "tag.item.c.tools.shears": "Shears", + "tag.item.c.tools.shields": "Shields", + "tag.item.c.tools.spears": "Spears", + "tag.item.c.villager_job_sites": "Villager Job Sites", + "tag.worldgen.biome.c.hidden_from_locator_selection": "Hidden From Locator Selection", + "tag.worldgen.biome.c.is_aquatic": "Aquatic", + "tag.worldgen.biome.c.is_aquatic_icy": "Icy Aquatic", + "tag.worldgen.biome.c.is_badlands": "Badlands", + "tag.worldgen.biome.c.is_beach": "Beach", + "tag.worldgen.biome.c.is_birch_forest": "Birch Forest", + "tag.worldgen.biome.c.is_cave": "Cave", + "tag.worldgen.biome.c.is_cold": "Cold", + "tag.worldgen.biome.c.is_cold.end": "Cold End", + "tag.worldgen.biome.c.is_cold.overworld": "Cold Overworld", + "tag.worldgen.biome.c.is_dead": "Dead", + "tag.worldgen.biome.c.is_deep_ocean": "Deep Ocean", + "tag.worldgen.biome.c.is_dense_vegetation": "Dense Vegetation", + "tag.worldgen.biome.c.is_dense_vegetation.overworld": "Dense Overworld Vegetation", + "tag.worldgen.biome.c.is_desert": "Desert", + "tag.worldgen.biome.c.is_dry": "Dry", + "tag.worldgen.biome.c.is_dry.end": "Dry End", + "tag.worldgen.biome.c.is_dry.nether": "Dry Nether", + "tag.worldgen.biome.c.is_dry.overworld": "Dry Overworld", + "tag.worldgen.biome.c.is_end": "The End", + "tag.worldgen.biome.c.is_floral": "Floral", + "tag.worldgen.biome.c.is_flower_forest": "Flower Forest", + "tag.worldgen.biome.c.is_forest": "Forest", + "tag.worldgen.biome.c.is_hill": "Hills", + "tag.worldgen.biome.c.is_hot": "Hot", + "tag.worldgen.biome.c.is_hot.nether": "Hot Nether", + "tag.worldgen.biome.c.is_hot.overworld": "Hot Overworld", + "tag.worldgen.biome.c.is_icy": "Icy", + "tag.worldgen.biome.c.is_jungle": "Jungle", + "tag.worldgen.biome.c.is_mountain": "Mountain", + "tag.worldgen.biome.c.is_mountain.peak": "Mountain Peak", + "tag.worldgen.biome.c.is_mountain.slope": "Mountain Slope", + "tag.worldgen.biome.c.is_mushroom": "Mushroom", + "tag.worldgen.biome.c.is_nether": "Nether", + "tag.worldgen.biome.c.is_nether_forest": "Nether Forest", + "tag.worldgen.biome.c.is_ocean": "Ocean", + "tag.worldgen.biome.c.is_old_growth": "Old Growth", + "tag.worldgen.biome.c.is_outer_end_island": "Outer End Island", + "tag.worldgen.biome.c.is_overworld": "Overworld", + "tag.worldgen.biome.c.is_plains": "Plains", + "tag.worldgen.biome.c.is_river": "River", + "tag.worldgen.biome.c.is_savanna": "Savanna", + "tag.worldgen.biome.c.is_shallow_ocean": "Shallow Ocean", + "tag.worldgen.biome.c.is_snowy": "Snowy", + "tag.worldgen.biome.c.is_snowy_plains": "Snowy Plains", + "tag.worldgen.biome.c.is_sparse_vegetation": "Sparse Vegetation", + "tag.worldgen.biome.c.is_sparse_vegetation.overworld": "Sparse Overworld Vegetation", + "tag.worldgen.biome.c.is_stony_shores": "Stony Shores", + "tag.worldgen.biome.c.is_swamp": "Swamp", + "tag.worldgen.biome.c.is_taiga": "Taiga", + "tag.worldgen.biome.c.is_temperate": "Temperate", + "tag.worldgen.biome.c.is_temperate.overworld": "Temperate Overworld", + "tag.worldgen.biome.c.is_tree.coniferous": "Coniferous Tree", + "tag.worldgen.biome.c.is_tree.deciduous": "Deciduous Tree", + "tag.worldgen.biome.c.is_tree.jungle": "Jungle Tree", + "tag.worldgen.biome.c.is_tree.savanna": "Savanna Tree", + "tag.worldgen.biome.c.is_underground": "Underground", + "tag.worldgen.biome.c.is_void": "Void", + "tag.worldgen.biome.c.is_wasteland": "Wasteland", + "tag.worldgen.biome.c.is_wet": "Wet", + "tag.worldgen.biome.c.is_wet.overworld": "Wet Overworld", + "tag.worldgen.biome.c.is_windswept": "Windswept", + "tag.worldgen.biome.c.no_default_monsters": "No Default Monsters", + "tag.worldgen.structure.c.hidden_from_displayers": "Hidden From Displayers", + "tag.worldgen.structure.c.hidden_from_locator_selection": "Hidden From Locator Selection" +} \ No newline at end of file diff --git a/fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/api/tag/FabricTagKey.java b/fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/api/tag/FabricTagKey.java new file mode 100644 index 000000000..f041d010f --- /dev/null +++ b/fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/api/tag/FabricTagKey.java @@ -0,0 +1,78 @@ +/* + * 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; + +import net.minecraft.registry.tag.TagKey; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; + +/** + * General-purpose Fabric-provided extensions for {@link TagKey} subclasses. + * + *

These extensions were designed primarily for giving extra utility methods for TagKeys usages. + * Getting a TagKey's translation key for example. + * + *

Note: This interface is automatically implemented on all {@link TagKey} instances via Mixin and interface injection. + */ +public interface FabricTagKey { + /** + * Use this to get a TagKey's translation key safely on any side. + * + *

Format for vanilla registry TagKeys is: + * tag.(registry_path).(tag_namespace).(tag_path) + * + *

Format for modded registry TagKeys is: + * tag.(registry_namespace).(registry_path).(tag_namespace).(tag_path) + * + *

The registry's path and tag path's slashes will be converted to periods. + * + * @return the translation key for a TagKey + */ + default String getTranslationKey() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("tag."); + + TagKey tagKey = (TagKey) this; + Identifier registryIdentifier = tagKey.registry().getValue(); + Identifier tagIdentifier = tagKey.id(); + + if (!registryIdentifier.getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) { + stringBuilder.append(registryIdentifier.getNamespace()) + .append("."); + } + + stringBuilder.append(registryIdentifier.getPath().replace("/", ".")) + .append(".") + .append(tagIdentifier.getNamespace()) + .append(".") + .append(tagIdentifier.getPath().replace("/", ".").replace(":", ".")); + + return stringBuilder.toString(); + } + + /** + * Use this to get a TagKey's translatable text for display purposes. + * + *

The text uses the result of {@link TagKey#getTranslationKey} for the translation key + * and will fall back to displaying #tag_namespace:tag_path if no translation exists. + * + * @return the translatable text for a TagKey + */ + default Text getName() { + return Text.translatableWithFallback(getTranslationKey(), "#" + ((TagKey) this).id().toString()); + } +} diff --git a/fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/impl/tag/convention/v2/TranslationConventionLogWarnings.java b/fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/impl/tag/convention/v2/TranslationConventionLogWarnings.java new file mode 100644 index 000000000..34daced51 --- /dev/null +++ b/fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/impl/tag/convention/v2/TranslationConventionLogWarnings.java @@ -0,0 +1,113 @@ +/* + * 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.v2; + +import java.util.List; +import java.util.Locale; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.minecraft.item.Item; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.util.Identifier; +import net.minecraft.util.Language; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; + +public class TranslationConventionLogWarnings implements ModInitializer { + private static final Logger LOGGER = LoggerFactory.getLogger(TranslationConventionLogWarnings.class); + + /** + * A config option mainly for developers. + * Logs out modded item tags that do not have translations when running on integrated server. + * Defaults to SHORT. + */ + private static final LogWarningMode LOG_UNTRANSLATED_WARNING_MODE = setupLogWarningModeProperty(); + + private static LogWarningMode setupLogWarningModeProperty() { + String property = System.getProperty("fabric-tag-conventions-v2.missingTagTranslationWarning", LogWarningMode.SHORT.name()).toUpperCase(Locale.ROOT); + + try { + return LogWarningMode.valueOf(property); + } catch (Exception e) { + LOGGER.error("Unknown entry `{}` for property `fabric-tag-conventions-v2.missingTagTranslationWarning`.", property); + return LogWarningMode.SILENCED; + } + } + + private enum LogWarningMode { + SILENCED, + SHORT, + VERBOSE + } + + public void onInitialize() { + if (LOG_UNTRANSLATED_WARNING_MODE != LogWarningMode.SILENCED) { + setupUntranslatedItemTagWarning(); + } + } + + private static void setupUntranslatedItemTagWarning() { + // Log missing item tag translations only when world is started. + ServerLifecycleEvents.SERVER_STARTED.register(server -> { + Language language = Language.getInstance(); + Registry itemRegistry = server.getRegistryManager().get(RegistryKeys.ITEM); + List> untranslatedItemTags = new ObjectArrayList<>(); + itemRegistry.streamTags().forEach(itemTagKey -> { + // We do not translate vanilla's tags at this moment. + if (itemTagKey.id().getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) { + return; + } + + if (!language.hasTranslation(itemTagKey.getTranslationKey())) { + untranslatedItemTags.add(itemTagKey); + } + }); + + if (untranslatedItemTags.isEmpty()) { + return; + } + + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(""" + \n Dev warning - Untranslated Item Tags detected. Please translate your item tags so other mods such as recipe viewers can properly display your tag's name. + The format desired is tag.item.. for the translation key with slashes in path turned into periods. + To disable this message, set this system property in your runs: `-Dfabric-tag-conventions-v2.missingTagTranslationWarning=SILENCED`. + To see individual untranslated item tags found, set the system property to `-Dfabric-tag-conventions-v2.missingTagTranslationWarning=VERBOSE`. + Default is `SHORT`. + """); + + // Print out all untranslated tags when desired. + boolean isConfigSetToVerbose = LOG_UNTRANSLATED_WARNING_MODE == LogWarningMode.VERBOSE; + + if (isConfigSetToVerbose) { + stringBuilder.append("\nUntranslated item tags:"); + + for (TagKey tagKey : untranslatedItemTags) { + stringBuilder.append("\n ").append(tagKey.id()); + } + } + + LOGGER.warn(stringBuilder.toString()); + }); + } +} diff --git a/fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/mixin/tag/TagKeyMixin.java b/fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/mixin/tag/TagKeyMixin.java new file mode 100644 index 000000000..570ba3e40 --- /dev/null +++ b/fabric-convention-tags-v2/src/main/java/net/fabricmc/fabric/mixin/tag/TagKeyMixin.java @@ -0,0 +1,27 @@ +/* + * 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.mixin.tag; + +import org.spongepowered.asm.mixin.Mixin; + +import net.minecraft.registry.tag.TagKey; + +import net.fabricmc.fabric.api.tag.FabricTagKey; + +@Mixin(TagKey.class) +public interface TagKeyMixin extends FabricTagKey { +} diff --git a/fabric-convention-tags-v2/src/main/resources/fabric-convention-tags-api-v2.mixins.json b/fabric-convention-tags-v2/src/main/resources/fabric-convention-tags-api-v2.mixins.json new file mode 100644 index 000000000..ac33b25a2 --- /dev/null +++ b/fabric-convention-tags-v2/src/main/resources/fabric-convention-tags-api-v2.mixins.json @@ -0,0 +1,11 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin.tag", + "compatibilityLevel": "JAVA_17", + "mixins": [ + "TagKeyMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-convention-tags-v2/src/main/resources/fabric.mod.json b/fabric-convention-tags-v2/src/main/resources/fabric.mod.json index a82d6a0a2..321e79199 100644 --- a/fabric-convention-tags-v2/src/main/resources/fabric.mod.json +++ b/fabric-convention-tags-v2/src/main/resources/fabric.mod.json @@ -15,14 +15,24 @@ "authors": [ "FabricMC" ], + "entrypoints": { + "main": [ + "net.fabricmc.fabric.impl.tag.convention.v2.TranslationConventionLogWarnings" + ] + }, "depends": { "fabricloader": ">=0.15.11", "minecraft": ">=1.20.5-beta.1", "fabric-lifecycle-events-v1": "*" }, - "mixins": [], + "mixins": [ + "fabric-convention-tags-api-v2.mixins.json" + ], "description": "Contains common tags used by mods for better inter-mod compatibility.", "custom": { - "fabric-api:module-lifecycle": "stable" + "fabric-api:module-lifecycle": "stable", + "loom:injected_interfaces": { + "net/minecraft/class_6862": ["net/fabricmc/fabric/api/tag/FabricTagKey"] + } } } diff --git a/fabric-data-generation-api-v1/build.gradle b/fabric-data-generation-api-v1/build.gradle index 8df7b38a2..8c080d5b0 100644 --- a/fabric-data-generation-api-v1/build.gradle +++ b/fabric-data-generation-api-v1/build.gradle @@ -2,6 +2,7 @@ version = getSubprojectVersion(project) moduleDependencies(project, [ 'fabric-api-base', + 'fabric-convention-tags-v2', 'fabric-registry-sync-v0', 'fabric-networking-api-v1', 'fabric-resource-conditions-api-v1', diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java index a3f201a61..40f0117c8 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java @@ -43,6 +43,7 @@ import net.minecraft.registry.Registries; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.tag.TagKey; import net.minecraft.stat.StatType; import net.minecraft.text.TextContent; import net.minecraft.text.TranslatableTextContent; @@ -229,6 +230,16 @@ public abstract class FabricLanguageProvider implements DataProvider { add(identifier.toTranslationKey(), value); } + /** + * Adds a translation for a {@link TagKey}. + * + * @param tagKey the {@link TagKey} to get the translation key from + * @param value the value of the entry + */ + default void add(TagKey tagKey, String value) { + add(tagKey.getTranslationKey(), value); + } + /** * Merges an existing language file into the generated language file. *