I've changed it to this, but I get the error "'MobEffect(net.minecraft.world.effect.MobEffectCategory, int)' has protected access in 'net.minecraft.world.effect.MobEffect'"
It also returns the error on run:
"required: MobEffectCategory,int
found: no arguments
reason: actual and formal argument lists differ in length"
public class DarksteelHornItem extends Item {
public DarksteelHornItem(Properties properties) {
super(properties);
}
@Override
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
if(level.isClientSide() == true && hand == InteractionHand.MAIN_HAND) {
level.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.RAID_HORN, SoundSource.PLAYERS, 1.0F, 1.0F);
if(level.isClientSide() == false && hand == InteractionHand.MAIN_HAND){
player.addEffect(new MobEffectInstance(new MobEffect(),5));
}
player.getCooldowns().addCooldown(this,400);
}
return super.use(level, player, hand);
}
}