Stalagmite Placement

This commit is contained in:
Frank 2022-05-29 23:25:54 +02:00
parent abe18ae923
commit 5272861140
3 changed files with 46 additions and 19 deletions

View file

@ -1,5 +1,6 @@
package org.betterx.bclib.api.tag;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;
@ -26,4 +27,16 @@ public class CommonBlockTags {
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> STALAGMITE_REPLACEABLE = TagAPI.makeCommonBlockTag("stalagmite_replaceable_blocks");
static {
TagAPI.BLOCKS.addOtherTags(STALAGMITE_REPLACEABLE,
BlockTags.DRIPSTONE_REPLACEABLE,
BlockTags.BASE_STONE_NETHER,
BlockTags.BASE_STONE_OVERWORLD,
NETHER_STONES,
SOUL_GROUND,
NETHER_MYCELIUM,
END_STONES);
}
}

View file

@ -240,19 +240,6 @@ public class TagAPI {
if (type != null) {
type.apply(tagsMap);
}
// final BiConsumer<ResourceLocation, Set<ResourceLocation>> consumer;
// consumer = (id, ids) -> apply(tagsMap.computeIfAbsent(id, key -> Tag.Builder.tag()), ids);
//
// if ("tags/blocks".equals(directory)) {
// TAGS_BLOCK.forEach(consumer);
// }
// else if ("tags/items".equals(directory)) {
// TAGS_ITEM.forEach(consumer);
// }
// else if ("tags/worldgen/biome".equals(directory)) {
// TAGS_BIOME.forEach(consumer);
// }
return tagsMap;
}

View file

@ -147,6 +147,33 @@ public class TagType<T> {
}
}
public void addOtherTags(TagKey<T> tagID, TagKey<T>... tags) {
if (isFrozen) BCLib.LOGGER.warning("Adding Tag " + tagID + " after the API was frozen.");
Set<ResourceLocation> set = getSetForTag(tagID);
for (TagKey<T> tag : tags) {
ResourceLocation id = tag.location();
if (id != null) {
set.add(id);
}
}
}
/**
* Adds one Tag to multiple Elements.
*
* @param tagID {@link TagKey< Biome >} tag ID.
* @param locations array of Elements to add into tag.
*/
protected void addUnchecked(TagKey<T> tagID, ResourceLocation... locations) {
if (isFrozen) BCLib.LOGGER.warning("Adding Tag " + tagID + " after the API was frozen.");
Set<ResourceLocation> set = getSetForTag(tagID);
for (ResourceLocation id : locations) {
if (id != null) {
set.add(id);
}
}
}
/**
* Adds one Tag to multiple Elements.
*