diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/EquipmentTags.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/EquipmentTags.kt index 3b2d9d3eb..3b3ae39d3 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/EquipmentTags.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/EquipmentTags.kt @@ -34,7 +34,12 @@ fun addEquipmentTags(tagsProvider: TagsProvider) { .add(MItems.TRITANIUM_BOOTS) .add(MItems.SIMPLE_TRITANIUM_BOOTS) - tagsProvider.items.Appender(ItemTags.SWORDS).add(MItems.TRITANIUM_SWORD).add(MItems.ENERGY_SWORD) + tagsProvider.items.Appender(ItemTags.SWORDS) + .add(MItems.TRITANIUM_SWORD) + .add(MItems.ENERGY_SWORD) + .add(MItems.FALLING_SUN) + .add(MItems.WITHERED_STEEL_SWORD) + tagsProvider.items.Appender(ItemTags.AXES).add(MItems.TRITANIUM_AXE) tagsProvider.items.Appender(ItemTags.PICKAXES).add(MItems.TRITANIUM_PICKAXE) tagsProvider.items.Appender(ItemTags.SHOVELS).add(MItems.TRITANIUM_SHOVEL) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/WitheredSteelSwordItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/WitheredSteelSwordItem.kt index 8960a05fb..60101524a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/WitheredSteelSwordItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/weapon/WitheredSteelSwordItem.kt @@ -13,23 +13,19 @@ import net.minecraft.world.item.Tiers import net.minecraft.world.item.component.ItemAttributeModifiers import ru.dbotthepony.mc.otm.registry.game.MItems -class WitheredSteelSwordItem(properties: Item.Properties) : SwordItem(Tiers.IRON, properties){ +class WitheredSteelSwordItem(properties: Properties) : SwordItem(Tiers.IRON, properties) { private val attributes: ItemAttributeModifiers init { - var builder = ItemAttributeModifiers.builder() + val builder = ItemAttributeModifiers.builder() builder.add(Attributes.ATTACK_DAMAGE, AttributeModifier(BASE_ATTACK_DAMAGE_ID, 4.5, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND) builder.add(Attributes.ATTACK_SPEED, AttributeModifier(BASE_ATTACK_SPEED_ID, -2.4, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND) attributes = builder.build() } - override fun getMaxDamage(stack: ItemStack): Int { - return 420 - } - - override fun isEnchantable(p_41456_: ItemStack): Boolean { - return p_41456_.count == 1 + override fun isEnchantable(stack: ItemStack): Boolean { + return stack.count == 1 } override fun getEnchantmentValue(stack: ItemStack): Int { @@ -41,13 +37,12 @@ class WitheredSteelSwordItem(properties: Item.Properties) : SwordItem(Tiers.IRON } override fun hurtEnemy(stack: ItemStack, target: LivingEntity, attacker: LivingEntity): Boolean { - target.addEffect(MobEffectInstance(MobEffects.WITHER, 100, 0)) - return super.hurtEnemy(stack, target, attacker) + val status = super.hurtEnemy(stack, target, attacker) + if (status) target.addEffect(MobEffectInstance(MobEffects.WITHER, 100, 0)) + return status } override fun getDefaultAttributeModifiers(stack: ItemStack): ItemAttributeModifiers { return attributes } - - }