[Fix] Biomes can get added multiple times to BiomeTag Registry

This commit is contained in:
Frank 2023-06-08 02:17:51 +02:00
parent d48f6db59f
commit 9150a8f2a3

View file

@ -101,6 +101,14 @@ public class TagRegistry<T> {
Set<TagEntry> set = getSetForTag(tagID); Set<TagEntry> set = getSetForTag(tagID);
for (ResourceKey<Biome> element : elements) { for (ResourceKey<Biome> element : elements) {
ResourceLocation id = element.location(); ResourceLocation id = element.location();
//only add if the set doesn't already contain the element
for (TagEntry tagEntry : set) {
if (!tagEntry.elementOrTag().tag() && tagEntry.elementOrTag().id().equals(id)) {
id = null;
break;
}
}
if (id != null) { if (id != null) {
set.add(TagEntry.element(id)); set.add(TagEntry.element(id));
} }