mirror of
https://github.com/YouHaveTrouble/Enchantio.git
synced 2026-05-11 21:56:55 +00:00
allow enchants to support specific items along with item sets
This commit is contained in:
@@ -310,16 +310,22 @@ 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 #");
|
||||
try {
|
||||
Key key = Key.key(itemTag);
|
||||
TagKey<ItemType> tagKey = ItemTypeTagKeys.create(key);
|
||||
TagEntry<ItemType> tagEntry = TagEntry.tagEntry(tagKey);
|
||||
supportedItemTags.add(tagEntry);
|
||||
} catch (IllegalArgumentException e) {
|
||||
logger.warning("Failed to create tag entry for " + itemTag);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
Key key = Key.key(itemTag);
|
||||
TagKey<ItemType> tagKey = ItemTypeTagKeys.create(key);
|
||||
TagEntry<ItemType> tagEntry = TagEntry.tagEntry(tagKey);
|
||||
TypedKey<ItemType> typedKey = TypedKey.create(RegistryKey.ITEM, key);
|
||||
TagEntry<ItemType> tagEntry = TagEntry.valueEntry(typedKey);
|
||||
supportedItemTags.add(tagEntry);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException | NullPointerException e) {
|
||||
logger.warning("Failed to create tag entry for " + itemTag);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user