allow enchants to support specific items along with item sets

This commit is contained in:
2024-10-29 20:08:02 +01:00
parent d9346e986e
commit 16eae2bd58
@@ -310,10 +310,6 @@ public class EnchantioConfig {
if (itemTag == null) continue;
if (itemTag.startsWith("#")) {
itemTag = itemTag.substring(1);
} else {
logger.warning("Only item tags are supported for now, item tags need to begin with #");
continue;
}
try {
Key key = Key.key(itemTag);
TagKey<ItemType> tagKey = ItemTypeTagKeys.create(key);
@@ -322,6 +318,16 @@ public class EnchantioConfig {
} catch (IllegalArgumentException e) {
logger.warning("Failed to create tag entry for " + itemTag);
}
continue;
}
try {
Key key = Key.key(itemTag);
TypedKey<ItemType> typedKey = TypedKey.create(RegistryKey.ITEM, key);
TagEntry<ItemType> tagEntry = TagEntry.valueEntry(typedKey);
supportedItemTags.add(tagEntry);
} catch (IllegalArgumentException | NullPointerException e) {
logger.warning("Failed to create tag entry for " + itemTag);
}
}
return supportedItemTags;
}