[Change] Moved and refactored Tag-API
This commit is contained in:
parent
25fa53541f
commit
184f3a6448
56 changed files with 1220 additions and 358 deletions
|
@ -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}
|
||||
*/
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue