package net.minecraft.world.item;

import net.minecraft.sounds.SoundSource;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.entity.animal.Pig;
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 boolean interactEnemy(final ItemStack ben, final Player ayj, final LivingEntity akz, final InteractionHand ajk) {
        if (akz instanceof Pig) {
            final Pig atq6 = (Pig)akz;
            if (atq6.isAlive() && !atq6.hasSaddle() && !atq6.isBaby()) {
                atq6.setSaddle(true);
                atq6.level.playSound(ayj, atq6.getX(), atq6.getY(), atq6.getZ(), SoundEvents.PIG_SADDLE, SoundSource.NEUTRAL, 0.5f, 1.0f);
                ben.shrink(1);
                return true;
            }
        }
        return false;
    }
}
