com.magistuarmory.item.armor.JoustingItem Maven / Gradle / Ivy
package com.magistuarmory.item.armor;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.annotation.Nullable;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import java.util.List;
public class JoustingItem extends MedievalArmorItem implements ISurcoat
{
public JoustingItem(ArmorMaterial material, EquipmentSlot type, Properties properties)
{
super(material, type, properties);
}
@Override
public void m_6883_(ItemStack stack, Level level, Entity entity, int i, boolean selected)
{
if (entity instanceof LivingEntity livingentity && livingentity.m_6844_(this.m_40402_()) == stack)
livingentity.m_7292_(new MobEffectInstance(MobEffects.f_19597_, 40, 1, false, false, false));
super.m_6883_(stack, level, entity, i, selected);
}
@Override
public void m_7373_(ItemStack stack, @Nullable Level level, List tooltip, TooltipFlag flag)
{
tooltip.add((Component.m_237115_("slowmovementspeed")).m_130940_(ChatFormatting.RED));
}
}