add airbag enchant

This commit is contained in:
2024-10-29 20:08:10 +01:00
parent 16eae2bd58
commit 9f3960c649
5 changed files with 294 additions and 0 deletions
@@ -1,5 +1,7 @@
package me.youhavetrouble.enchantio;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import io.papermc.paper.registry.data.EnchantmentRegistryEntry;
import io.papermc.paper.registry.keys.tags.ItemTypeTagKeys;
import io.papermc.paper.registry.tag.TagKey;
@@ -228,6 +230,38 @@ public class EnchantioConfig {
ENCHANTS.put(SmeltingEnchant.KEY, smeltingEnchant);
}
ConfigurationSection airbagSection = enchantsSection.getConfigurationSection("airbag");
if (airbagSection == null) {
airbagSection = enchantsSection.createSection("cushion");
}
AirbagEnchant airbagEnchant = new AirbagEnchant(
getInt(airbagSection, "anvilCost", 1),
getInt(airbagSection, "weight", 10),
EnchantmentRegistryEntry.EnchantmentCost.of(
getInt(airbagSection, "minimumCost.base", 40),
getInt(airbagSection, "minimumCost.additionalPerLevel", 3)
),
EnchantmentRegistryEntry.EnchantmentCost.of(
getInt(airbagSection, "maximumCost.base", 65),
getInt(airbagSection, "maximumCost.additionalPerLevel", 1)
),
getBoolean(airbagSection, "canGetFromEnchantingTable", true),
getTagsFromList(getStringList(
airbagSection,
"supportedItemTags",
List.of(
"minecraft:elytra"
)
)),
getInt(airbagSection, "maxLevel", 4),
getDouble(airbagSection, "damageReductionPerLevel", 0.2)
);
if (getBoolean(airbagSection, "enabled", true)) {
ENCHANTS.put(AirbagEnchant.KEY, airbagEnchant);
}
ConfigurationSection cursesSection = configuration.getConfigurationSection("curses");
if (cursesSection == null) {
cursesSection = configuration.createSection("curses");