[Change] BCLBiome is no longer a wrapper around a Biome-Instance but references the Biome by ResourceKey

[Fix] Crash with Promenade (#15)
This commit is contained in:
Frank 2022-07-03 12:42:30 +02:00
parent 89737d5f6c
commit 3e81071b96
8 changed files with 274 additions and 139 deletions

View file

@ -1,6 +1,7 @@
package org.betterx.worlds.together.tag.v3;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
import org.betterx.bclib.api.v2.levelgen.biomes.InternalBiomeAPI;
import net.minecraft.core.DefaultedRegistry;
@ -83,6 +84,23 @@ public class TagRegistry<T> {
super(Registry.BIOME_REGISTRY, directory, locationProvider);
}
/**
* Adds one Tag to multiple Elements.
*
* @param tagID {@link TagKey< Biome >} tag ID.
* @param elements array of Elements to add into tag.
*/
public void add(TagKey<Biome> tagID, BCLBiome... elements) {
if (isFrozen) BCLib.LOGGER.warning("Adding Tag " + tagID + " after the API was frozen.");
Set<TagEntry> set = getSetForTag(tagID);
for (BCLBiome element : elements) {
ResourceLocation id = element.getID();
if (id != null) {
set.add(TagEntry.element(id));
}
}
}
public TagKey<Biome> makeStructureTag(String modID, String name) {
return makeTag(modID, "has_structure/" + name);
}