29 lines
993 B
Java
29 lines
993 B
Java
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 bek, final Player ayg, final LivingEntity akw, final InteractionHand ajh) {
|
|
if (akw instanceof Pig) {
|
|
final Pig atn6 = (Pig)akw;
|
|
if (atn6.isAlive() && !atn6.hasSaddle() && !atn6.isBaby()) {
|
|
atn6.setSaddle(true);
|
|
atn6.level.playSound(ayg, atn6.getX(), atn6.getY(), atn6.getZ(), SoundEvents.PIG_SADDLE, SoundSource.NEUTRAL, 0.5f, 1.0f);
|
|
bek.shrink(1);
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|