[Change] Moved and refactored Tag-API

This commit is contained in:
Frank 2022-06-21 18:19:10 +02:00
parent 25fa53541f
commit 184f3a6448
56 changed files with 1220 additions and 358 deletions

View file

@ -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();
}

View file

@ -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<Biome> 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);

View file

@ -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();

View file

@ -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;

View file

@ -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<S extends Structure> {
}
public BCLStructureBuilder<S> biomeTag(String modID, String path) {
this.biomeTag = TagAPI.makeStructureTag(modID, path);
this.biomeTag = TagManager.BIOMES.makeStructureTag(modID, path);
return this;
}

View file

@ -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<Biome> 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<Biome> IN_NETHER = org.betterx.worlds.together.tag.CommonBiomeTags.IN_NETHER;
}

View file

@ -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<Block> BARREL = TagAPI.makeCommonBlockTag("barrel");
public static final TagKey<Block> BOOKSHELVES = TagAPI.makeCommonBlockTag("bookshelves");
public static final TagKey<Block> CHEST = TagAPI.makeCommonBlockTag("chest");
public static final TagKey<Block> END_STONES = TagAPI.makeCommonBlockTag("end_stones");
public static final TagKey<Block> GEN_END_STONES = END_STONES;
public static final TagKey<Block> IMMOBILE = TagAPI.makeCommonBlockTag("immobile");
public static final TagKey<Block> LEAVES = TagAPI.makeCommonBlockTag("leaves");
public static final TagKey<Block> NETHERRACK = TagAPI.makeCommonBlockTag("netherrack");
public static final TagKey<Block> MYCELIUM = TagAPI.makeCommonBlockTag("mycelium");
public static final TagKey<Block> NETHER_MYCELIUM = TagAPI.makeCommonBlockTag("nether_mycelium");
public static final TagKey<Block> NETHER_PORTAL_FRAME = TagAPI.makeCommonBlockTag("nether_pframe");
public static final TagKey<Block> NETHER_STONES = TagAPI.makeCommonBlockTag("nether_stones");
public static final TagKey<Block> NETHER_ORES = TagAPI.makeCommonBlockTag("nether_ores");
public static final TagKey<Block> END_ORES = TagAPI.makeCommonBlockTag("end_ores");
public static final TagKey<Block> SAPLINGS = TagAPI.makeCommonBlockTag("saplings");
public static final TagKey<Block> SOUL_GROUND = TagAPI.makeCommonBlockTag("soul_ground");
public static final TagKey<Block> WOODEN_BARREL = TagAPI.makeCommonBlockTag("wooden_barrels");
public static final TagKey<Block> WOODEN_CHEST = TagAPI.makeCommonBlockTag("wooden_chests");
public static final TagKey<Block> WORKBENCHES = TagAPI.makeCommonBlockTag("workbench");
public static final TagKey<Block> DRAGON_IMMUNE = TagAPI.makeCommonBlockTag("dragon_immune");
public static final TagKey<Block> MINABLE_WITH_HAMMER = TagAPI.makeCommonBlockTag("mineable/hammer");
public static final TagKey<Block> IS_OBSIDIAN = TagAPI.makeCommonBlockTag("is_obsidian");
public static final TagKey<Block> TERRAIN = TagAPI.makeCommonBlockTag("terrain");
public static final TagKey<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> NETHER_TERRAIN = org.betterx.worlds.together.tag.CommonBlockTags.NETHER_TERRAIN;
}

View file

@ -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<Item> HAMMERS = TagAPI.makeCommonItemTag("hammers");
public static final TagKey<Item> BARREL = TagAPI.makeCommonItemTag("barrel");
public static final TagKey<Item> CHEST = TagAPI.makeCommonItemTag("chest");
public static final TagKey<Item> SHEARS = TagAPI.makeCommonItemTag("shears");
public static final TagKey<Item> FURNACES = TagAPI.makeCommonItemTag("furnaces");
public static final TagKey<Item> IRON_INGOTS = TagAPI.makeCommonItemTag("iron_ingots");
public static final TagKey<Item> LEAVES = TagAPI.makeCommonItemTag("leaves");
public static final TagKey<Item> SAPLINGS = TagAPI.makeCommonItemTag("saplings");
public static final TagKey<Item> SOUL_GROUND = TagAPI.makeCommonItemTag("soul_ground");
public static final TagKey<Item> WOODEN_BARREL = TagAPI.makeCommonItemTag("wooden_barrels");
public static final TagKey<Item> WOODEN_CHEST = TagAPI.makeCommonItemTag("wooden_chests");
public static final TagKey<Item> 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<Item> 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<Item> 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<Item> 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<Item> 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<Item> 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<Item> 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<Item> 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<Item> 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<Item> 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<Item> 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<Item> 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<Item> WORKBENCHES = org.betterx.worlds.together.tag.CommonItemTags.WORKBENCHES;
}

View file

@ -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<Block> ANVIL = BlockTags.ANVIL;
public static final TagKey<Block> BUTTONS = BlockTags.BUTTONS;
@ -16,34 +18,109 @@ public class NamedBlockTags {
public static final TagKey<Block> LEAVES = BlockTags.LEAVES;
public static final TagKey<Block> LOGS = BlockTags.LOGS;
public static final TagKey<Block> LOGS_THAT_BURN = BlockTags.LOGS_THAT_BURN;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#NYLIUM}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> NYLIUM = BlockTags.NYLIUM;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#PLANKS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> PLANKS = BlockTags.PLANKS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#PRESSURE_PLATES}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> PRESSURE_PLATES = BlockTags.PRESSURE_PLATES;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#SAPLINGS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> SAPLINGS = BlockTags.SAPLINGS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#SIGNS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> SIGNS = BlockTags.SIGNS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#SLABS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> SLABS = BlockTags.SLABS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#STAIRS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> STAIRS = BlockTags.STAIRS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#STONE_PRESSURE_PLATES}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> STONE_PRESSURE_PLATES = BlockTags.STONE_PRESSURE_PLATES;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#TRAPDOORS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> TRAPDOORS = BlockTags.TRAPDOORS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#WALLS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> WALLS = BlockTags.WALLS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_BUTTONS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> WOODEN_BUTTONS = BlockTags.WOODEN_BUTTONS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_DOORS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> WOODEN_DOORS = BlockTags.WOODEN_DOORS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_FENCES}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> WOODEN_FENCES = BlockTags.WOODEN_FENCES;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_PRESSURE_PLATES}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> WOODEN_PRESSURE_PLATES = BlockTags.WOODEN_PRESSURE_PLATES;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_SLABS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> WOODEN_SLABS = BlockTags.WOODEN_SLABS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_STAIRS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> WOODEN_STAIRS = BlockTags.WOODEN_STAIRS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#WOODEN_TRAPDOORS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> WOODEN_TRAPDOORS = BlockTags.WOODEN_TRAPDOORS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#SOUL_FIRE_BASE_BLOCKS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> 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<Block> 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<Block> BEACON_BASE_BLOCKS = BlockTags.BEACON_BASE_BLOCKS;
/**
* @deprecated replaced by {@link net.minecraft.tags.BlockTags#STONE_BRICKS}
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> 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
);
}
}

View file

@ -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<Item> BUTTONS = ItemTags.BUTTONS;
public static final TagKey<Item> DOORS = ItemTags.DOORS;

View file

@ -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<Block> AXE = BlockTags.MINEABLE_WITH_AXE;
public static final TagKey<Block> HOE = BlockTags.MINEABLE_WITH_HOE;
public static final TagKey<Block> PICKAXE = BlockTags.MINEABLE_WITH_PICKAXE;
public static final TagKey<Block> SHEARS = TagAPI.makeBlockTag("fabric", "mineable/shears");
public static final TagKey<Block> SHOVEL = BlockTags.MINEABLE_WITH_SHOVEL;
public static final TagKey<Block> SWORD = TagAPI.makeBlockTag("fabric", "mineable/sword");
public static final TagKey<Block> HAMMER = TagAPI.makeCommonBlockTag("mineable/hammer");
/**
* @deprecated use {@link org.betterx.worlds.together.tag.MineableTags#AXE} instead
**/
@Deprecated(forRemoval = true)
public static final TagKey<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> 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<Block> HAMMER = org.betterx.worlds.together.tag.MineableTags.HAMMER;
}

View file

@ -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<Item> FABRIC_AXES = TagAPI.makeItemTag("fabric", "axes");
public static final TagKey<Item> FABRIC_HOES = TagAPI.makeItemTag("fabric", "hoes");
public static final TagKey<Item> FABRIC_PICKAXES = TagAPI.makeItemTag("fabric", "pickaxes");
public static final TagKey<Item> FABRIC_SHEARS = TagAPI.makeItemTag("fabric", "shears");
public static final TagKey<Item> FABRIC_SHOVELS = TagAPI.makeItemTag("fabric", "shovels");
public static final TagKey<Item> FABRIC_SWORDS = TagAPI.makeItemTag("fabric", "swords");
/**
* @deprecated use {@link ToolTags#FABRIC_AXES} instead
**/
@Deprecated(forRemoval = true)
public static final TagKey<Item> FABRIC_AXES = ToolTags.FABRIC_AXES;
/**
* @deprecated use {@link ToolTags#FABRIC_HOES} instead
**/
@Deprecated(forRemoval = true)
public static final TagKey<Item> FABRIC_HOES = ToolTags.FABRIC_HOES;
/**
* @deprecated use {@link ToolTags#FABRIC_PICKAXES} instead
**/
@Deprecated(forRemoval = true)
public static final TagKey<Item> FABRIC_PICKAXES = ToolTags.FABRIC_PICKAXES;
/**
* @deprecated use {@link ToolTags#FABRIC_SHEARS} instead
**/
@Deprecated(forRemoval = true)
public static final TagKey<Item> FABRIC_SHEARS = ToolTags.FABRIC_SHEARS;
/**
* @deprecated use {@link ToolTags#FABRIC_SHOVELS} instead
**/
@Deprecated(forRemoval = true)
public static final TagKey<Item> FABRIC_SHOVELS = ToolTags.FABRIC_SHOVELS;
/**
* @deprecated use {@link ToolTags#FABRIC_SWORDS} instead
**/
@Deprecated(forRemoval = true)
public static final TagKey<Item> FABRIC_SWORDS = ToolTags.FABRIC_SWORDS;
}

View file

@ -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<String, TagType<?>> TYPES = Maps.newHashMap();
/**
* @deprecated Replaced by {@link TagManager#BLOCKS}
*/
@Deprecated(forRemoval = true)
public static TagType.RegistryBacked<Block> BLOCKS = registerType(Registry.BLOCK);
/**
* @deprecated Replaced by {@link TagManager#ITEMS}
*/
@Deprecated(forRemoval = true)
public static TagType.RegistryBacked<Item> ITEMS = registerType(Registry.ITEM);
/**
* @deprecated Replaced by {@link TagManager#BIOMES}
*/
@Deprecated(forRemoval = true)
public static TagType.Simple<Biome> BIOMES = registerType(
Registry.BIOME_REGISTRY,
"tags/worldgen/biome",
b -> BiomeAPI.getBiomeID(b)
);
/**
* @deprecated Replaced by {@link TagManager#registerType(DefaultedRegistry)}
*/
@Deprecated(forRemoval = true)
public static <T> TagType.RegistryBacked<T> registerType(DefaultedRegistry<T> registry) {
TagType<T> type = new TagType.RegistryBacked<>(registry);
return (TagType.RegistryBacked<T>) TYPES.computeIfAbsent(type.directory, (dir) -> type);
}
/**
* @deprecated Replaced by {@link TagManager#registerType(Registry, String)}
*/
@Deprecated(forRemoval = true)
public static <T> TagType.Simple<T> registerType(Registry<T> 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 <T> TagType.Simple<T> registerType(
ResourceKey<? extends Registry<T>> registry,
String directory,
@ -59,97 +90,92 @@ public class TagAPI {
);
}
/**
* @deprecated Replaced by {@link TagManager#registerType(ResourceKey, String)}
*/
@Deprecated(forRemoval = true)
public static <T> TagType.UnTyped<T> registerType(ResourceKey<? extends Registry<T>> registry, String directory) {
return (TagType.UnTyped<T>) 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<Biome> 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<Biome> 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<Block> 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<Block> 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<Item> 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<Item> 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 <a href="https://fabricmc.net/wiki/tutorial:tags">Fabric Wiki (Tags)</a>
* @deprecated Replaced by {@link TagRegistry#makeCommonTag(String)} on {@link TagManager#BLOCKS}
*/
@Deprecated(forRemoval = true)
public static TagKey<Block> 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 <a href="https://fabricmc.net/wiki/tutorial:tags">Fabric Wiki (Tags)</a>
* @deprecated Replaced by {@link TagRegistry#makeCommonTag(String)} on {@link TagManager#ITEMS}
*/
@Deprecated(forRemoval = true)
public static TagKey<Item> 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<Biome> 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<Biome>} tag IDs.
* @param biome The {@link Biome} to add tag.
* @deprecated
*/
@Deprecated(forRemoval = true)
@SafeVarargs
public static void addBiomeTags(Biome biome, TagKey<Biome>... 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<Biome>} tag ID.
* @param biomes array of {@link Biome} to add into tag.
* @deprecated
*/
@Deprecated(forRemoval = true)
public static void addBiomeTag(TagKey<Biome> 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<Block>} tag IDs.
* @param block The {@link Block} to add tag.
* @deprecated
*/
@Deprecated(forRemoval = true)
@SafeVarargs
public static void addBlockTags(Block block, TagKey<Block>... 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<Block>} tag ID.
* @param blocks array of {@link Block} to add into tag.
* @deprecated
*/
@Deprecated(forRemoval = true)
public static void addBlockTag(TagKey<Block> 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<Item>} tag IDs.
* @param item The {@link Item} to add tag.
* @deprecated
*/
@Deprecated(forRemoval = true)
@SafeVarargs
public static void addItemTags(ItemLike item, TagKey<Item>... tagIDs) {
ITEMS.add(item.asItem(), tagIDs);
TagManager.ITEMS.add(item.asItem(), tagIDs);
}
/**
* Adds one Tag to multiple Items.
*
* @param tagID {@link TagKey<Item>} tag ID.
* @param items array of {@link ItemLike} to add into tag.
* @deprecated
*/
@Deprecated(forRemoval = true)
public static void addItemTag(TagKey<Item> 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<Item>} tag ID.
* @param items array of {@link ItemLike} to add into tag.
* @deprecated
*/
@Deprecated(forRemoval = true)
public static void addItemTag(TagKey<Item> tagID, Item... items) {
ITEMS.add(tagID, items);
TagManager.ITEMS.add(tagID, items);
}
/**
* Automatically called in {@link net.minecraft.tags.TagLoader#loadAndBuild(ResourceManager)}.
* <p>
* In most cases there is no need to call this Method manually.
*
* @param directory The name of the Tag-directory. Should be either <i>"tags/blocks"</i> or
* <i>"tags/items"</i>.
* @param tagsMap The map that will hold the registered Tags
* @return The {@code tagsMap} Parameter.
*/
@Deprecated(forRemoval = true)
public static <T> Map<ResourceLocation, List<TagLoader.EntryWithSource>> apply(
String directory,
Map<ResourceLocation, List<TagLoader.EntryWithSource>> 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<Block> tag) {
if (stack.getItem() instanceof DiggerItemAccessor dig) {
return dig.bclib_getBlockTag().equals(tag);

View file

@ -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<T> {
boolean isFrozen = false;
/**
* @deprecated Replaced by {@link TagRegistry.RegistryBacked}
*/
@Deprecated(forRemoval = true)
public static class RegistryBacked<T> extends Simple<T> {
private final DefaultedRegistry<T> registry;
@ -56,6 +65,10 @@ public class TagType<T> {
}
}
/**
* @deprecated Replaced by {@link TagRegistry.Simple}
*/
@Deprecated(forRemoval = true)
public static class Simple<T> extends TagType<T> {
Simple(
ResourceKey<? extends Registry<T>> registry,
@ -84,6 +97,10 @@ public class TagType<T> {
}
}
/**
* @deprecated Replaced by {@link TagRegistry.UnTyped}
*/
@Deprecated(forRemoval = true)
public static class UnTyped<T> extends TagType<T> {
UnTyped(
ResourceKey<? extends Registry<T>> registry,

View file

@ -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;

View file

@ -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;