diff --git a/src/main/java/org/betterx/bclib/BCLib.java b/src/main/java/org/betterx/bclib/BCLib.java index 74c13d2e..a6bf3d44 100644 --- a/src/main/java/org/betterx/bclib/BCLib.java +++ b/src/main/java/org/betterx/bclib/BCLib.java @@ -10,7 +10,6 @@ import org.betterx.bclib.api.v2.levelgen.features.blockpredicates.Types; import org.betterx.bclib.api.v2.levelgen.features.placement.PlacementModifiers; import org.betterx.bclib.api.v2.levelgen.structures.TemplatePiece; import org.betterx.bclib.api.v2.levelgen.surface.rules.Conditions; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.commands.CommandRegistry; import org.betterx.bclib.config.Configs; import org.betterx.bclib.recipes.AnvilRecipe; @@ -19,6 +18,7 @@ import org.betterx.bclib.registry.BaseBlockEntities; import org.betterx.bclib.registry.BaseRegistry; import org.betterx.bclib.util.Logger; import org.betterx.worlds.together.WorldsTogether; +import org.betterx.worlds.together.tag.TagManager; import org.betterx.worlds.together.world.WorldConfig; import net.minecraft.resources.ResourceLocation; @@ -43,7 +43,7 @@ public class BCLib implements ModInitializer { BaseBlockEntities.register(); BCLibEndBiomeSource.register(); BCLibNetherBiomeSource.register(); - TagAPI.init(); + TagManager.ensureStaticallyLoaded(); CraftingRecipes.init(); WorldConfig.registerModCache(MOD_ID); DataExchangeAPI.registerMod(MOD_ID); diff --git a/src/main/java/org/betterx/bclib/api/v2/PostInitAPI.java b/src/main/java/org/betterx/bclib/api/v2/PostInitAPI.java index 7fc2d82e..f0395939 100644 --- a/src/main/java/org/betterx/bclib/api/v2/PostInitAPI.java +++ b/src/main/java/org/betterx/bclib/api/v2/PostInitAPI.java @@ -2,8 +2,6 @@ package org.betterx.bclib.api.v2; import org.betterx.bclib.BCLib; import org.betterx.bclib.api.v2.levelgen.biomes.InternalBiomeAPI; -import org.betterx.bclib.api.v2.tag.NamedMineableTags; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.blocks.BaseBarrelBlock; import org.betterx.bclib.blocks.BaseChestBlock; import org.betterx.bclib.blocks.BaseFurnaceBlock; @@ -17,6 +15,8 @@ import org.betterx.bclib.interfaces.RenderLayerProvider; import org.betterx.bclib.interfaces.TagProvider; import org.betterx.bclib.interfaces.tools.*; import org.betterx.bclib.registry.BaseBlockEntities; +import org.betterx.worlds.together.tag.MineableTags; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.Registry; @@ -97,7 +97,7 @@ public class PostInitAPI { } catch (NullPointerException ex) { BCLib.LOGGER.error(item + " probably tried to access blockTags.", ex); } - itemTags.forEach(tag -> TagAPI.addItemTag(tag, item)); + itemTags.forEach(tag -> TagManager.ITEMS.add(tag, item)); itemTags.clear(); } } @@ -117,31 +117,31 @@ public class PostInitAPI { } if (!(block instanceof PreventMineableAdd)) { if (block instanceof AddMineableShears) { - TagAPI.addBlockTags(block, NamedMineableTags.SHEARS); + TagManager.BLOCKS.add(block, MineableTags.SHEARS); } if (block instanceof AddMineableAxe) { - TagAPI.addBlockTags(block, NamedMineableTags.AXE); + TagManager.BLOCKS.add(block, MineableTags.AXE); } if (block instanceof AddMineablePickaxe) { - TagAPI.addBlockTags(block, NamedMineableTags.PICKAXE); + TagManager.BLOCKS.add(block, MineableTags.PICKAXE); } if (block instanceof AddMineableShovel) { - TagAPI.addBlockTags(block, NamedMineableTags.SHOVEL); + TagManager.BLOCKS.add(block, MineableTags.SHOVEL); } if (block instanceof AddMineableHoe) { - TagAPI.addBlockTags(block, NamedMineableTags.HOE); + TagManager.BLOCKS.add(block, MineableTags.HOE); } if (block instanceof AddMineableSword) { - TagAPI.addBlockTags(block, NamedMineableTags.SWORD); + TagManager.BLOCKS.add(block, MineableTags.SWORD); } if (block instanceof AddMineableHammer) { - TagAPI.addBlockTags(block, NamedMineableTags.HAMMER); + TagManager.BLOCKS.add(block, MineableTags.HAMMER); } } if (block instanceof TagProvider) { ((TagProvider) block).addTags(blockTags, itemTags); - blockTags.forEach(tag -> TagAPI.addBlockTag(tag, block)); - itemTags.forEach(tag -> TagAPI.addItemTag(tag, block)); + blockTags.forEach(tag -> TagManager.BLOCKS.add(tag, block)); + itemTags.forEach(tag -> TagManager.ITEMS.add(tag, block.asItem())); blockTags.clear(); itemTags.clear(); } diff --git a/src/main/java/org/betterx/bclib/api/v2/levelgen/biomes/BCLBiome.java b/src/main/java/org/betterx/bclib/api/v2/levelgen/biomes/BCLBiome.java index cb314155..348fec3f 100644 --- a/src/main/java/org/betterx/bclib/api/v2/levelgen/biomes/BCLBiome.java +++ b/src/main/java/org/betterx/bclib/api/v2/levelgen/biomes/BCLBiome.java @@ -2,8 +2,8 @@ package org.betterx.bclib.api.v2.levelgen.biomes; import org.betterx.bclib.BCLib; import org.betterx.bclib.api.v2.levelgen.surface.SurfaceRuleUtil; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.util.WeightedList; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.data.BuiltinRegistries; import net.minecraft.resources.ResourceKey; @@ -201,7 +201,7 @@ public class BCLBiome extends BCLBiomeSettings { */ void afterRegistration() { ResourceKey key = BuiltinRegistries.BIOME.getResourceKey(getBiome()).orElseThrow(); - this.biomeTags.forEach(tagKey -> TagAPI.addBiomeTag(tagKey, biome)); + this.biomeTags.forEach(tagKey -> TagManager.BIOMES.add(tagKey, biome)); if (this.surfaceInit != null) { surfaceInit.accept(key); diff --git a/src/main/java/org/betterx/bclib/api/v2/levelgen/biomes/BiomeAPI.java b/src/main/java/org/betterx/bclib/api/v2/levelgen/biomes/BiomeAPI.java index d0825424..e4ed72e4 100644 --- a/src/main/java/org/betterx/bclib/api/v2/levelgen/biomes/BiomeAPI.java +++ b/src/main/java/org/betterx/bclib/api/v2/levelgen/biomes/BiomeAPI.java @@ -2,12 +2,12 @@ package org.betterx.bclib.api.v2.levelgen.biomes; import org.betterx.bclib.BCLib; import org.betterx.bclib.api.v2.levelgen.features.BCLFeature; -import org.betterx.bclib.api.v2.tag.CommonBiomeTags; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.interfaces.SurfaceMaterialProvider; import org.betterx.bclib.mixin.common.BiomeGenerationSettingsAccessor; import org.betterx.bclib.mixin.common.MobSpawnSettingsAccessor; import org.betterx.bclib.util.CollectionsUtil; +import org.betterx.worlds.together.tag.CommonBiomeTags; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; @@ -150,10 +150,10 @@ public class BiomeAPI { BiomeType.BIOME_TYPE_MAP.put(bclbiome.getID(), dim); if (dim != null && dim.is(BiomeType.NETHER)) { - TagAPI.addBiomeTag(BiomeTags.IS_NETHER, bclbiome.getBiome()); - TagAPI.addBiomeTag(CommonBiomeTags.IN_NETHER, bclbiome.getBiome()); + TagManager.BIOMES.add(BiomeTags.IS_NETHER, bclbiome.getBiome()); + TagManager.BIOMES.add(CommonBiomeTags.IN_NETHER, bclbiome.getBiome()); } else if (dim != null && dim.is(BiomeType.END)) { - TagAPI.addBiomeTag(BiomeTags.IS_END, bclbiome.getBiome()); + TagManager.BIOMES.add(BiomeTags.IS_END, bclbiome.getBiome()); } bclbiome.afterRegistration(); diff --git a/src/main/java/org/betterx/bclib/api/v2/levelgen/features/BCLFeatureBuilder.java b/src/main/java/org/betterx/bclib/api/v2/levelgen/features/BCLFeatureBuilder.java index 9341fbb1..5af7a9ca 100644 --- a/src/main/java/org/betterx/bclib/api/v2/levelgen/features/BCLFeatureBuilder.java +++ b/src/main/java/org/betterx/bclib/api/v2/levelgen/features/BCLFeatureBuilder.java @@ -1,7 +1,7 @@ package org.betterx.bclib.api.v2.levelgen.features; import org.betterx.bclib.api.v2.levelgen.features.placement.*; -import org.betterx.bclib.api.v2.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.CommonBlockTags; import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; diff --git a/src/main/java/org/betterx/bclib/api/v2/levelgen/structures/BCLStructureBuilder.java b/src/main/java/org/betterx/bclib/api/v2/levelgen/structures/BCLStructureBuilder.java index e7578faa..6226a200 100644 --- a/src/main/java/org/betterx/bclib/api/v2/levelgen/structures/BCLStructureBuilder.java +++ b/src/main/java/org/betterx/bclib/api/v2/levelgen/structures/BCLStructureBuilder.java @@ -1,6 +1,6 @@ package org.betterx.bclib.api.v2.levelgen.structures; -import org.betterx.bclib.api.v2.tag.TagAPI; +import org.betterx.worlds.together.tag.TagManager; import com.mojang.serialization.Codec; import net.minecraft.resources.ResourceLocation; @@ -81,7 +81,7 @@ public class BCLStructureBuilder { } public BCLStructureBuilder biomeTag(String modID, String path) { - this.biomeTag = TagAPI.makeStructureTag(modID, path); + this.biomeTag = TagManager.BIOMES.makeStructureTag(modID, path); return this; } diff --git a/src/main/java/org/betterx/bclib/api/v2/tag/CommonBiomeTags.java b/src/main/java/org/betterx/bclib/api/v2/tag/CommonBiomeTags.java index e375eda6..fe25bc43 100644 --- a/src/main/java/org/betterx/bclib/api/v2/tag/CommonBiomeTags.java +++ b/src/main/java/org/betterx/bclib/api/v2/tag/CommonBiomeTags.java @@ -3,6 +3,14 @@ package org.betterx.bclib.api.v2.tag; import net.minecraft.tags.TagKey; import net.minecraft.world.level.biome.Biome; +/** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBiomeTags} + */ +@Deprecated(forRemoval = true) public class CommonBiomeTags { - public static final TagKey IN_NETHER = TagAPI.makeCommonBiomeTag("in_nether"); + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBiomeTags#IN_NETHER} + **/ + @Deprecated(forRemoval = true) + public static final TagKey IN_NETHER = org.betterx.worlds.together.tag.CommonBiomeTags.IN_NETHER; } diff --git a/src/main/java/org/betterx/bclib/api/v2/tag/CommonBlockTags.java b/src/main/java/org/betterx/bclib/api/v2/tag/CommonBlockTags.java index 8e53d7df..c8fd346d 100644 --- a/src/main/java/org/betterx/bclib/api/v2/tag/CommonBlockTags.java +++ b/src/main/java/org/betterx/bclib/api/v2/tag/CommonBlockTags.java @@ -1,100 +1,131 @@ package org.betterx.bclib.api.v2.tag; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; +/** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags} + */ +@Deprecated(forRemoval = true) public class CommonBlockTags { - public static final TagKey BARREL = TagAPI.makeCommonBlockTag("barrel"); - public static final TagKey BOOKSHELVES = TagAPI.makeCommonBlockTag("bookshelves"); - public static final TagKey CHEST = TagAPI.makeCommonBlockTag("chest"); - public static final TagKey END_STONES = TagAPI.makeCommonBlockTag("end_stones"); - public static final TagKey GEN_END_STONES = END_STONES; - public static final TagKey IMMOBILE = TagAPI.makeCommonBlockTag("immobile"); - public static final TagKey LEAVES = TagAPI.makeCommonBlockTag("leaves"); - public static final TagKey NETHERRACK = TagAPI.makeCommonBlockTag("netherrack"); - public static final TagKey MYCELIUM = TagAPI.makeCommonBlockTag("mycelium"); - public static final TagKey NETHER_MYCELIUM = TagAPI.makeCommonBlockTag("nether_mycelium"); - public static final TagKey NETHER_PORTAL_FRAME = TagAPI.makeCommonBlockTag("nether_pframe"); - public static final TagKey NETHER_STONES = TagAPI.makeCommonBlockTag("nether_stones"); - public static final TagKey NETHER_ORES = TagAPI.makeCommonBlockTag("nether_ores"); - public static final TagKey END_ORES = TagAPI.makeCommonBlockTag("end_ores"); - public static final TagKey SAPLINGS = TagAPI.makeCommonBlockTag("saplings"); - public static final TagKey SOUL_GROUND = TagAPI.makeCommonBlockTag("soul_ground"); - public static final TagKey WOODEN_BARREL = TagAPI.makeCommonBlockTag("wooden_barrels"); - public static final TagKey WOODEN_CHEST = TagAPI.makeCommonBlockTag("wooden_chests"); - public static final TagKey WORKBENCHES = TagAPI.makeCommonBlockTag("workbench"); - - public static final TagKey DRAGON_IMMUNE = TagAPI.makeCommonBlockTag("dragon_immune"); - - public static final TagKey MINABLE_WITH_HAMMER = TagAPI.makeCommonBlockTag("mineable/hammer"); - - public static final TagKey IS_OBSIDIAN = TagAPI.makeCommonBlockTag("is_obsidian"); - public static final TagKey TERRAIN = TagAPI.makeCommonBlockTag("terrain"); - public static final TagKey NETHER_TERRAIN = TagAPI.makeCommonBlockTag("nether_terrain"); - - static { - TagAPI.BLOCKS.addOtherTags(DRAGON_IMMUNE, BlockTags.DRAGON_IMMUNE); - - TagAPI.BLOCKS.add(END_STONES, Blocks.END_STONE); - TagAPI.BLOCKS.addOtherTags(NETHER_STONES, BlockTags.BASE_STONE_NETHER); - - TagAPI.BLOCKS.add( - NETHERRACK, - Blocks.NETHERRACK, - Blocks.NETHER_QUARTZ_ORE, - Blocks.NETHER_GOLD_ORE, - Blocks.CRIMSON_NYLIUM, - Blocks.WARPED_NYLIUM - ); - - TagAPI.BLOCKS.add(NETHER_ORES, Blocks.NETHER_QUARTZ_ORE, Blocks.NETHER_GOLD_ORE); - TagAPI.BLOCKS.add(SOUL_GROUND, Blocks.SOUL_SAND, Blocks.SOUL_SOIL); - - TagAPI.BLOCKS.add(IS_OBSIDIAN, Blocks.OBSIDIAN, Blocks.CRYING_OBSIDIAN); - - TagAPI.BLOCKS.add(MYCELIUM, Blocks.MYCELIUM); - TagAPI.BLOCKS.addOtherTags(MYCELIUM, NETHER_MYCELIUM); - - - TagAPI.BLOCKS.add( - TERRAIN, - Blocks.MAGMA_BLOCK, - Blocks.GRAVEL, - Blocks.SAND, - Blocks.RED_SAND, - Blocks.GLOWSTONE, - Blocks.BONE_BLOCK, - Blocks.SCULK - ); - TagAPI.BLOCKS.addOtherTags( - TERRAIN, - NETHER_TERRAIN, - BlockTags.DRIPSTONE_REPLACEABLE, - BlockTags.BASE_STONE_OVERWORLD, - BlockTags.NYLIUM, - MYCELIUM, - END_STONES - ); - - TagAPI.BLOCKS.add( - NETHER_TERRAIN, - Blocks.MAGMA_BLOCK, - Blocks.GRAVEL, - Blocks.RED_SAND, - Blocks.GLOWSTONE, - Blocks.BONE_BLOCK, - Blocks.SCULK - ); - TagAPI.BLOCKS.addOtherTags( - NETHER_TERRAIN, - NETHERRACK, - BlockTags.NYLIUM, - NETHER_STONES, - NETHER_ORES, - SOUL_GROUND, - NETHER_MYCELIUM - ); - } + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#BARREL} + **/ + @Deprecated(forRemoval = true) + public static final TagKey BARREL = org.betterx.worlds.together.tag.CommonBlockTags.BARREL; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#BOOKSHELVES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey BOOKSHELVES = org.betterx.worlds.together.tag.CommonBlockTags.BOOKSHELVES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#CHEST} + **/ + @Deprecated(forRemoval = true) + public static final TagKey CHEST = org.betterx.worlds.together.tag.CommonBlockTags.CHEST; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#END_STONES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey END_STONES = org.betterx.worlds.together.tag.CommonBlockTags.END_STONES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#GEN_END_STONES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey GEN_END_STONES = org.betterx.worlds.together.tag.CommonBlockTags.GEN_END_STONES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#IMMOBILE} + **/ + @Deprecated(forRemoval = true) + public static final TagKey IMMOBILE = org.betterx.worlds.together.tag.CommonBlockTags.IMMOBILE; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#LEAVES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey LEAVES = org.betterx.worlds.together.tag.CommonBlockTags.LEAVES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#NETHERRACK} + **/ + @Deprecated(forRemoval = true) + public static final TagKey NETHERRACK = org.betterx.worlds.together.tag.CommonBlockTags.NETHERRACK; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#MYCELIUM} + **/ + @Deprecated(forRemoval = true) + public static final TagKey MYCELIUM = org.betterx.worlds.together.tag.CommonBlockTags.MYCELIUM; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#NETHER_MYCELIUM} + **/ + @Deprecated(forRemoval = true) + public static final TagKey NETHER_MYCELIUM = org.betterx.worlds.together.tag.CommonBlockTags.NETHER_MYCELIUM; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#NETHER_PORTAL_FRAME} + **/ + @Deprecated(forRemoval = true) + public static final TagKey NETHER_PORTAL_FRAME = org.betterx.worlds.together.tag.CommonBlockTags.NETHER_PORTAL_FRAME; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#NETHER_STONES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey NETHER_STONES = org.betterx.worlds.together.tag.CommonBlockTags.NETHER_STONES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#NETHER_ORES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey NETHER_ORES = org.betterx.worlds.together.tag.CommonBlockTags.NETHER_ORES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#END_ORES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey END_ORES = org.betterx.worlds.together.tag.CommonBlockTags.END_ORES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#SAPLINGS} + **/ + @Deprecated(forRemoval = true) + public static final TagKey SAPLINGS = org.betterx.worlds.together.tag.CommonBlockTags.SAPLINGS; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#SOUL_GROUND} + **/ + @Deprecated(forRemoval = true) + public static final TagKey SOUL_GROUND = org.betterx.worlds.together.tag.CommonBlockTags.SOUL_GROUND; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#WOODEN_BARREL} + **/ + @Deprecated(forRemoval = true) + public static final TagKey WOODEN_BARREL = org.betterx.worlds.together.tag.CommonBlockTags.WOODEN_BARREL; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#WOODEN_CHEST} + **/ + @Deprecated(forRemoval = true) + public static final TagKey WOODEN_CHEST = org.betterx.worlds.together.tag.CommonBlockTags.WOODEN_CHEST; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#WORKBENCHES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey WORKBENCHES = org.betterx.worlds.together.tag.CommonBlockTags.WORKBENCHES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#DRAGON_IMMUNE} + **/ + @Deprecated(forRemoval = true) + public static final TagKey DRAGON_IMMUNE = org.betterx.worlds.together.tag.CommonBlockTags.DRAGON_IMMUNE; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#MINABLE_WITH_HAMMER} + **/ + @Deprecated(forRemoval = true) + public static final TagKey MINABLE_WITH_HAMMER = org.betterx.worlds.together.tag.CommonBlockTags.MINABLE_WITH_HAMMER; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#IS_OBSIDIAN} + **/ + @Deprecated(forRemoval = true) + public static final TagKey IS_OBSIDIAN = org.betterx.worlds.together.tag.CommonBlockTags.IS_OBSIDIAN; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#TERRAIN} + **/ + @Deprecated(forRemoval = true) + public static final TagKey TERRAIN = org.betterx.worlds.together.tag.CommonBlockTags.TERRAIN; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonBlockTags#NETHER_TERRAIN} + **/ + @Deprecated(forRemoval = true) + public static final TagKey NETHER_TERRAIN = org.betterx.worlds.together.tag.CommonBlockTags.NETHER_TERRAIN; } diff --git a/src/main/java/org/betterx/bclib/api/v2/tag/CommonItemTags.java b/src/main/java/org/betterx/bclib/api/v2/tag/CommonItemTags.java index 8bc8753d..47c4a516 100644 --- a/src/main/java/org/betterx/bclib/api/v2/tag/CommonItemTags.java +++ b/src/main/java/org/betterx/bclib/api/v2/tag/CommonItemTags.java @@ -2,23 +2,72 @@ package org.betterx.bclib.api.v2.tag; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Blocks; +/** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags} + */ +@Deprecated(forRemoval = true) public class CommonItemTags { - public final static TagKey HAMMERS = TagAPI.makeCommonItemTag("hammers"); - public static final TagKey BARREL = TagAPI.makeCommonItemTag("barrel"); - public static final TagKey CHEST = TagAPI.makeCommonItemTag("chest"); - public static final TagKey SHEARS = TagAPI.makeCommonItemTag("shears"); - public static final TagKey FURNACES = TagAPI.makeCommonItemTag("furnaces"); - public static final TagKey IRON_INGOTS = TagAPI.makeCommonItemTag("iron_ingots"); - public static final TagKey LEAVES = TagAPI.makeCommonItemTag("leaves"); - public static final TagKey SAPLINGS = TagAPI.makeCommonItemTag("saplings"); - public static final TagKey SOUL_GROUND = TagAPI.makeCommonItemTag("soul_ground"); - public static final TagKey WOODEN_BARREL = TagAPI.makeCommonItemTag("wooden_barrels"); - public static final TagKey WOODEN_CHEST = TagAPI.makeCommonItemTag("wooden_chests"); - public static final TagKey WORKBENCHES = TagAPI.makeCommonItemTag("workbench"); - static { - TagAPI.ITEMS.add(SOUL_GROUND, Blocks.SOUL_SAND.asItem(), Blocks.SOUL_SOIL.asItem()); - } + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#HAMMERS} + **/ + @Deprecated(forRemoval = true) + public final static TagKey HAMMERS = org.betterx.worlds.together.tag.CommonItemTags.HAMMERS; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#BARREL} + **/ + @Deprecated(forRemoval = true) + public static final TagKey BARREL = org.betterx.worlds.together.tag.CommonItemTags.BARREL; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#CHEST} + **/ + @Deprecated(forRemoval = true) + public static final TagKey CHEST = org.betterx.worlds.together.tag.CommonItemTags.CHEST; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#SHEARS} + **/ + @Deprecated(forRemoval = true) + public static final TagKey SHEARS = org.betterx.worlds.together.tag.CommonItemTags.SHEARS; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#FURNACES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey FURNACES = org.betterx.worlds.together.tag.CommonItemTags.FURNACES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#IRON_INGOTS} + **/ + @Deprecated(forRemoval = true) + public static final TagKey IRON_INGOTS = org.betterx.worlds.together.tag.CommonItemTags.IRON_INGOTS; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#LEAVES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey LEAVES = org.betterx.worlds.together.tag.CommonItemTags.LEAVES; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#SAPLINGS} + **/ + @Deprecated(forRemoval = true) + public static final TagKey SAPLINGS = org.betterx.worlds.together.tag.CommonItemTags.SAPLINGS; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#SOUL_GROUND} + **/ + @Deprecated(forRemoval = true) + public static final TagKey SOUL_GROUND = org.betterx.worlds.together.tag.CommonItemTags.SOUL_GROUND; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#WOODEN_BARREL} + **/ + @Deprecated(forRemoval = true) + public static final TagKey WOODEN_BARREL = org.betterx.worlds.together.tag.CommonItemTags.WOODEN_BARREL; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#WOODEN_CHEST} + **/ + @Deprecated(forRemoval = true) + public static final TagKey WOODEN_CHEST = org.betterx.worlds.together.tag.CommonItemTags.WOODEN_CHEST; + /** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.CommonItemTags#WORKBENCHES} + **/ + @Deprecated(forRemoval = true) + public static final TagKey WORKBENCHES = org.betterx.worlds.together.tag.CommonItemTags.WORKBENCHES; + } diff --git a/src/main/java/org/betterx/bclib/api/v2/tag/NamedBlockTags.java b/src/main/java/org/betterx/bclib/api/v2/tag/NamedBlockTags.java index a57eb982..0a439060 100644 --- a/src/main/java/org/betterx/bclib/api/v2/tag/NamedBlockTags.java +++ b/src/main/java/org/betterx/bclib/api/v2/tag/NamedBlockTags.java @@ -3,9 +3,11 @@ package org.betterx.bclib.api.v2.tag; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; - +/** + * @deprecated Replaced by {@link BlockTags} + */ +@Deprecated(forRemoval = true) public class NamedBlockTags { public static final TagKey ANVIL = BlockTags.ANVIL; public static final TagKey BUTTONS = BlockTags.BUTTONS; @@ -16,34 +18,109 @@ public class NamedBlockTags { public static final TagKey LEAVES = BlockTags.LEAVES; public static final TagKey LOGS = BlockTags.LOGS; public static final TagKey LOGS_THAT_BURN = BlockTags.LOGS_THAT_BURN; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#NYLIUM} + **/ + @Deprecated(forRemoval = true) public static final TagKey NYLIUM = BlockTags.NYLIUM; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#PLANKS} + **/ + @Deprecated(forRemoval = true) public static final TagKey PLANKS = BlockTags.PLANKS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#PRESSURE_PLATES} + **/ + @Deprecated(forRemoval = true) public static final TagKey PRESSURE_PLATES = BlockTags.PRESSURE_PLATES; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#SAPLINGS} + **/ + @Deprecated(forRemoval = true) public static final TagKey SAPLINGS = BlockTags.SAPLINGS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#SIGNS} + **/ + @Deprecated(forRemoval = true) public static final TagKey SIGNS = BlockTags.SIGNS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#SLABS} + **/ + @Deprecated(forRemoval = true) public static final TagKey SLABS = BlockTags.SLABS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#STAIRS} + **/ + @Deprecated(forRemoval = true) public static final TagKey STAIRS = BlockTags.STAIRS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#STONE_PRESSURE_PLATES} + **/ + @Deprecated(forRemoval = true) public static final TagKey STONE_PRESSURE_PLATES = BlockTags.STONE_PRESSURE_PLATES; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#TRAPDOORS} + **/ + @Deprecated(forRemoval = true) public static final TagKey TRAPDOORS = BlockTags.TRAPDOORS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#WALLS} + **/ + @Deprecated(forRemoval = true) public static final TagKey WALLS = BlockTags.WALLS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_BUTTONS} + **/ + @Deprecated(forRemoval = true) public static final TagKey WOODEN_BUTTONS = BlockTags.WOODEN_BUTTONS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_DOORS} + **/ + @Deprecated(forRemoval = true) public static final TagKey WOODEN_DOORS = BlockTags.WOODEN_DOORS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_FENCES} + **/ + @Deprecated(forRemoval = true) public static final TagKey WOODEN_FENCES = BlockTags.WOODEN_FENCES; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_PRESSURE_PLATES} + **/ + @Deprecated(forRemoval = true) public static final TagKey WOODEN_PRESSURE_PLATES = BlockTags.WOODEN_PRESSURE_PLATES; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_SLABS} + **/ + @Deprecated(forRemoval = true) public static final TagKey WOODEN_SLABS = BlockTags.WOODEN_SLABS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_STAIRS} + **/ + @Deprecated(forRemoval = true) public static final TagKey WOODEN_STAIRS = BlockTags.WOODEN_STAIRS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_TRAPDOORS} + **/ + @Deprecated(forRemoval = true) public static final TagKey WOODEN_TRAPDOORS = BlockTags.WOODEN_TRAPDOORS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#SOUL_FIRE_BASE_BLOCKS} + **/ + @Deprecated(forRemoval = true) public static final TagKey SOUL_FIRE_BASE_BLOCKS = BlockTags.SOUL_FIRE_BASE_BLOCKS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#SOUL_SPEED_BLOCKS} + **/ + @Deprecated(forRemoval = true) public static final TagKey SOUL_SPEED_BLOCKS = BlockTags.SOUL_SPEED_BLOCKS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#BEACON_BASE_BLOCKS} + **/ + @Deprecated(forRemoval = true) public static final TagKey BEACON_BASE_BLOCKS = BlockTags.BEACON_BASE_BLOCKS; + /** + * @deprecated replaced by {@link net.minecraft.tags.BlockTags#STONE_BRICKS} + **/ + @Deprecated(forRemoval = true) public static final TagKey STONE_BRICKS = BlockTags.STONE_BRICKS; - - static { - TagAPI.BLOCKS.add(BlockTags.NETHER_CARVER_REPLACEABLES, Blocks.RED_SAND, Blocks.MAGMA_BLOCK, Blocks.SCULK); - TagAPI.BLOCKS.addOtherTags( - BlockTags.NETHER_CARVER_REPLACEABLES, - CommonBlockTags.NETHER_STONES, - CommonBlockTags.NETHERRACK - ); - } } diff --git a/src/main/java/org/betterx/bclib/api/v2/tag/NamedItemTags.java b/src/main/java/org/betterx/bclib/api/v2/tag/NamedItemTags.java index 5659be08..273b1d00 100644 --- a/src/main/java/org/betterx/bclib/api/v2/tag/NamedItemTags.java +++ b/src/main/java/org/betterx/bclib/api/v2/tag/NamedItemTags.java @@ -5,6 +5,10 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; +/** + * @deprecated Replaced by {@link ItemTags} + */ +@Deprecated(forRemoval = true) public class NamedItemTags { public static final TagKey BUTTONS = ItemTags.BUTTONS; public static final TagKey DOORS = ItemTags.DOORS; diff --git a/src/main/java/org/betterx/bclib/api/v2/tag/NamedMineableTags.java b/src/main/java/org/betterx/bclib/api/v2/tag/NamedMineableTags.java index 637bdfd0..5d05be34 100644 --- a/src/main/java/org/betterx/bclib/api/v2/tag/NamedMineableTags.java +++ b/src/main/java/org/betterx/bclib/api/v2/tag/NamedMineableTags.java @@ -1,16 +1,46 @@ package org.betterx.bclib.api.v2.tag; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; - +/** + * @deprecated Replaced by {@link org.betterx.worlds.together.tag.MineableTags} + */ +@Deprecated(forRemoval = true) public class NamedMineableTags { - public static final TagKey AXE = BlockTags.MINEABLE_WITH_AXE; - public static final TagKey HOE = BlockTags.MINEABLE_WITH_HOE; - public static final TagKey PICKAXE = BlockTags.MINEABLE_WITH_PICKAXE; - public static final TagKey SHEARS = TagAPI.makeBlockTag("fabric", "mineable/shears"); - public static final TagKey SHOVEL = BlockTags.MINEABLE_WITH_SHOVEL; - public static final TagKey SWORD = TagAPI.makeBlockTag("fabric", "mineable/sword"); - public static final TagKey HAMMER = TagAPI.makeCommonBlockTag("mineable/hammer"); + /** + * @deprecated use {@link org.betterx.worlds.together.tag.MineableTags#AXE} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey AXE = org.betterx.worlds.together.tag.MineableTags.AXE; + /** + * @deprecated use {@link org.betterx.worlds.together.tag.MineableTags#HOE} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey HOE = org.betterx.worlds.together.tag.MineableTags.HOE; + /** + * @deprecated use {@link org.betterx.worlds.together.tag.MineableTags#PICKAXE} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey PICKAXE = org.betterx.worlds.together.tag.MineableTags.PICKAXE; + /** + * @deprecated use {@link org.betterx.worlds.together.tag.MineableTags#SHEARS} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey SHEARS = org.betterx.worlds.together.tag.MineableTags.SHEARS; + /** + * @deprecated use {@link org.betterx.worlds.together.tag.MineableTags#SHOVEL} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey SHOVEL = org.betterx.worlds.together.tag.MineableTags.SHOVEL; + /** + * @deprecated use {@link org.betterx.worlds.together.tag.MineableTags#SWORD} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey SWORD = org.betterx.worlds.together.tag.MineableTags.SWORD; + /** + * @deprecated use {@link org.betterx.worlds.together.tag.MineableTags#HAMMER} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey HAMMER = org.betterx.worlds.together.tag.MineableTags.HAMMER; } diff --git a/src/main/java/org/betterx/bclib/api/v2/tag/NamedToolTags.java b/src/main/java/org/betterx/bclib/api/v2/tag/NamedToolTags.java index 9c74fdaa..6e5631f5 100644 --- a/src/main/java/org/betterx/bclib/api/v2/tag/NamedToolTags.java +++ b/src/main/java/org/betterx/bclib/api/v2/tag/NamedToolTags.java @@ -1,14 +1,45 @@ package org.betterx.bclib.api.v2.tag; +import org.betterx.worlds.together.tag.ToolTags; + import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; - +/** + * @deprecated Replaced by {@link ToolTags} + */ +@Deprecated(forRemoval = true) public class NamedToolTags { - public static final TagKey FABRIC_AXES = TagAPI.makeItemTag("fabric", "axes"); - public static final TagKey FABRIC_HOES = TagAPI.makeItemTag("fabric", "hoes"); - public static final TagKey FABRIC_PICKAXES = TagAPI.makeItemTag("fabric", "pickaxes"); - public static final TagKey FABRIC_SHEARS = TagAPI.makeItemTag("fabric", "shears"); - public static final TagKey FABRIC_SHOVELS = TagAPI.makeItemTag("fabric", "shovels"); - public static final TagKey FABRIC_SWORDS = TagAPI.makeItemTag("fabric", "swords"); + /** + * @deprecated use {@link ToolTags#FABRIC_AXES} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey FABRIC_AXES = ToolTags.FABRIC_AXES; + /** + * @deprecated use {@link ToolTags#FABRIC_HOES} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey FABRIC_HOES = ToolTags.FABRIC_HOES; + /** + * @deprecated use {@link ToolTags#FABRIC_PICKAXES} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey FABRIC_PICKAXES = ToolTags.FABRIC_PICKAXES; + /** + * @deprecated use {@link ToolTags#FABRIC_SHEARS} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey FABRIC_SHEARS = ToolTags.FABRIC_SHEARS; + /** + * @deprecated use {@link ToolTags#FABRIC_SHOVELS} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey FABRIC_SHOVELS = ToolTags.FABRIC_SHOVELS; + /** + * @deprecated use {@link ToolTags#FABRIC_SWORDS} instead + **/ + @Deprecated(forRemoval = true) + public static final TagKey FABRIC_SWORDS = ToolTags.FABRIC_SWORDS; + + } diff --git a/src/main/java/org/betterx/bclib/api/v2/tag/TagAPI.java b/src/main/java/org/betterx/bclib/api/v2/tag/TagAPI.java index 30b3d2a3..71f498d5 100644 --- a/src/main/java/org/betterx/bclib/api/v2/tag/TagAPI.java +++ b/src/main/java/org/betterx/bclib/api/v2/tag/TagAPI.java @@ -1,13 +1,15 @@ package org.betterx.bclib.api.v2.tag; import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI; -import org.betterx.bclib.mixin.common.DiggerItemAccessor; +import org.betterx.worlds.together.mixin.common.DiggerItemAccessor; +import org.betterx.worlds.together.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.TagManager; +import org.betterx.worlds.together.tag.TagRegistry; import net.minecraft.core.DefaultedRegistry; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.tags.TagKey; import net.minecraft.tags.TagLoader; import net.minecraft.world.item.Item; @@ -24,26 +26,55 @@ import java.util.List; import java.util.Map; import java.util.function.Function; +/** + * @deprecated Replaced by {@link TagManager} + */ +@Deprecated(forRemoval = true) public class TagAPI { private static final Map> TYPES = Maps.newHashMap(); + /** + * @deprecated Replaced by {@link TagManager#BLOCKS} + */ + @Deprecated(forRemoval = true) public static TagType.RegistryBacked BLOCKS = registerType(Registry.BLOCK); + /** + * @deprecated Replaced by {@link TagManager#ITEMS} + */ + @Deprecated(forRemoval = true) public static TagType.RegistryBacked ITEMS = registerType(Registry.ITEM); + + /** + * @deprecated Replaced by {@link TagManager#BIOMES} + */ + @Deprecated(forRemoval = true) public static TagType.Simple BIOMES = registerType( Registry.BIOME_REGISTRY, "tags/worldgen/biome", b -> BiomeAPI.getBiomeID(b) ); + /** + * @deprecated Replaced by {@link TagManager#registerType(DefaultedRegistry)} + */ + @Deprecated(forRemoval = true) public static TagType.RegistryBacked registerType(DefaultedRegistry registry) { TagType type = new TagType.RegistryBacked<>(registry); return (TagType.RegistryBacked) TYPES.computeIfAbsent(type.directory, (dir) -> type); } + /** + * @deprecated Replaced by {@link TagManager#registerType(Registry, String)} + */ + @Deprecated(forRemoval = true) public static TagType.Simple registerType(Registry registry, String directory) { return registerType(registry.key(), directory, (o) -> registry.getKey(o)); } + /** + * @deprecated Replaced by {@link TagManager#registerType(ResourceKey, String, Function)} + */ + @Deprecated(forRemoval = true) public static TagType.Simple registerType( ResourceKey> registry, String directory, @@ -59,97 +90,92 @@ public class TagAPI { ); } + /** + * @deprecated Replaced by {@link TagManager#registerType(ResourceKey, String)} + */ + @Deprecated(forRemoval = true) public static TagType.UnTyped registerType(ResourceKey> registry, String directory) { return (TagType.UnTyped) TYPES.computeIfAbsent(directory, (dir) -> new TagType.UnTyped<>(registry, dir)); } /** - * Get or create {@link Block} {@link TagKey} with mod namespace. - * - * @param modID - {@link String} mod namespace (mod id); - * @param name - {@link String} tag name. - * @return {@link Block} {@link TagKey}. + * @deprecated Replaced by {@link TagRegistry#makeTag(String, String)} on {@link TagManager#BIOMES} */ + @Deprecated(forRemoval = true) public static TagKey makeBiomeTag(String modID, String name) { - return BIOMES.makeTag(new ResourceLocation(modID, name)); + return TagManager.BIOMES.makeTag(new ResourceLocation(modID, name)); } + + /** + * @deprecated Replaced by {@link TagRegistry.Biomes#makeStructureTag(String, String)} on {@link TagManager#BIOMES} + */ + @Deprecated(forRemoval = true) public static TagKey makeStructureTag(String modID, String name) { - return TagAPI.makeBiomeTag(modID, "has_structure/" + name); + return TagManager.BIOMES.makeStructureTag(modID, name); } /** - * Get or create {@link Block} {@link TagKey} with mod namespace. - * - * @param modID - {@link String} mod namespace (mod id); - * @param name - {@link String} tag name. - * @return {@link Block} {@link TagKey}. + * @deprecated Replaced by {@link TagRegistry#makeTag(String, String)} on {@link TagManager#BLOCKS} */ + @Deprecated(forRemoval = true) public static TagKey makeBlockTag(String modID, String name) { - return BLOCKS.makeTag(new ResourceLocation(modID, name)); + return TagManager.BLOCKS.makeTag(new ResourceLocation(modID, name)); } /** - * Get or create {@link Block} {@link TagKey} with mod namespace. - * - * @param id - {@link String} id for the tag; - * @return {@link Block} {@link TagKey}. + * @deprecated Replaced by {@link TagRegistry#makeTag(ResourceLocation)} on {@link TagManager#BLOCKS} */ + @Deprecated(forRemoval = true) public static TagKey makeBlockTag(ResourceLocation id) { - return BLOCKS.makeTag(id); + return TagManager.BLOCKS.makeTag(id); } /** - * Get or create {@link Item} {@link TagKey} with mod namespace. - * - * @param modID - {@link String} mod namespace (mod id); - * @param name - {@link String} tag name. - * @return {@link Item} {@link TagKey}. + * @deprecated Replaced by {@link TagRegistry#makeTag(String, String)} on {@link TagManager#ITEMS} */ + @Deprecated(forRemoval = true) public static TagKey makeItemTag(String modID, String name) { - return ITEMS.makeTag(new ResourceLocation(modID, name)); + return TagManager.ITEMS.makeTag(new ResourceLocation(modID, name)); } /** - * Get or create {@link Item} {@link TagKey} with mod namespace. - * - * @param id - {@link String} id for the tag; - * @return {@link Item} {@link TagKey}. + * @deprecated Replaced by {@link TagRegistry#makeTag(ResourceLocation)} on {@link TagManager#ITEMS} */ + @Deprecated(forRemoval = true) public static TagKey makeItemTag(ResourceLocation id) { - return ITEMS.makeTag(id); + return TagManager.ITEMS.makeTag(id); } /** - * Get or create {@link Block} {@link TagKey}. - * - * @param name - {@link String} tag name. - * @return {@link Block} {@link TagKey}. - * @see Fabric Wiki (Tags) + * @deprecated Replaced by {@link TagRegistry#makeCommonTag(String)} on {@link TagManager#BLOCKS} */ + @Deprecated(forRemoval = true) public static TagKey makeCommonBlockTag(String name) { - return BLOCKS.makeCommonTag(name); + return TagManager.BLOCKS.makeCommonTag(name); } /** - * Get or create {@link Item} {@link TagKey}. - * - * @param name - {@link String} tag name. - * @return {@link Item} {@link TagKey}. - * @see Fabric Wiki (Tags) + * @deprecated Replaced by {@link TagRegistry#makeCommonTag(String)} on {@link TagManager#ITEMS} */ + @Deprecated(forRemoval = true) public static TagKey makeCommonItemTag(String name) { - return ITEMS.makeCommonTag(name); + return TagManager.ITEMS.makeCommonTag(name); } + /** + * @deprecated Replaced by {@link TagRegistry#makeCommonTag(String)} on {@link TagManager#BIOMES} + */ + @Deprecated(forRemoval = true) public static TagKey makeCommonBiomeTag(String name) { - return BIOMES.makeCommonTag(name); + return TagManager.BIOMES.makeCommonTag(name); } /** * Initializes basic tags. Should be called only in BCLib main class. */ + @Deprecated(forRemoval = true) public static void init() { addBlockTag(CommonBlockTags.BOOKSHELVES, Blocks.BOOKSHELF); addBlockTag(CommonBlockTags.CHEST, Blocks.CHEST); @@ -159,98 +185,87 @@ public class TagAPI { } /** - * Adds multiple Tags to one Biome. + * Please use {@link TagManager}.BIOMES.add(biome, tagIDs) instead * - * @param tagIDs array of {@link TagKey} tag IDs. - * @param biome The {@link Biome} to add tag. + * @deprecated */ + @Deprecated(forRemoval = true) @SafeVarargs public static void addBiomeTags(Biome biome, TagKey... tagIDs) { - BIOMES.add(biome, tagIDs); + TagManager.BIOMES.add(biome, tagIDs); } + /** - * Adds one Tag to multiple Biomes. + * Please use {@link TagManager}.BIOMES.add(tagID, biomes) instead * - * @param tagID {@link TagKey} tag ID. - * @param biomes array of {@link Biome} to add into tag. + * @deprecated */ + @Deprecated(forRemoval = true) public static void addBiomeTag(TagKey tagID, Biome... biomes) { - BIOMES.add(tagID, biomes); + TagManager.BIOMES.add(tagID, biomes); } /** - * Adds multiple Tags to one Block. + * Please use {@link TagManager}.BLOCKS.add(block, tagIDs) instead * - * @param tagIDs array of {@link TagKey} tag IDs. - * @param block The {@link Block} to add tag. + * @deprecated */ + @Deprecated(forRemoval = true) @SafeVarargs public static void addBlockTags(Block block, TagKey... tagIDs) { - BLOCKS.add(block, tagIDs); + TagManager.BLOCKS.add(block, tagIDs); } /** - * Adds one Tag to multiple Blocks. + * Please use {@link TagManager}.BIOMES.add(tagID, blocks) instead * - * @param tagID {@link TagKey} tag ID. - * @param blocks array of {@link Block} to add into tag. + * @deprecated */ + @Deprecated(forRemoval = true) public static void addBlockTag(TagKey tagID, Block... blocks) { - BLOCKS.add(tagID, blocks); + TagManager.BLOCKS.add(tagID, blocks); } /** - * Adds multiple Tags to one Item. + * Please use {@link TagManager}.ITEMS.add(item, tagIDs) instead * - * @param tagIDs array of {@link TagKey} tag IDs. - * @param item The {@link Item} to add tag. + * @deprecated */ + @Deprecated(forRemoval = true) @SafeVarargs public static void addItemTags(ItemLike item, TagKey... tagIDs) { - ITEMS.add(item.asItem(), tagIDs); + TagManager.ITEMS.add(item.asItem(), tagIDs); } /** - * Adds one Tag to multiple Items. - * - * @param tagID {@link TagKey} tag ID. - * @param items array of {@link ItemLike} to add into tag. + * @deprecated */ + @Deprecated(forRemoval = true) public static void addItemTag(TagKey tagID, ItemLike... items) { for (ItemLike i : items) { - ITEMS.add(i.asItem(), tagID); + TagManager.ITEMS.add(i.asItem(), tagID); } } /** - * Adds one Tag to multiple Items. + * Please use {@link TagManager}.ITEMS.add(tagID, items) instead * - * @param tagID {@link TagKey} tag ID. - * @param items array of {@link ItemLike} to add into tag. + * @deprecated */ + @Deprecated(forRemoval = true) public static void addItemTag(TagKey tagID, Item... items) { - ITEMS.add(tagID, items); + TagManager.ITEMS.add(tagID, items); } - /** - * Automatically called in {@link net.minecraft.tags.TagLoader#loadAndBuild(ResourceManager)}. - *

- * In most cases there is no need to call this Method manually. - * - * @param directory The name of the Tag-directory. Should be either "tags/blocks" or - * "tags/items". - * @param tagsMap The map that will hold the registered Tags - * @return The {@code tagsMap} Parameter. - */ + @Deprecated(forRemoval = true) public static Map> apply( String directory, Map> tagsMap ) { - TagType type = TYPES.get(directory); if (type != null) { type.apply(tagsMap); @@ -259,6 +274,13 @@ public class TagAPI { } + /** + * @param stack + * @param tag + * @return + * @deprecated call {@link TagManager#isToolWithMineableTag(ItemStack, TagKey)} instead + */ + @Deprecated(forRemoval = true) public static boolean isToolWithMineableTag(ItemStack stack, TagKey tag) { if (stack.getItem() instanceof DiggerItemAccessor dig) { return dig.bclib_getBlockTag().equals(tag); diff --git a/src/main/java/org/betterx/bclib/api/v2/tag/TagType.java b/src/main/java/org/betterx/bclib/api/v2/tag/TagType.java index cf7432bd..1e2d0a2c 100644 --- a/src/main/java/org/betterx/bclib/api/v2/tag/TagType.java +++ b/src/main/java/org/betterx/bclib/api/v2/tag/TagType.java @@ -2,6 +2,7 @@ package org.betterx.bclib.api.v2.tag; import org.betterx.bclib.BCLib; import org.betterx.bclib.api.v2.levelgen.biomes.InternalBiomeAPI; +import org.betterx.worlds.together.tag.TagRegistry; import net.minecraft.core.DefaultedRegistry; import net.minecraft.core.Registry; @@ -24,9 +25,17 @@ import java.util.Set; import java.util.function.BiConsumer; import java.util.function.Function; +/** + * @deprecated Replaced by {@link TagRegistry} + */ +@Deprecated(forRemoval = true) public class TagType { boolean isFrozen = false; + /** + * @deprecated Replaced by {@link TagRegistry.RegistryBacked} + */ + @Deprecated(forRemoval = true) public static class RegistryBacked extends Simple { private final DefaultedRegistry registry; @@ -56,6 +65,10 @@ public class TagType { } } + /** + * @deprecated Replaced by {@link TagRegistry.Simple} + */ + @Deprecated(forRemoval = true) public static class Simple extends TagType { Simple( ResourceKey> registry, @@ -84,6 +97,10 @@ public class TagType { } } + /** + * @deprecated Replaced by {@link TagRegistry.UnTyped} + */ + @Deprecated(forRemoval = true) public static class UnTyped extends TagType { UnTyped( ResourceKey> registry, diff --git a/src/main/java/org/betterx/bclib/api/v3/levelgen/features/BlockPredicates.java b/src/main/java/org/betterx/bclib/api/v3/levelgen/features/BlockPredicates.java index 583d2dc1..08397df5 100644 --- a/src/main/java/org/betterx/bclib/api/v3/levelgen/features/BlockPredicates.java +++ b/src/main/java/org/betterx/bclib/api/v3/levelgen/features/BlockPredicates.java @@ -1,6 +1,6 @@ package org.betterx.bclib.api.v3.levelgen.features; -import org.betterx.bclib.api.v2.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.CommonBlockTags; import net.minecraft.tags.BlockTags; import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate; diff --git a/src/main/java/org/betterx/bclib/api/v3/levelgen/features/CommonPlacedFeatureBuilder.java b/src/main/java/org/betterx/bclib/api/v3/levelgen/features/CommonPlacedFeatureBuilder.java index 76cf740c..ed0061a1 100644 --- a/src/main/java/org/betterx/bclib/api/v3/levelgen/features/CommonPlacedFeatureBuilder.java +++ b/src/main/java/org/betterx/bclib/api/v3/levelgen/features/CommonPlacedFeatureBuilder.java @@ -2,7 +2,7 @@ package org.betterx.bclib.api.v3.levelgen.features; import org.betterx.bclib.api.v2.levelgen.features.config.PlaceFacingBlockConfig; import org.betterx.bclib.api.v2.levelgen.features.placement.*; -import org.betterx.bclib.api.v2.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.CommonBlockTags; import net.minecraft.core.Direction; import net.minecraft.core.Holder; diff --git a/src/main/java/org/betterx/bclib/blocks/BaseDoorBlock.java b/src/main/java/org/betterx/bclib/blocks/BaseDoorBlock.java index e15b0c2a..c0b0b036 100644 --- a/src/main/java/org/betterx/bclib/blocks/BaseDoorBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BaseDoorBlock.java @@ -1,7 +1,5 @@ package org.betterx.bclib.blocks; -import org.betterx.bclib.api.v2.tag.NamedBlockTags; -import org.betterx.bclib.api.v2.tag.NamedItemTags; import org.betterx.bclib.client.models.BasePatterns; import org.betterx.bclib.client.models.ModelsHelper; import org.betterx.bclib.client.models.PatternsHelper; @@ -15,6 +13,8 @@ import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.StringRepresentable; import net.minecraft.world.item.Item; @@ -153,8 +153,8 @@ public class BaseDoorBlock extends DoorBlock implements RenderLayerProvider, Blo @Override public void addTags(List> blockTags, List> itemTags) { - blockTags.add(NamedBlockTags.DOORS); - itemTags.add(NamedItemTags.DOORS); + blockTags.add(BlockTags.DOORS); + itemTags.add(ItemTags.DOORS); } protected enum DoorType implements StringRepresentable { diff --git a/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java b/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java index 1909174b..dab46e55 100644 --- a/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java @@ -1,7 +1,5 @@ package org.betterx.bclib.blocks; -import org.betterx.bclib.api.v2.tag.NamedBlockTags; -import org.betterx.bclib.api.v2.tag.NamedItemTags; import org.betterx.bclib.client.render.BCLRenderLayer; import org.betterx.bclib.interfaces.BlockModelProvider; import org.betterx.bclib.interfaces.RenderLayerProvider; @@ -13,6 +11,8 @@ import org.betterx.bclib.util.MHelper; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -117,7 +117,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, @Override public void addTags(List> blockTags, List> itemTags) { - blockTags.add(NamedBlockTags.LEAVES); - itemTags.add(NamedItemTags.LEAVES); + blockTags.add(BlockTags.LEAVES); + itemTags.add(ItemTags.LEAVES); } } diff --git a/src/main/java/org/betterx/bclib/blocks/BaseStripableLogBlock.java b/src/main/java/org/betterx/bclib/blocks/BaseStripableLogBlock.java index 4ba9b780..6211c993 100644 --- a/src/main/java/org/betterx/bclib/blocks/BaseStripableLogBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BaseStripableLogBlock.java @@ -1,7 +1,7 @@ package org.betterx.bclib.blocks; -import org.betterx.bclib.api.v2.tag.NamedMineableTags; -import org.betterx.bclib.api.v2.tag.TagAPI; +import org.betterx.worlds.together.tag.MineableTags; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; @@ -37,7 +37,7 @@ public class BaseStripableLogBlock extends BaseRotatedPillarBlock { InteractionHand hand, BlockHitResult hit ) { - if (TagAPI.isToolWithMineableTag(player.getMainHandItem(), NamedMineableTags.AXE)) { + if (TagManager.isToolWithMineableTag(player.getMainHandItem(), MineableTags.AXE)) { world.playSound(player, pos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); if (!world.isClientSide) { world.setBlock( diff --git a/src/main/java/org/betterx/bclib/blocks/BaseTerrainBlock.java b/src/main/java/org/betterx/bclib/blocks/BaseTerrainBlock.java index 39aa4817..8796a6be 100644 --- a/src/main/java/org/betterx/bclib/blocks/BaseTerrainBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BaseTerrainBlock.java @@ -1,11 +1,11 @@ package org.betterx.bclib.blocks; -import org.betterx.bclib.api.v2.tag.NamedMineableTags; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.client.models.BasePatterns; import org.betterx.bclib.client.models.ModelsHelper; import org.betterx.bclib.client.models.PatternsHelper; import org.betterx.bclib.client.sound.BlockSounds; +import org.betterx.worlds.together.tag.MineableTags; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; @@ -80,7 +80,7 @@ public class BaseTerrainBlock extends BaseBlock { InteractionHand hand, BlockHitResult hit ) { - if (pathBlock != null && TagAPI.isToolWithMineableTag(player.getMainHandItem(), NamedMineableTags.SHOVEL)) { + if (pathBlock != null && TagManager.isToolWithMineableTag(player.getMainHandItem(), MineableTags.SHOVEL)) { world.playSound(player, pos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F); if (!world.isClientSide) { world.setBlockAndUpdate(pos, pathBlock.defaultBlockState()); diff --git a/src/main/java/org/betterx/bclib/blocks/SimpleLeavesBlock.java b/src/main/java/org/betterx/bclib/blocks/SimpleLeavesBlock.java index 6bcef120..4c5bf41a 100644 --- a/src/main/java/org/betterx/bclib/blocks/SimpleLeavesBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/SimpleLeavesBlock.java @@ -1,13 +1,13 @@ package org.betterx.bclib.blocks; -import org.betterx.bclib.api.v2.tag.NamedBlockTags; -import org.betterx.bclib.api.v2.tag.NamedItemTags; import org.betterx.bclib.client.render.BCLRenderLayer; import org.betterx.bclib.interfaces.RenderLayerProvider; import org.betterx.bclib.interfaces.TagProvider; import org.betterx.bclib.interfaces.tools.AddMineableHoe; import org.betterx.bclib.interfaces.tools.AddMineableShears; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -61,7 +61,7 @@ public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerPr @Override public void addTags(List> blockTags, List> itemTags) { - blockTags.add(NamedBlockTags.LEAVES); - itemTags.add(NamedItemTags.LEAVES); + blockTags.add(BlockTags.LEAVES); + itemTags.add(ItemTags.LEAVES); } } \ No newline at end of file diff --git a/src/main/java/org/betterx/bclib/blocks/StripableBarkBlock.java b/src/main/java/org/betterx/bclib/blocks/StripableBarkBlock.java index 5782c31b..17cd0e7b 100644 --- a/src/main/java/org/betterx/bclib/blocks/StripableBarkBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/StripableBarkBlock.java @@ -1,7 +1,7 @@ package org.betterx.bclib.blocks; -import org.betterx.bclib.api.v2.tag.NamedMineableTags; -import org.betterx.bclib.api.v2.tag.TagAPI; +import org.betterx.worlds.together.tag.MineableTags; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; @@ -36,7 +36,7 @@ public class StripableBarkBlock extends BaseBarkBlock { InteractionHand hand, BlockHitResult hit ) { - if (TagAPI.isToolWithMineableTag(player.getMainHandItem(), NamedMineableTags.AXE)) { + if (TagManager.isToolWithMineableTag(player.getMainHandItem(), MineableTags.AXE)) { world.playSound(player, pos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); if (!world.isClientSide) { world.setBlock( diff --git a/src/main/java/org/betterx/bclib/commands/CommandRegistry.java b/src/main/java/org/betterx/bclib/commands/CommandRegistry.java index 6a5b1a85..89d5e794 100644 --- a/src/main/java/org/betterx/bclib/commands/CommandRegistry.java +++ b/src/main/java/org/betterx/bclib/commands/CommandRegistry.java @@ -1,7 +1,7 @@ package org.betterx.bclib.commands; -import org.betterx.bclib.api.v2.tag.CommonBlockTags; import org.betterx.bclib.util.BlocksHelper; +import org.betterx.worlds.together.tag.CommonBlockTags; import com.mojang.brigadier.Command; import com.mojang.brigadier.CommandDispatcher; diff --git a/src/main/java/org/betterx/bclib/complexmaterials/ComplexMaterial.java b/src/main/java/org/betterx/bclib/complexmaterials/ComplexMaterial.java index 6ac61914..860a5523 100644 --- a/src/main/java/org/betterx/bclib/complexmaterials/ComplexMaterial.java +++ b/src/main/java/org/betterx/bclib/complexmaterials/ComplexMaterial.java @@ -1,12 +1,12 @@ package org.betterx.bclib.complexmaterials; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.complexmaterials.entry.BlockEntry; import org.betterx.bclib.complexmaterials.entry.ItemEntry; import org.betterx.bclib.complexmaterials.entry.RecipeEntry; import org.betterx.bclib.config.PathConfig; import org.betterx.bclib.registry.BlockRegistry; import org.betterx.bclib.registry.ItemRegistry; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -112,7 +112,7 @@ public abstract class ComplexMaterial { } /** - * Adds custom block tag for this {@link ComplexMaterial}, tag can be created with {@link TagAPI} or you can use one of already created tags. + * Adds custom block tag for this {@link ComplexMaterial}, tag can be created with {@link TagManager} or you can use one of already created tags. * * @param tag {@link TagKey} for {@link Block} */ @@ -122,7 +122,7 @@ public abstract class ComplexMaterial { } /** - * Adds custom item tag for this {@link ComplexMaterial}, tag can be created with {@link TagAPI} or you can use one of already created tags. + * Adds custom item tag for this {@link ComplexMaterial}, tag can be created with {@link TagManager} or you can use one of already created tags. * * @param tag {@link TagKey} for {@link Item} */ diff --git a/src/main/java/org/betterx/bclib/complexmaterials/WoodenComplexMaterial.java b/src/main/java/org/betterx/bclib/complexmaterials/WoodenComplexMaterial.java index 6ae8c662..0b0c48ec 100644 --- a/src/main/java/org/betterx/bclib/complexmaterials/WoodenComplexMaterial.java +++ b/src/main/java/org/betterx/bclib/complexmaterials/WoodenComplexMaterial.java @@ -1,13 +1,17 @@ package org.betterx.bclib.complexmaterials; import org.betterx.bclib.BCLib; -import org.betterx.bclib.api.v2.tag.*; import org.betterx.bclib.blocks.*; import org.betterx.bclib.complexmaterials.entry.BlockEntry; import org.betterx.bclib.complexmaterials.entry.RecipeEntry; import org.betterx.bclib.recipes.GridRecipe; +import org.betterx.worlds.together.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.CommonItemTags; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; @@ -73,8 +77,8 @@ public class WoodenComplexMaterial extends ComplexMaterial { @Override protected void initTags() { - addBlockTag(TagAPI.makeBlockTag(getModID(), getBaseName() + "_logs")); - addItemTag(TagAPI.makeItemTag(getModID(), getBaseName() + "_logs")); + addBlockTag(TagManager.BLOCKS.makeTag(getModID(), getBaseName() + "_logs")); + addItemTag(TagManager.ITEMS.makeTag(getModID(), getBaseName() + "_logs")); } @Override @@ -90,13 +94,13 @@ public class WoodenComplexMaterial extends ComplexMaterial { addBlockEntry( new BlockEntry(BLOCK_STRIPPED_LOG, (complexMaterial, settings) -> new BaseRotatedPillarBlock(settings)) - .setBlockTags(NamedBlockTags.LOGS, NamedBlockTags.LOGS_THAT_BURN, tagBlockLog) - .setItemTags(NamedItemTags.LOGS, NamedItemTags.LOGS_THAT_BURN, tagItemLog) + .setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog) + .setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog) ); addBlockEntry( new BlockEntry(BLOCK_STRIPPED_BARK, (complexMaterial, settings) -> new BaseBarkBlock(settings)) - .setBlockTags(NamedBlockTags.LOGS, NamedBlockTags.LOGS_THAT_BURN, tagBlockLog) - .setItemTags(NamedItemTags.LOGS, NamedItemTags.LOGS_THAT_BURN, tagItemLog) + .setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog) + .setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog) ); addBlockEntry( @@ -107,8 +111,8 @@ public class WoodenComplexMaterial extends ComplexMaterial { getBlock(BLOCK_STRIPPED_LOG) ) ) - .setBlockTags(NamedBlockTags.LOGS, NamedBlockTags.LOGS_THAT_BURN, tagBlockLog) - .setItemTags(NamedItemTags.LOGS, NamedItemTags.LOGS_THAT_BURN, tagItemLog) + .setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog) + .setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog) ); addBlockEntry( new BlockEntry( @@ -118,80 +122,80 @@ public class WoodenComplexMaterial extends ComplexMaterial { getBlock(BLOCK_STRIPPED_BARK) ) ) - .setBlockTags(NamedBlockTags.LOGS, NamedBlockTags.LOGS_THAT_BURN, tagBlockLog) - .setItemTags(NamedItemTags.LOGS, NamedItemTags.LOGS_THAT_BURN, tagItemLog) + .setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog) + .setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog) ); addBlockEntry(new BlockEntry(BLOCK_PLANKS, (complexMaterial, settings) -> new BaseBlock(settings)) - .setBlockTags(NamedBlockTags.PLANKS) - .setItemTags(NamedItemTags.PLANKS)); + .setBlockTags(BlockTags.PLANKS) + .setItemTags(ItemTags.PLANKS)); addBlockEntry(new BlockEntry( BLOCK_STAIRS, (complexMaterial, settings) -> new BaseStairsBlock(getBlock(BLOCK_PLANKS), false) ) - .setBlockTags(NamedBlockTags.WOODEN_STAIRS, NamedBlockTags.STAIRS) - .setItemTags(NamedItemTags.WOODEN_STAIRS, NamedItemTags.STAIRS)); + .setBlockTags(BlockTags.WOODEN_STAIRS, BlockTags.STAIRS) + .setItemTags(ItemTags.WOODEN_STAIRS, ItemTags.STAIRS)); addBlockEntry(new BlockEntry( BLOCK_SLAB, (complexMaterial, settings) -> new BaseSlabBlock(getBlock(BLOCK_PLANKS), false) ) - .setBlockTags(NamedBlockTags.WOODEN_SLABS, NamedBlockTags.SLABS) - .setItemTags(NamedItemTags.WOODEN_SLABS, NamedItemTags.SLABS)); + .setBlockTags(BlockTags.WOODEN_SLABS, BlockTags.SLABS) + .setItemTags(ItemTags.WOODEN_SLABS, ItemTags.SLABS)); addBlockEntry(new BlockEntry( BLOCK_FENCE, (complexMaterial, settings) -> new BaseFenceBlock(getBlock(BLOCK_PLANKS)) ) - .setBlockTags(NamedBlockTags.FENCES, NamedBlockTags.WOODEN_FENCES) - .setItemTags(NamedItemTags.FENCES, NamedItemTags.WOODEN_FENCES)); + .setBlockTags(BlockTags.FENCES, BlockTags.WOODEN_FENCES) + .setItemTags(ItemTags.FENCES, ItemTags.WOODEN_FENCES)); addBlockEntry(new BlockEntry( BLOCK_GATE, (complexMaterial, settings) -> new BaseGateBlock(getBlock(BLOCK_PLANKS)) ) - .setBlockTags(NamedBlockTags.FENCE_GATES)); + .setBlockTags(BlockTags.FENCE_GATES)); addBlockEntry(new BlockEntry( BLOCK_BUTTON, (complexMaterial, settings) -> new BaseWoodenButtonBlock(getBlock(BLOCK_PLANKS)) ) - .setBlockTags(NamedBlockTags.BUTTONS, NamedBlockTags.WOODEN_BUTTONS) - .setItemTags(NamedItemTags.BUTTONS, NamedItemTags.WOODEN_BUTTONS)); + .setBlockTags(BlockTags.BUTTONS, BlockTags.WOODEN_BUTTONS) + .setItemTags(ItemTags.BUTTONS, ItemTags.WOODEN_BUTTONS)); addBlockEntry(new BlockEntry( BLOCK_PRESSURE_PLATE, (complexMaterial, settings) -> new WoodenPressurePlateBlock(getBlock(BLOCK_PLANKS)) ) - .setBlockTags(NamedBlockTags.PRESSURE_PLATES, NamedBlockTags.WOODEN_PRESSURE_PLATES) - .setItemTags(NamedItemTags.WOODEN_PRESSURE_PLATES)); + .setBlockTags(BlockTags.PRESSURE_PLATES, BlockTags.WOODEN_PRESSURE_PLATES) + .setItemTags(ItemTags.WOODEN_PRESSURE_PLATES)); addBlockEntry(new BlockEntry( BLOCK_TRAPDOOR, (complexMaterial, settings) -> new BaseTrapdoorBlock(getBlock(BLOCK_PLANKS)) ) - .setBlockTags(NamedBlockTags.TRAPDOORS, NamedBlockTags.WOODEN_TRAPDOORS) - .setItemTags(NamedItemTags.TRAPDOORS, NamedItemTags.WOODEN_TRAPDOORS)); + .setBlockTags(BlockTags.TRAPDOORS, BlockTags.WOODEN_TRAPDOORS) + .setItemTags(ItemTags.TRAPDOORS, ItemTags.WOODEN_TRAPDOORS)); addBlockEntry(new BlockEntry( BLOCK_DOOR, (complexMaterial, settings) -> new BaseDoorBlock(getBlock(BLOCK_PLANKS)) ) - .setBlockTags(NamedBlockTags.DOORS, NamedBlockTags.WOODEN_DOORS) - .setItemTags(NamedItemTags.DOORS, NamedItemTags.WOODEN_DOORS)); + .setBlockTags(BlockTags.DOORS, BlockTags.WOODEN_DOORS) + .setItemTags(ItemTags.DOORS, ItemTags.WOODEN_DOORS)); addBlockEntry(new BlockEntry( BLOCK_LADDER, (complexMaterial, settings) -> new BaseLadderBlock(getBlock(BLOCK_PLANKS)) ) - .setBlockTags(NamedBlockTags.CLIMBABLE)); + .setBlockTags(BlockTags.CLIMBABLE)); addBlockEntry(new BlockEntry( BLOCK_SIGN, (complexMaterial, settings) -> new BaseSignBlock(getBlock(BLOCK_PLANKS)) ) - .setBlockTags(NamedBlockTags.SIGNS) - .setItemTags(NamedItemTags.SIGNS)); + .setBlockTags(BlockTags.SIGNS) + .setItemTags(ItemTags.SIGNS)); } final protected void initStorage(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) { diff --git a/src/main/java/org/betterx/bclib/complexmaterials/entry/BlockEntry.java b/src/main/java/org/betterx/bclib/complexmaterials/entry/BlockEntry.java index 4778f044..5a10d379 100644 --- a/src/main/java/org/betterx/bclib/complexmaterials/entry/BlockEntry.java +++ b/src/main/java/org/betterx/bclib/complexmaterials/entry/BlockEntry.java @@ -1,8 +1,8 @@ package org.betterx.bclib.complexmaterials.entry; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.complexmaterials.ComplexMaterial; import org.betterx.bclib.registry.BlockRegistry; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -50,13 +50,13 @@ public class BlockEntry extends ComplexMaterialEntry { if (hasItem) { registry.register(location, block); if (itemTags != null) { - TagAPI.addItemTags(block, itemTags); + TagManager.ITEMS.add(block.asItem(), itemTags); } } else { registry.registerBlockOnly(location, block); } if (blockTags != null) { - TagAPI.addBlockTags(block, blockTags); + TagManager.BLOCKS.add(block, blockTags); } return block; } diff --git a/src/main/java/org/betterx/bclib/complexmaterials/entry/ItemEntry.java b/src/main/java/org/betterx/bclib/complexmaterials/entry/ItemEntry.java index d5b493f7..a177bcc8 100644 --- a/src/main/java/org/betterx/bclib/complexmaterials/entry/ItemEntry.java +++ b/src/main/java/org/betterx/bclib/complexmaterials/entry/ItemEntry.java @@ -1,8 +1,8 @@ package org.betterx.bclib.complexmaterials.entry; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.complexmaterials.ComplexMaterial; import org.betterx.bclib.registry.ItemRegistry; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -32,7 +32,7 @@ public class ItemEntry extends ComplexMaterialEntry { Item item = initFunction.apply(material, itemSettings); registry.register(location, item); if (itemTags != null) { - TagAPI.addItemTags(item, itemTags); + TagManager.ITEMS.add(item, itemTags); } return item; } diff --git a/src/main/java/org/betterx/bclib/integration/ModIntegration.java b/src/main/java/org/betterx/bclib/integration/ModIntegration.java index 91b74f9b..0959ed81 100644 --- a/src/main/java/org/betterx/bclib/integration/ModIntegration.java +++ b/src/main/java/org/betterx/bclib/integration/ModIntegration.java @@ -2,7 +2,7 @@ package org.betterx.bclib.integration; import org.betterx.bclib.BCLib; import org.betterx.bclib.api.v2.levelgen.features.BCLFeature; -import org.betterx.bclib.api.v2.tag.TagAPI; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.core.Holder; import net.minecraft.core.Registry; @@ -211,11 +211,11 @@ public abstract class ModIntegration { public TagKey getItemTag(String name) { ResourceLocation id = getID(name); - return TagAPI.makeItemTag(id); + return TagManager.ITEMS.makeTag(id); } public TagKey getBlockTag(String name) { ResourceLocation id = getID(name); - return TagAPI.makeBlockTag(id); + return TagManager.BLOCKS.makeTag(id); } } diff --git a/src/main/java/org/betterx/bclib/items/tool/BaseShearsItem.java b/src/main/java/org/betterx/bclib/items/tool/BaseShearsItem.java index 81b3fcd0..6bb90a9c 100644 --- a/src/main/java/org/betterx/bclib/items/tool/BaseShearsItem.java +++ b/src/main/java/org/betterx/bclib/items/tool/BaseShearsItem.java @@ -1,8 +1,8 @@ package org.betterx.bclib.items.tool; -import org.betterx.bclib.api.v2.tag.CommonItemTags; -import org.betterx.bclib.api.v2.tag.TagAPI; +import org.betterx.worlds.together.tag.CommonItemTags; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -17,7 +17,7 @@ public class BaseShearsItem extends ShearsItem { } public static boolean isShear(ItemStack tool) { - return tool.is(Items.SHEARS) | tool.is(CommonItemTags.SHEARS) || TagAPI.isToolWithMineableTag( + return tool.is(Items.SHEARS) | tool.is(CommonItemTags.SHEARS) || TagManager.isToolWithMineableTag( tool, FabricMineableTags.SHEARS_MINEABLE ); diff --git a/src/main/java/org/betterx/bclib/mixin/common/CraftingMenuMixin.java b/src/main/java/org/betterx/bclib/mixin/common/CraftingMenuMixin.java index 70d4ef41..9a131e66 100644 --- a/src/main/java/org/betterx/bclib/mixin/common/CraftingMenuMixin.java +++ b/src/main/java/org/betterx/bclib/mixin/common/CraftingMenuMixin.java @@ -1,6 +1,6 @@ package org.betterx.bclib.mixin.common; -import org.betterx.bclib.api.v2.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.CommonBlockTags; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.ContainerLevelAccess; diff --git a/src/main/java/org/betterx/bclib/mixin/common/EnchantingTableBlockMixin.java b/src/main/java/org/betterx/bclib/mixin/common/EnchantingTableBlockMixin.java index 9b53d0ed..c93945f3 100644 --- a/src/main/java/org/betterx/bclib/mixin/common/EnchantingTableBlockMixin.java +++ b/src/main/java/org/betterx/bclib/mixin/common/EnchantingTableBlockMixin.java @@ -1,7 +1,7 @@ package org.betterx.bclib.mixin.common; -import org.betterx.bclib.api.v2.tag.CommonBlockTags; import org.betterx.bclib.util.MethodReplace; +import org.betterx.worlds.together.tag.CommonBlockTags; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; diff --git a/src/main/java/org/betterx/bclib/mixin/common/PistonBaseBlockMixin.java b/src/main/java/org/betterx/bclib/mixin/common/PistonBaseBlockMixin.java index d7990f74..0c40bb79 100644 --- a/src/main/java/org/betterx/bclib/mixin/common/PistonBaseBlockMixin.java +++ b/src/main/java/org/betterx/bclib/mixin/common/PistonBaseBlockMixin.java @@ -1,6 +1,6 @@ package org.betterx.bclib.mixin.common; -import org.betterx.bclib.api.v2.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.CommonBlockTags; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/org/betterx/bclib/mixin/common/PortalShapeMixin.java b/src/main/java/org/betterx/bclib/mixin/common/PortalShapeMixin.java index 572ccb88..6d96ce30 100644 --- a/src/main/java/org/betterx/bclib/mixin/common/PortalShapeMixin.java +++ b/src/main/java/org/betterx/bclib/mixin/common/PortalShapeMixin.java @@ -1,6 +1,6 @@ package org.betterx.bclib.mixin.common; -import org.betterx.bclib.api.v2.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.CommonBlockTags; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; diff --git a/src/main/java/org/betterx/bclib/mixin/common/shears/ItemPredicateBuilderMixin.java b/src/main/java/org/betterx/bclib/mixin/common/shears/ItemPredicateBuilderMixin.java index e05639a8..b4e925f9 100644 --- a/src/main/java/org/betterx/bclib/mixin/common/shears/ItemPredicateBuilderMixin.java +++ b/src/main/java/org/betterx/bclib/mixin/common/shears/ItemPredicateBuilderMixin.java @@ -1,6 +1,6 @@ package org.betterx.bclib.mixin.common.shears; -import org.betterx.bclib.api.v2.tag.CommonItemTags; +import org.betterx.worlds.together.tag.CommonItemTags; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.world.item.Item; diff --git a/src/main/java/org/betterx/bclib/presets/FlatLevelPresets.java b/src/main/java/org/betterx/bclib/presets/FlatLevelPresets.java index 04a2c11e..46490231 100644 --- a/src/main/java/org/betterx/bclib/presets/FlatLevelPresets.java +++ b/src/main/java/org/betterx/bclib/presets/FlatLevelPresets.java @@ -1,6 +1,6 @@ package org.betterx.bclib.presets; -import org.betterx.bclib.api.v2.tag.TagType; +import org.betterx.worlds.together.tag.TagRegistry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -15,7 +15,7 @@ public class FlatLevelPresets { * @deprecated Use {@link org.betterx.worlds.together.flatLevel.FlatLevelPresets#FLAT_LEVEL_PRESETS} instead */ @Deprecated(forRemoval = true) - public static TagType.Simple FLAT_LEVEL_PRESETS = org.betterx.worlds.together.flatLevel.FlatLevelPresets.FLAT_LEVEL_PRESETS; + public static TagRegistry.Simple FLAT_LEVEL_PRESETS = org.betterx.worlds.together.flatLevel.FlatLevelPresets.FLAT_LEVEL_PRESETS; /** diff --git a/src/main/java/org/betterx/bclib/recipes/AnvilRecipe.java b/src/main/java/org/betterx/bclib/recipes/AnvilRecipe.java index cb960998..0ccead06 100644 --- a/src/main/java/org/betterx/bclib/recipes/AnvilRecipe.java +++ b/src/main/java/org/betterx/bclib/recipes/AnvilRecipe.java @@ -1,11 +1,11 @@ package org.betterx.bclib.recipes; import org.betterx.bclib.BCLib; -import org.betterx.bclib.api.v2.tag.CommonItemTags; import org.betterx.bclib.config.PathConfig; import org.betterx.bclib.interfaces.UnknownReceipBookCategory; import org.betterx.bclib.util.ItemUtil; import org.betterx.bclib.util.RecipeHelper; +import org.betterx.worlds.together.tag.CommonItemTags; import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.minecraft.core.NonNullList; diff --git a/src/main/java/org/betterx/bclib/recipes/CraftingRecipes.java b/src/main/java/org/betterx/bclib/recipes/CraftingRecipes.java index 6c40269d..ad98896e 100644 --- a/src/main/java/org/betterx/bclib/recipes/CraftingRecipes.java +++ b/src/main/java/org/betterx/bclib/recipes/CraftingRecipes.java @@ -1,8 +1,8 @@ package org.betterx.bclib.recipes; import org.betterx.bclib.BCLib; -import org.betterx.bclib.api.v2.tag.CommonItemTags; import org.betterx.bclib.config.Configs; +import org.betterx.worlds.together.tag.CommonItemTags; import net.minecraft.tags.ItemTags; import net.minecraft.world.item.Items; diff --git a/src/main/java/org/betterx/bclib/registry/BlockRegistry.java b/src/main/java/org/betterx/bclib/registry/BlockRegistry.java index 21f346b2..16423f07 100644 --- a/src/main/java/org/betterx/bclib/registry/BlockRegistry.java +++ b/src/main/java/org/betterx/bclib/registry/BlockRegistry.java @@ -1,14 +1,19 @@ package org.betterx.bclib.registry; -import org.betterx.bclib.api.v2.tag.*; import org.betterx.bclib.blocks.BaseLeavesBlock; import org.betterx.bclib.blocks.BaseOreBlock; import org.betterx.bclib.blocks.FeatureSaplingBlock; import org.betterx.bclib.config.PathConfig; import org.betterx.bclib.interfaces.CustomItemProvider; +import org.betterx.worlds.together.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.CommonItemTags; +import org.betterx.worlds.together.tag.MineableTags; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; @@ -45,22 +50,22 @@ public class BlockRegistry extends BaseRegistry { getModBlocks(id.getNamespace()).add(block); if (block instanceof BaseLeavesBlock) { - TagAPI.addBlockTags( + TagManager.BLOCKS.add( block, - NamedBlockTags.LEAVES, + BlockTags.LEAVES, CommonBlockTags.LEAVES, - NamedMineableTags.HOE, - NamedMineableTags.SHEARS + MineableTags.HOE, + MineableTags.SHEARS ); if (item != null) { - TagAPI.addItemTags(item, CommonItemTags.LEAVES, NamedItemTags.LEAVES); + TagManager.ITEMS.add(item, CommonItemTags.LEAVES, ItemTags.LEAVES); } } else if (block instanceof BaseOreBlock) { - TagAPI.addBlockTags(block, NamedMineableTags.PICKAXE); + TagManager.BLOCKS.add(block, MineableTags.PICKAXE); } else if (block instanceof FeatureSaplingBlock) { - TagAPI.addBlockTags(block, CommonBlockTags.SAPLINGS, NamedBlockTags.SAPLINGS); + TagManager.BLOCKS.add(block, CommonBlockTags.SAPLINGS, BlockTags.SAPLINGS); if (item != null) { - TagAPI.addItemTags(item, CommonItemTags.SAPLINGS, NamedItemTags.SAPLINGS); + TagManager.ITEMS.add(item, CommonItemTags.SAPLINGS, ItemTags.SAPLINGS); } } diff --git a/src/main/java/org/betterx/bclib/registry/ItemRegistry.java b/src/main/java/org/betterx/bclib/registry/ItemRegistry.java index 607a727d..531bf207 100644 --- a/src/main/java/org/betterx/bclib/registry/ItemRegistry.java +++ b/src/main/java/org/betterx/bclib/registry/ItemRegistry.java @@ -1,8 +1,5 @@ package org.betterx.bclib.registry; -import org.betterx.bclib.api.v2.tag.CommonItemTags; -import org.betterx.bclib.api.v2.tag.NamedToolTags; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.config.PathConfig; import org.betterx.bclib.items.BaseDiscItem; import org.betterx.bclib.items.BaseDrinkItem; @@ -12,6 +9,9 @@ import org.betterx.bclib.items.tool.BaseAxeItem; import org.betterx.bclib.items.tool.BaseHoeItem; import org.betterx.bclib.items.tool.BasePickaxeItem; import org.betterx.bclib.items.tool.BaseShearsItem; +import org.betterx.worlds.together.tag.CommonItemTags; +import org.betterx.worlds.together.tag.TagManager; +import org.betterx.worlds.together.tag.ToolTags; import net.minecraft.core.BlockSource; import net.minecraft.core.Direction; @@ -66,17 +66,17 @@ public class ItemRegistry extends BaseRegistry { registerItem(itemId, item); if (item instanceof ShovelItem) { - TagAPI.addItemTag(NamedToolTags.FABRIC_SHOVELS, item); + TagManager.ITEMS.add(ToolTags.FABRIC_SHOVELS, item); } else if (item instanceof SwordItem) { - TagAPI.addItemTag(NamedToolTags.FABRIC_SWORDS, item); + TagManager.ITEMS.add(ToolTags.FABRIC_SWORDS, item); } else if (item instanceof BasePickaxeItem) { - TagAPI.addItemTag(NamedToolTags.FABRIC_PICKAXES, item); + TagManager.ITEMS.add(ToolTags.FABRIC_PICKAXES, item); } else if (item instanceof BaseAxeItem) { - TagAPI.addItemTag(NamedToolTags.FABRIC_AXES, item); + TagManager.ITEMS.add(ToolTags.FABRIC_AXES, item); } else if (item instanceof BaseHoeItem) { - TagAPI.addItemTag(NamedToolTags.FABRIC_HOES, item); + TagManager.ITEMS.add(ToolTags.FABRIC_HOES, item); } else if (item instanceof BaseShearsItem) { - TagAPI.addItemTags(item, NamedToolTags.FABRIC_SHEARS, CommonItemTags.SHEARS); + TagManager.ITEMS.add(item, ToolTags.FABRIC_SHEARS, CommonItemTags.SHEARS); DispenserBlock.registerBehavior(item.asItem(), new ShearsDispenseItemBehavior()); } diff --git a/src/main/java/org/betterx/bclib/util/BlocksHelper.java b/src/main/java/org/betterx/bclib/util/BlocksHelper.java index 7702ad22..31bfee90 100644 --- a/src/main/java/org/betterx/bclib/util/BlocksHelper.java +++ b/src/main/java/org/betterx/bclib/util/BlocksHelper.java @@ -1,6 +1,6 @@ package org.betterx.bclib.util; -import org.betterx.bclib.api.v2.tag.CommonBlockTags; +import org.betterx.worlds.together.tag.CommonBlockTags; import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos.MutableBlockPos; diff --git a/src/main/java/org/betterx/bclib/world/structures/BCLStructure.java b/src/main/java/org/betterx/bclib/world/structures/BCLStructure.java index bfd004de..23ae465c 100644 --- a/src/main/java/org/betterx/bclib/world/structures/BCLStructure.java +++ b/src/main/java/org/betterx/bclib/world/structures/BCLStructure.java @@ -1,8 +1,8 @@ package org.betterx.bclib.world.structures; import org.betterx.bclib.api.v2.levelgen.structures.BCLStructureBuilder; -import org.betterx.bclib.api.v2.tag.TagAPI; import org.betterx.bclib.util.MHelper; +import org.betterx.worlds.together.tag.TagManager; import com.mojang.serialization.Codec; import net.minecraft.resources.ResourceLocation; @@ -69,7 +69,7 @@ public class BCLStructure extends org.betterx.bclib.api.v2. separation, adaptNoise, Structure.simpleCodec(structureBuilder), - TagAPI.makeStructureTag(id.getNamespace(), id.getPath()) + TagManager.BIOMES.makeStructureTag(id.getNamespace(), id.getPath()) ); } diff --git a/src/main/java/org/betterx/worlds/together/WorldsTogether.java b/src/main/java/org/betterx/worlds/together/WorldsTogether.java index 31a4f6cf..ff9c5ee2 100644 --- a/src/main/java/org/betterx/worlds/together/WorldsTogether.java +++ b/src/main/java/org/betterx/worlds/together/WorldsTogether.java @@ -1,6 +1,7 @@ package org.betterx.worlds.together; import org.betterx.bclib.util.Logger; +import org.betterx.worlds.together.tag.TagManager; import org.betterx.worlds.together.world.WorldConfig; import org.betterx.worlds.together.worldPreset.WorldPresets; @@ -21,8 +22,12 @@ public class WorldsTogether { } public static void onInitialize() { + TagManager.ensureStaticallyLoaded(); + + WorldConfig.registerModCache(WorldsTogether.MOD_ID); WorldPresets.ensureStaticallyLoaded(); + } public static ResourceLocation makeID(String s) { diff --git a/src/main/java/org/betterx/worlds/together/flatLevel/FlatLevelPresets.java b/src/main/java/org/betterx/worlds/together/flatLevel/FlatLevelPresets.java index e4881cae..4a12f44c 100644 --- a/src/main/java/org/betterx/worlds/together/flatLevel/FlatLevelPresets.java +++ b/src/main/java/org/betterx/worlds/together/flatLevel/FlatLevelPresets.java @@ -1,7 +1,7 @@ package org.betterx.worlds.together.flatLevel; -import org.betterx.bclib.api.v2.tag.TagAPI; -import org.betterx.bclib.api.v2.tag.TagType; +import org.betterx.worlds.together.tag.TagManager; +import org.betterx.worlds.together.tag.TagRegistry; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; @@ -10,8 +10,8 @@ import net.minecraft.tags.FlatLevelGeneratorPresetTags; import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPreset; public class FlatLevelPresets { - public static TagType.Simple FLAT_LEVEL_PRESETS = - TagAPI.registerType( + public static TagRegistry.Simple FLAT_LEVEL_PRESETS = + TagManager.registerType( Registry.FLAT_LEVEL_GENERATOR_PRESET_REGISTRY, "tags/worldgen/flat_level_generator_preset", (b) -> null diff --git a/src/main/java/org/betterx/bclib/mixin/common/DiggerItemAccessor.java b/src/main/java/org/betterx/worlds/together/mixin/common/DiggerItemAccessor.java similarity index 88% rename from src/main/java/org/betterx/bclib/mixin/common/DiggerItemAccessor.java rename to src/main/java/org/betterx/worlds/together/mixin/common/DiggerItemAccessor.java index faa955f6..9acf4f48 100644 --- a/src/main/java/org/betterx/bclib/mixin/common/DiggerItemAccessor.java +++ b/src/main/java/org/betterx/worlds/together/mixin/common/DiggerItemAccessor.java @@ -1,4 +1,4 @@ -package org.betterx.bclib.mixin.common; +package org.betterx.worlds.together.mixin.common; import net.minecraft.tags.TagKey; import net.minecraft.world.item.DiggerItem; diff --git a/src/main/java/org/betterx/bclib/mixin/common/TagLoaderMixin.java b/src/main/java/org/betterx/worlds/together/mixin/common/TagLoaderMixin.java similarity index 83% rename from src/main/java/org/betterx/bclib/mixin/common/TagLoaderMixin.java rename to src/main/java/org/betterx/worlds/together/mixin/common/TagLoaderMixin.java index afbdef67..333dbaf4 100644 --- a/src/main/java/org/betterx/bclib/mixin/common/TagLoaderMixin.java +++ b/src/main/java/org/betterx/worlds/together/mixin/common/TagLoaderMixin.java @@ -1,6 +1,6 @@ -package org.betterx.bclib.mixin.common; +package org.betterx.worlds.together.mixin.common; -import org.betterx.bclib.api.v2.tag.TagAPI; +import org.betterx.worlds.together.tag.TagManager; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagLoader; @@ -22,6 +22,6 @@ public class TagLoaderMixin { @ModifyArg(method = "loadAndBuild", at = @At(value = "INVOKE", target = "Lnet/minecraft/tags/TagLoader;build(Ljava/util/Map;)Ljava/util/Map;")) public Map> be_modifyTags(Map> tagsMap) { - return TagAPI.apply(directory, tagsMap); + return TagManager.apply(directory, tagsMap); } } diff --git a/src/main/java/org/betterx/worlds/together/tag/CommonBiomeTags.java b/src/main/java/org/betterx/worlds/together/tag/CommonBiomeTags.java new file mode 100644 index 00000000..db2d4be7 --- /dev/null +++ b/src/main/java/org/betterx/worlds/together/tag/CommonBiomeTags.java @@ -0,0 +1,11 @@ +package org.betterx.worlds.together.tag; + +import net.minecraft.tags.TagKey; +import net.minecraft.world.level.biome.Biome; + +public class CommonBiomeTags { + public static final TagKey IN_NETHER = TagManager.BIOMES.makeCommonTag("in_nether"); + + static void prepareTags() { + } +} diff --git a/src/main/java/org/betterx/worlds/together/tag/CommonBlockTags.java b/src/main/java/org/betterx/worlds/together/tag/CommonBlockTags.java new file mode 100644 index 00000000..d35aa9f9 --- /dev/null +++ b/src/main/java/org/betterx/worlds/together/tag/CommonBlockTags.java @@ -0,0 +1,110 @@ +package org.betterx.worlds.together.tag; + +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.TagKey; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; + +public class CommonBlockTags { + public static final TagKey BARREL = TagManager.BLOCKS.makeCommonTag("barrel"); + public static final TagKey BOOKSHELVES = TagManager.BLOCKS.makeCommonTag("bookshelves"); + public static final TagKey CHEST = TagManager.BLOCKS.makeCommonTag("chest"); + public static final TagKey END_STONES = TagManager.BLOCKS.makeCommonTag("end_stones"); + public static final TagKey GEN_END_STONES = END_STONES; + public static final TagKey IMMOBILE = TagManager.BLOCKS.makeCommonTag("immobile"); + public static final TagKey LEAVES = TagManager.BLOCKS.makeCommonTag("leaves"); + public static final TagKey NETHERRACK = TagManager.BLOCKS.makeCommonTag("netherrack"); + public static final TagKey MYCELIUM = TagManager.BLOCKS.makeCommonTag("mycelium"); + public static final TagKey NETHER_MYCELIUM = TagManager.BLOCKS.makeCommonTag("nether_mycelium"); + public static final TagKey NETHER_PORTAL_FRAME = TagManager.BLOCKS.makeCommonTag("nether_pframe"); + public static final TagKey NETHER_STONES = TagManager.BLOCKS.makeCommonTag("nether_stones"); + public static final TagKey NETHER_ORES = TagManager.BLOCKS.makeCommonTag("nether_ores"); + public static final TagKey END_ORES = TagManager.BLOCKS.makeCommonTag("end_ores"); + public static final TagKey SAPLINGS = TagManager.BLOCKS.makeCommonTag("saplings"); + public static final TagKey SOUL_GROUND = TagManager.BLOCKS.makeCommonTag("soul_ground"); + public static final TagKey WOODEN_BARREL = TagManager.BLOCKS.makeCommonTag("wooden_barrels"); + public static final TagKey WOODEN_CHEST = TagManager.BLOCKS.makeCommonTag("wooden_chests"); + public static final TagKey WORKBENCHES = TagManager.BLOCKS.makeCommonTag("workbench"); + + public static final TagKey DRAGON_IMMUNE = TagManager.BLOCKS.makeCommonTag("dragon_immune"); + + public static final TagKey MINABLE_WITH_HAMMER = TagManager.BLOCKS.makeCommonTag("mineable/hammer"); + + public static final TagKey IS_OBSIDIAN = TagManager.BLOCKS.makeCommonTag("is_obsidian"); + public static final TagKey TERRAIN = TagManager.BLOCKS.makeCommonTag("terrain"); + public static final TagKey NETHER_TERRAIN = TagManager.BLOCKS.makeCommonTag("nether_terrain"); + + static void prepareTags() { + TagManager.BLOCKS.addOtherTags(DRAGON_IMMUNE, BlockTags.DRAGON_IMMUNE); + + TagManager.BLOCKS.add(END_STONES, Blocks.END_STONE); + TagManager.BLOCKS.addOtherTags(NETHER_STONES, BlockTags.BASE_STONE_NETHER); + + TagManager.BLOCKS.add( + NETHERRACK, + Blocks.NETHERRACK, + Blocks.NETHER_QUARTZ_ORE, + Blocks.NETHER_GOLD_ORE, + Blocks.CRIMSON_NYLIUM, + Blocks.WARPED_NYLIUM + ); + + TagManager.BLOCKS.add(NETHER_ORES, Blocks.NETHER_QUARTZ_ORE, Blocks.NETHER_GOLD_ORE); + TagManager.BLOCKS.add(SOUL_GROUND, Blocks.SOUL_SAND, Blocks.SOUL_SOIL); + + TagManager.BLOCKS.add(IS_OBSIDIAN, Blocks.OBSIDIAN, Blocks.CRYING_OBSIDIAN); + + TagManager.BLOCKS.add(MYCELIUM, Blocks.MYCELIUM); + TagManager.BLOCKS.addOtherTags(MYCELIUM, NETHER_MYCELIUM); + + + TagManager.BLOCKS.add( + TERRAIN, + Blocks.MAGMA_BLOCK, + Blocks.GRAVEL, + Blocks.SAND, + Blocks.RED_SAND, + Blocks.GLOWSTONE, + Blocks.BONE_BLOCK, + Blocks.SCULK + ); + TagManager.BLOCKS.addOtherTags( + TERRAIN, + NETHER_TERRAIN, + BlockTags.DRIPSTONE_REPLACEABLE, + BlockTags.BASE_STONE_OVERWORLD, + BlockTags.NYLIUM, + MYCELIUM, + END_STONES + ); + + TagManager.BLOCKS.add( + NETHER_TERRAIN, + Blocks.MAGMA_BLOCK, + Blocks.GRAVEL, + Blocks.RED_SAND, + Blocks.GLOWSTONE, + Blocks.BONE_BLOCK, + Blocks.SCULK + ); + TagManager.BLOCKS.addOtherTags( + NETHER_TERRAIN, + NETHERRACK, + BlockTags.NYLIUM, + NETHER_STONES, + NETHER_ORES, + SOUL_GROUND, + NETHER_MYCELIUM + ); + + TagManager.BLOCKS.add(CommonBlockTags.BOOKSHELVES, Blocks.BOOKSHELF); + TagManager.BLOCKS.add(CommonBlockTags.CHEST, Blocks.CHEST); + + TagManager.BLOCKS.add(BlockTags.NETHER_CARVER_REPLACEABLES, Blocks.RED_SAND, Blocks.MAGMA_BLOCK, Blocks.SCULK); + TagManager.BLOCKS.addOtherTags( + BlockTags.NETHER_CARVER_REPLACEABLES, + CommonBlockTags.NETHER_STONES, + CommonBlockTags.NETHERRACK + ); + } +} diff --git a/src/main/java/org/betterx/worlds/together/tag/CommonItemTags.java b/src/main/java/org/betterx/worlds/together/tag/CommonItemTags.java new file mode 100644 index 00000000..1cca2489 --- /dev/null +++ b/src/main/java/org/betterx/worlds/together/tag/CommonItemTags.java @@ -0,0 +1,29 @@ +package org.betterx.worlds.together.tag; + +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Blocks; + +public class CommonItemTags { + public final static TagKey HAMMERS = TagManager.ITEMS.makeCommonTag("hammers"); + public static final TagKey BARREL = TagManager.ITEMS.makeCommonTag("barrel"); + public static final TagKey CHEST = TagManager.ITEMS.makeCommonTag("chest"); + public static final TagKey SHEARS = TagManager.ITEMS.makeCommonTag("shears"); + public static final TagKey FURNACES = TagManager.ITEMS.makeCommonTag("furnaces"); + public static final TagKey IRON_INGOTS = TagManager.ITEMS.makeCommonTag("iron_ingots"); + public static final TagKey LEAVES = TagManager.ITEMS.makeCommonTag("leaves"); + public static final TagKey SAPLINGS = TagManager.ITEMS.makeCommonTag("saplings"); + public static final TagKey SOUL_GROUND = TagManager.ITEMS.makeCommonTag("soul_ground"); + public static final TagKey WOODEN_BARREL = TagManager.ITEMS.makeCommonTag("wooden_barrels"); + public static final TagKey WOODEN_CHEST = TagManager.ITEMS.makeCommonTag("wooden_chests"); + public static final TagKey WORKBENCHES = TagManager.ITEMS.makeCommonTag("workbench"); + + static void prepareTags() { + TagManager.ITEMS.add(SOUL_GROUND, Blocks.SOUL_SAND.asItem(), Blocks.SOUL_SOIL.asItem()); + + TagManager.ITEMS.add(CommonItemTags.CHEST, Items.CHEST); + TagManager.ITEMS.add(CommonItemTags.IRON_INGOTS, Items.IRON_INGOT); + TagManager.ITEMS.add(CommonItemTags.FURNACES, Blocks.FURNACE.asItem()); + } +} diff --git a/src/main/java/org/betterx/worlds/together/tag/MineableTags.java b/src/main/java/org/betterx/worlds/together/tag/MineableTags.java new file mode 100644 index 00000000..40ce2007 --- /dev/null +++ b/src/main/java/org/betterx/worlds/together/tag/MineableTags.java @@ -0,0 +1,21 @@ +package org.betterx.worlds.together.tag; + +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.TagKey; +import net.minecraft.world.level.block.Block; + +import net.fabricmc.fabric.api.mininglevel.v1.FabricMineableTags; + + +public class MineableTags { + public static final TagKey AXE = BlockTags.MINEABLE_WITH_AXE; + public static final TagKey HOE = BlockTags.MINEABLE_WITH_HOE; + public static final TagKey PICKAXE = BlockTags.MINEABLE_WITH_PICKAXE; + public static final TagKey SHEARS = FabricMineableTags.SHEARS_MINEABLE; + public static final TagKey SHOVEL = BlockTags.MINEABLE_WITH_SHOVEL; + public static final TagKey SWORD = FabricMineableTags.SWORD_MINEABLE; + public static final TagKey HAMMER = TagManager.BLOCKS.makeCommonTag("mineable/hammer"); + + static void prepareTags() { + } +} diff --git a/src/main/java/org/betterx/worlds/together/tag/TagManager.java b/src/main/java/org/betterx/worlds/together/tag/TagManager.java new file mode 100644 index 00000000..72acce7d --- /dev/null +++ b/src/main/java/org/betterx/worlds/together/tag/TagManager.java @@ -0,0 +1,121 @@ +package org.betterx.worlds.together.tag; + +import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI; +import org.betterx.bclib.api.v2.tag.TagAPI; +import org.betterx.worlds.together.mixin.common.DiggerItemAccessor; + +import net.minecraft.core.DefaultedRegistry; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.tags.TagKey; +import net.minecraft.tags.TagLoader; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; + +import com.google.common.collect.Maps; + +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import org.jetbrains.annotations.ApiStatus; + +public class TagManager { + private static final Map> TYPES = Maps.newHashMap(); + + public static TagRegistry.RegistryBacked BLOCKS = registerType(Registry.BLOCK); + public static TagRegistry.RegistryBacked ITEMS = registerType(Registry.ITEM); + public static TagRegistry.Biomes BIOMES = registerBiome(); + + public static TagRegistry.RegistryBacked registerType(DefaultedRegistry registry) { + TagRegistry type = new TagRegistry.RegistryBacked<>(registry); + return (TagRegistry.RegistryBacked) TYPES.computeIfAbsent(type.directory, (dir) -> type); + } + + public static TagRegistry.Simple registerType(Registry registry, String directory) { + return registerType(registry.key(), directory, (o) -> registry.getKey(o)); + } + + public static TagRegistry.Simple registerType( + ResourceKey> registry, + String directory, + Function locationProvider + ) { + return (TagRegistry.Simple) TYPES.computeIfAbsent( + directory, + (dir) -> new TagRegistry.Simple<>( + registry, + dir, + locationProvider + ) + ); + } + + static TagRegistry.Biomes registerBiome() { + return (TagRegistry.Biomes) TYPES.computeIfAbsent( + "tags/worldgen/biome", + (dir) -> new TagRegistry.Biomes( + dir, + b -> BiomeAPI.getBiomeID(b) + ) + ); + } + + public static TagRegistry.UnTyped registerType( + ResourceKey> registry, + String directory + ) { + return (TagRegistry.UnTyped) TYPES.computeIfAbsent( + directory, + (dir) -> new TagRegistry.UnTyped<>(registry, dir) + ); + } + + /** + * Initializes basic tags. Should be called only in BCLib main class. + */ + @ApiStatus.Internal + public static void ensureStaticallyLoaded() { + CommonItemTags.prepareTags(); + CommonBlockTags.prepareTags(); + CommonBiomeTags.prepareTags(); + MineableTags.prepareTags(); + ToolTags.prepareTags(); + } + + + /** + * Automatically called in {@link net.minecraft.tags.TagLoader#loadAndBuild(ResourceManager)}. + *

+ * In most cases there is no need to call this Method manually. + * + * @param directory The name of the Tag-directory. Should be either "tags/blocks" or + * "tags/items". + * @param tagsMap The map that will hold the registered Tags + * @return The {@code tagsMap} Parameter. + */ + @ApiStatus.Internal + public static Map> apply( + String directory, + Map> tagsMap + ) { + tagsMap = TagAPI.apply(directory, tagsMap); + + TagRegistry type = TYPES.get(directory); + if (type != null) { + type.apply(tagsMap); + } + + return tagsMap; + } + + + public static boolean isToolWithMineableTag(ItemStack stack, TagKey tag) { + if (stack.getItem() instanceof DiggerItemAccessor dig) { + return dig.bclib_getBlockTag().equals(tag); + } + return false; + } +} diff --git a/src/main/java/org/betterx/worlds/together/tag/TagRegistry.java b/src/main/java/org/betterx/worlds/together/tag/TagRegistry.java new file mode 100644 index 00000000..232c1c15 --- /dev/null +++ b/src/main/java/org/betterx/worlds/together/tag/TagRegistry.java @@ -0,0 +1,270 @@ +package org.betterx.worlds.together.tag; + +import org.betterx.bclib.BCLib; +import org.betterx.bclib.api.v2.levelgen.biomes.InternalBiomeAPI; + +import net.minecraft.core.DefaultedRegistry; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagEntry; +import net.minecraft.tags.TagKey; +import net.minecraft.tags.TagLoader; +import net.minecraft.tags.TagManager; +import net.minecraft.world.level.biome.Biome; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiConsumer; +import java.util.function.Function; +import org.jetbrains.annotations.ApiStatus; + +public class TagRegistry { + boolean isFrozen = false; + + public static class RegistryBacked extends Simple { + private final DefaultedRegistry registry; + + RegistryBacked(DefaultedRegistry registry) { + super( + registry.key(), + TagManager.getTagDir(registry.key()), + (T element) -> { + ResourceLocation id = registry.getKey(element); + if (id != registry.getDefaultKey()) { + return id; + } + return null; + } + ); + this.registry = registry; + } + + @Override + public TagKey makeTag(ResourceLocation id) { + initializeTag(id); + return registry + .getTagNames() + .filter(tagKey -> tagKey.location().equals(id)) + .findAny() + .orElse(TagKey.create(registry.key(), id)); + } + } + + public static class Simple extends TagRegistry { + Simple( + ResourceKey> registry, + String directory, + Function locationProvider + ) { + super(registry, directory, locationProvider); + } + + public void add(TagKey tagID, T... elements) { + super.add(tagID, elements); + } + + public void add(T element, TagKey... tagIDs) { + super.add(element, tagIDs); + } + + @Deprecated(forRemoval = true) + public void add(ResourceLocation tagID, T... elements) { + super.add(tagID, elements); + } + + @Deprecated(forRemoval = true) + public void add(T element, ResourceLocation... tagIDs) { + super.add(element, tagIDs); + } + } + + public static class Biomes extends Simple { + + @ApiStatus.Internal + public Biomes(String directory, Function locationProvider) { + super(Registry.BIOME_REGISTRY, directory, locationProvider); + } + + public TagKey makeStructureTag(String modID, String name) { + return makeTag(modID, "has_structure/" + name); + } + + public void apply(Map> tagsMap) { + InternalBiomeAPI._runBiomeTagAdders(); + super.apply(tagsMap); + } + } + + public static class UnTyped extends TagRegistry { + UnTyped( + ResourceKey> registry, + String directory + ) { + super(registry, directory, (t) -> { + throw new RuntimeException("Using Untyped TagType with Type-Dependant access. "); + }); + } + } + + public final String directory; + private final Map> tags = Maps.newConcurrentMap(); + public final ResourceKey> registryKey; + private final Function locationProvider; + + private TagRegistry( + ResourceKey> registry, + String directory, + Function locationProvider + ) { + this.registryKey = registry; + this.directory = directory; + this.locationProvider = locationProvider; + } + + protected void initializeTag(ResourceLocation tagID) { + getSetForTag(tagID); + } + + public Set getSetForTag(ResourceLocation tagID) { + return tags.computeIfAbsent(tagID, k -> Sets.newHashSet()); + } + + public Set getSetForTag(TagKey tag) { + if (tag == null) { + return new HashSet<>(); + } + return getSetForTag(tag.location()); + } + + /** + * Get or create a {@link TagKey}. + * + * @param modId - {@link String} mod namespace (mod id); + * @param name - {@link String} tag name. + * @return the corresponding TagKey {@link TagKey}. + */ + public TagKey makeTag(String modId, String name) { + return makeTag(new ResourceLocation(modId, name)); + } + + /** + * Get or create a {@link TagKey}. + * + * @param id - {@link ResourceLocation} of the tag; + * @return the corresponding TagKey {@link TagKey}. + */ + public TagKey makeTag(ResourceLocation id) { + return creatTagKey(id); + } + + protected TagKey creatTagKey(ResourceLocation id) { + initializeTag(id); + return TagKey.create(registryKey, id); + } + + /** + * Get or create a common {@link TagKey} (namespace is 'c'). + * + * @param name - The name of the Tag; + * @return the corresponding TagKey {@link TagKey}. + * @see Fabric Wiki (Tags) + */ + public TagKey makeCommonTag(String name) { + return creatTagKey(new ResourceLocation("c", name)); + } + + public void addUntyped(TagKey tagID, ResourceLocation... elements) { + if (isFrozen) BCLib.LOGGER.warning("Adding Tag " + tagID + " after the API was frozen."); + Set set = getSetForTag(tagID); + for (ResourceLocation id : elements) { + if (id != null) { + set.add(TagEntry.element(id)); + } + } + } + + public void addUntyped(ResourceLocation element, TagKey... tagIDs) { + for (TagKey tagID : tagIDs) { + addUntyped(tagID, element); + } + } + + public void addOtherTags(TagKey tagID, TagKey... tags) { + if (isFrozen) BCLib.LOGGER.warning("Adding Tag " + tagID + " after the API was frozen."); + Set set = getSetForTag(tagID); + for (TagKey tag : tags) { + ResourceLocation id = tag.location(); + if (id != null) { + set.add(TagEntry.tag(id)); + } + } + } + + /** + * Adds one Tag to multiple Elements. + * + * @param tagID {@link TagKey< Biome >} tag ID. + * @param elements array of Elements to add into tag. + */ + protected void add(TagKey tagID, T... elements) { + if (isFrozen) BCLib.LOGGER.warning("Adding Tag " + tagID + " after the API was frozen."); + Set set = getSetForTag(tagID); + for (T element : elements) { + ResourceLocation id = locationProvider.apply(element); + if (id != null) { + set.add(TagEntry.element(id)); + } + } + } + + protected void add(T element, TagKey... tagIDs) { + for (TagKey tagID : tagIDs) { + add(tagID, element); + } + } + + @Deprecated(forRemoval = true) + protected void add(ResourceLocation tagID, T... elements) { + if (isFrozen) BCLib.LOGGER.warning("Adding Tag " + tagID + " after the API was frozen."); + Set set = getSetForTag(tagID); + for (T element : elements) { + ResourceLocation id = locationProvider.apply(element); + if (id != null) { + set.add(TagEntry.element(id)); + } + } + } + + @Deprecated(forRemoval = true) + protected void add(T element, ResourceLocation... tagIDs) { + for (ResourceLocation tagID : tagIDs) { + add(tagID, element); + } + } + + public void forEach(BiConsumer> consumer) { + tags.forEach(consumer); + } + + public void apply(Map> tagsMap) { + + //this.isFrozen = true; + this.forEach((id, ids) -> apply(id, tagsMap.computeIfAbsent(id, key -> Lists.newArrayList()), ids)); + } + + private static List apply( + ResourceLocation id, + List builder, + Set ids + ) { + ids.forEach(value -> builder.add(new TagLoader.EntryWithSource(value, BCLib.MOD_ID))); + return builder; + } +} diff --git a/src/main/java/org/betterx/worlds/together/tag/ToolTags.java b/src/main/java/org/betterx/worlds/together/tag/ToolTags.java new file mode 100644 index 00000000..6fe648fc --- /dev/null +++ b/src/main/java/org/betterx/worlds/together/tag/ToolTags.java @@ -0,0 +1,17 @@ +package org.betterx.worlds.together.tag; + +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; + + +public class ToolTags { + public static final TagKey FABRIC_AXES = TagManager.ITEMS.makeTag("fabric", "axes"); + public static final TagKey FABRIC_HOES = TagManager.ITEMS.makeTag("fabric", "hoes"); + public static final TagKey FABRIC_PICKAXES = TagManager.ITEMS.makeTag("fabric", "pickaxes"); + public static final TagKey FABRIC_SHEARS = TagManager.ITEMS.makeTag("fabric", "shears"); + public static final TagKey FABRIC_SHOVELS = TagManager.ITEMS.makeTag("fabric", "shovels"); + public static final TagKey FABRIC_SWORDS = TagManager.ITEMS.makeTag("fabric", "swords"); + + static void prepareTags() { + } +} diff --git a/src/main/java/org/betterx/worlds/together/worldPreset/WorldPresets.java b/src/main/java/org/betterx/worlds/together/worldPreset/WorldPresets.java index ee5763c4..b4644cab 100644 --- a/src/main/java/org/betterx/worlds/together/worldPreset/WorldPresets.java +++ b/src/main/java/org/betterx/worlds/together/worldPreset/WorldPresets.java @@ -1,9 +1,9 @@ package org.betterx.worlds.together.worldPreset; -import org.betterx.bclib.api.v2.tag.TagAPI; -import org.betterx.bclib.api.v2.tag.TagType; import org.betterx.bclib.registry.PresetsRegistry; import org.betterx.worlds.together.WorldsTogether; +import org.betterx.worlds.together.tag.TagManager; +import org.betterx.worlds.together.tag.TagRegistry; import org.betterx.worlds.together.world.WorldGenUtil; import org.betterx.worlds.together.worldPreset.client.WorldPresetsClient; import org.betterx.worlds.together.worldPreset.settings.VanillaWorldPresetSettings; @@ -26,8 +26,8 @@ import java.util.Optional; public class WorldPresets { - public static final TagType.Simple WORLD_PRESETS = - TagAPI.registerType(BuiltinRegistries.WORLD_PRESET, "tags/worldgen/world_preset"); + public static final TagRegistry.Simple WORLD_PRESETS = + TagManager.registerType(BuiltinRegistries.WORLD_PRESET, "tags/worldgen/world_preset"); private static Map, PresetBuilder> BUILDERS = Maps.newHashMap(); private static final Map, WorldPresetSettings> SETTINGS = Maps.newHashMap(); public static Optional> DEFAULT = Optional.of(net.minecraft.world.level.levelgen.presets.WorldPresets.NORMAL); diff --git a/src/main/resources/bclib.mixins.common.json b/src/main/resources/bclib.mixins.common.json index e78e72ee..90bfe829 100644 --- a/src/main/resources/bclib.mixins.common.json +++ b/src/main/resources/bclib.mixins.common.json @@ -17,7 +17,6 @@ "ComposterBlockAccessor", "CraftingMenuMixin", "DedicatedServerPropertiesMixin", - "DiggerItemAccessor", "DiggerItemMixin", "EnchantingTableBlockMixin", "ItemStackMixin", @@ -38,7 +37,6 @@ "ShovelItemAccessor", "StructuresAccessor", "SurfaceRulesContextAccessor", - "TagLoaderMixin", "TheEndBiomeDataMixin", "WorldGenRegionMixin", "elytra.LivingEntityMixin", diff --git a/src/main/resources/together.mixins.common.json b/src/main/resources/together.mixins.common.json index 2b3b4326..53f30cce 100644 --- a/src/main/resources/together.mixins.common.json +++ b/src/main/resources/together.mixins.common.json @@ -4,9 +4,11 @@ "package": "org.betterx.worlds.together.mixin.common", "compatibilityLevel": "JAVA_17", "mixins": [ + "DiggerItemAccessor", "MainMixin", "PrimaryLevelDataMixin", "RegistryOpsAccessor", + "TagLoaderMixin", "WorldGenPropertiesMixin", "WorldPresetAccessor", "WorldPresetMixin",