mirror of
https://github.com/YouHaveTrouble/Enchantio.git
synced 2026-05-12 06:06:55 +00:00
add smelting enchantment
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
package me.youhavetrouble.enchantio.enchants;
|
||||
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
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.inventory.EquipmentSlotGroup;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public class SmeltingEnchant implements EnchantioEnchant {
|
||||
|
||||
public static final Key KEY = Key.key("enchantio:smelting");
|
||||
|
||||
private final int anvilCost, weight;
|
||||
private final EnchantmentRegistryEntry.EnchantmentCost minimumCost;
|
||||
private final EnchantmentRegistryEntry.EnchantmentCost maximumCost;
|
||||
private final boolean canGetFromEnchantingTable;
|
||||
private final Set<TagEntry<ItemType>> supportedItemTags;
|
||||
|
||||
public SmeltingEnchant(
|
||||
int anvilCost,
|
||||
int weight,
|
||||
EnchantmentRegistryEntry.EnchantmentCost minimumCost,
|
||||
EnchantmentRegistryEntry.EnchantmentCost maximumCost,
|
||||
boolean canGetFromEnchantingTable,
|
||||
Set<TagEntry<ItemType>> supportedItemTags
|
||||
) {
|
||||
this.anvilCost = anvilCost;
|
||||
this.weight = weight;
|
||||
this.minimumCost = minimumCost;
|
||||
this.maximumCost = maximumCost;
|
||||
this.canGetFromEnchantingTable = canGetFromEnchantingTable;
|
||||
this.supportedItemTags = supportedItemTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getDescription() {
|
||||
return Component.translatable("enchantio.enchant.smelting", "Smelting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnvilCost() {
|
||||
return anvilCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLevel() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMinimumCost() {
|
||||
return minimumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnchantmentRegistryEntry.EnchantmentCost getMaximumCost() {
|
||||
return maximumCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<EquipmentSlotGroup> getActiveSlots() {
|
||||
return Set.of(EquipmentSlotGroup.ANY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGetFromEnchantingTable() {
|
||||
return canGetFromEnchantingTable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TagKey<ItemType> getTagForSupportedItems() {
|
||||
return TagKey.create(RegistryKey.ITEM, Key.key("enchantio:smelting_enchantable"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TagEntry<ItemType>> getSupportedItems() {
|
||||
return supportedItemTags;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user