mirror of
https://github.com/YouHaveTrouble/Enchantio.git
synced 2026-05-12 06:06:55 +00:00
refactor yet again to allow encahts to support multiple tags
This commit is contained in:
@@ -1,32 +1,75 @@
|
||||
package me.youhavetrouble.enchantio.enchants;
|
||||
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.data.EnchantmentRegistryEntry;
|
||||
import io.papermc.paper.registry.keys.tags.ItemTypeTagKeys;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import io.papermc.paper.tag.TagEntry;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class TelepathyEnchant extends EnchantioEnchant {
|
||||
public class TelepathyEnchant implements EnchantioEnchant {
|
||||
|
||||
public static final Key KEY = Key.key("enchantio:telepathy");
|
||||
|
||||
public TelepathyEnchant() {
|
||||
super(
|
||||
KEY,
|
||||
Component.translatable("enchantio.enchant.telepathy","Telepathy"),
|
||||
1,
|
||||
1,
|
||||
4,
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(15, 1),
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(30, 1),
|
||||
ItemTypeTagKeys.ENCHANTABLE_MINING,
|
||||
ItemTypeTagKeys.ENCHANTABLE_MINING,
|
||||
Set.of(EquipmentSlotGroup.ANY),
|
||||
true
|
||||
);
|
||||
registerEnchant(this);
|
||||
@Override
|
||||
public Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.telepathy","Telepathy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnvilCost() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLevel() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeight() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
return EnchantmentRegistryEntry.EnchantmentCost.of(15, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
return EnchantmentRegistryEntry.EnchantmentCost.of(30, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGetFromEnchantingTable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TagKey<ItemType> getTagForSupportedItems() {
|
||||
return TagKey.create(RegistryKey.ITEM, Key.key("enchantio:soulbound_enchantable"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return Set.of(
|
||||
TagEntry.tagEntry(ItemTypeTagKeys.ENCHANTABLE_MINING)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user