package net.minecraft.world.item;

import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.Saddleable;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;

public class SaddleItem extends Item {
    public SaddleItem(final Properties a) {
        super(a);
    }
    
    @Override
    public InteractionResult interactLivingEntity(final ItemStack bki, final Player bec, final LivingEntity aoy, final InteractionHand anf) {
        if (aoy instanceof Saddleable && aoy.isAlive()) {
            final Saddleable apm6 = (Saddleable)aoy;
            if (!apm6.isSaddled() && apm6.isSaddleable()) {
                if (!bec.level.isClientSide) {
                    apm6.equipSaddle(SoundSource.NEUTRAL);
                    bki.shrink(1);
                }
                return InteractionResult.sidedSuccess(bec.level.isClientSide);
            }
        }
        return InteractionResult.PASS;
    }
}
