Improved 1.20.4 enchantments

This commit is contained in:
Will FP 2023-12-15 13:06:18 +00:00
parent bf012dff02
commit 9e08069aec

View File

@ -1,7 +1,12 @@
package com.willfp.ecoenchants.proxy.v1_20_R3.registration
import com.willfp.eco.core.Prerequisite
import com.willfp.eco.util.toComponent
import com.willfp.ecoenchants.display.getFormattedName
import com.willfp.ecoenchants.enchant.EcoEnchant
import com.willfp.ecoenchants.enchant.EcoEnchants
import io.papermc.paper.adventure.PaperAdventure
import net.minecraft.network.chat.Component
import net.minecraft.world.damagesource.DamageSource
import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.EquipmentSlot
@ -108,6 +113,15 @@ class VanillaEcoEnchantsEnchantment(
return mutableMapOf()
}
override fun getFullname(level: Int): Component {
val enchant = this.enchant
return if (Prerequisite.HAS_PAPER.isMet && enchant != null) {
PaperAdventure.asVanilla(enchant.getFormattedName(level).toComponent())
} else {
super.getFullname(level)
}
}
override fun toString(): String {
return "VanillaEcoEnchantsEnchantment(id='$id')"
}