mirror of
https://github.com/YouHaveTrouble/Enchantio.git
synced 2026-05-12 06:06:55 +00:00
adjust costs and make enchants available from enchantment table
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
package me.youhavetrouble.enchantio.enchants;
|
||||
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import io.papermc.paper.registry.data.EnchantmentRegistryEntry;
|
||||
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.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
|
||||
@@ -27,6 +31,7 @@ public abstract class EnchantioEnchant {
|
||||
private final TagKey<ItemType> supportedItems;
|
||||
private final TagKey<ItemType> primaryItems;
|
||||
private final Set<EquipmentSlotGroup> activeSlots;
|
||||
private final boolean canGetFromEnchantingTable;
|
||||
|
||||
public EnchantioEnchant(
|
||||
Key key,
|
||||
@@ -38,7 +43,8 @@ public abstract class EnchantioEnchant {
|
||||
EnchantmentRegistryEntry.EnchantmentCost maximumCost,
|
||||
TagKey<ItemType> primaryItems,
|
||||
TagKey<ItemType> supportedItems,
|
||||
Set<EquipmentSlotGroup> activeSlots
|
||||
Set<EquipmentSlotGroup> activeSlots,
|
||||
boolean canGetFromEnchantingTable
|
||||
) {
|
||||
this.key = key;
|
||||
this.description = description;
|
||||
@@ -50,6 +56,7 @@ public abstract class EnchantioEnchant {
|
||||
this.primaryItems = primaryItems;
|
||||
this.supportedItems = supportedItems;
|
||||
this.activeSlots = activeSlots;
|
||||
this.canGetFromEnchantingTable = canGetFromEnchantingTable;
|
||||
}
|
||||
|
||||
public Key getKey() {
|
||||
@@ -92,6 +99,14 @@ public abstract class EnchantioEnchant {
|
||||
return activeSlots;
|
||||
}
|
||||
|
||||
public boolean canGetFromEnchantingTable() {
|
||||
return canGetFromEnchantingTable;
|
||||
}
|
||||
|
||||
public TagEntry<Enchantment> getTagEntry() {
|
||||
return TagEntry.valueEntry(TypedKey.create(RegistryKey.ENCHANTMENT, getKey()));
|
||||
}
|
||||
|
||||
protected static void registerEnchant(EnchantioEnchant enchant) {
|
||||
enchantioEnchants.put(enchant.getKey().asString(), enchant);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,12 @@ public class SoulboundEnchant extends EnchantioEnchant {
|
||||
1,
|
||||
1,
|
||||
10,
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(1, 1),
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(3, 1),
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(10, 1),
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(30, 1),
|
||||
ItemTypeTagKeys.ENCHANTABLE_ARMOR,
|
||||
ItemTypeTagKeys.ENCHANTABLE_ARMOR,
|
||||
Set.of(EquipmentSlotGroup.ANY)
|
||||
Set.of(EquipmentSlotGroup.ANY),
|
||||
true
|
||||
);
|
||||
registerEnchant(this);
|
||||
}
|
||||
|
||||
@@ -19,11 +19,12 @@ public class TelepathyEnchant extends EnchantioEnchant {
|
||||
1,
|
||||
1,
|
||||
4,
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(1, 1),
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(3, 1),
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(15, 1),
|
||||
EnchantmentRegistryEntry.EnchantmentCost.of(30, 1),
|
||||
ItemTypeTagKeys.ENCHANTABLE_MINING,
|
||||
ItemTypeTagKeys.ENCHANTABLE_MINING,
|
||||
Set.of(EquipmentSlotGroup.ANY)
|
||||
Set.of(EquipmentSlotGroup.ANY),
|
||||
true
|
||||
);
|
||||
registerEnchant(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user