[Change] Make sure BlockTags are only added once

This commit is contained in:
Frank 2023-06-17 21:47:21 +02:00
parent 07f8bce1dc
commit bdc2f52743

View file

@ -263,6 +263,15 @@ public class TagRegistry<T> {
Set<TagEntry> set = getSetForTag(tagID); Set<TagEntry> set = getSetForTag(tagID);
for (T element : elements) { for (T element : elements) {
ResourceLocation id = locationProvider.apply(element); ResourceLocation id = locationProvider.apply(element);
//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));
} }