List of usage examples for net.minecraftforge.event ForgeEventFactory onAnimalTame
public static boolean onAnimalTame(AnimalEntity animal, PlayerEntity tamer)
From source file:nightkosh.gravestone_extended.entity.EntityRaven.java
License:LGPL
@Override public boolean processInteract(EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (!this.isTamed() && Items.ROTTEN_FLESH == stack.getItem()) { if (!player.capabilities.isCreativeMode) { stack.shrink(1);/*from w w w . j a v a 2 s. com*/ } if (!this.isSilent()) { this.world.playSound(null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PARROT_EAT, this.getSoundCategory(), 1, 1 + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); } if (!this.world.isRemote) { if (this.rand.nextInt(10) == 0 && !ForgeEventFactory.onAnimalTame(this, player)) { this.setTamedBy(player); this.playTameEffect(true); this.world.setEntityState(this, (byte) 7); } else { this.playTameEffect(false); this.world.setEntityState(this, (byte) 6); } } return true; } else { if (!this.world.isRemote && !this.isFlying() && this.isTamed() && this.isOwner(player)) { this.aiSit.setSitting(!this.isSitting()); } return super.processInteract(player, hand); } }