mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-26 06:53:20 +00:00
Add AnimalTameEvent for handling animal taming (#3763)
This commit is contained in:
1 parent
f22874d3be
commit
901df8345c
6 files changed
+120
No files matched your search
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
/**
|
||||
* This event is fired when an {@link EntityAnimal} is tamed. <br>
|
||||
* It is fired via {@link ForgeEventFactory#onAnimalTame(EntityAnimal, EntityPlayer)}.
|
||||
* Forge fires this event for applicable vanilla animals, mods need to fire it themselves.
|
||||
* This event is {@link Cancelable}. If canceled, taming the animal will fail.
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
@Cancelable
|
||||
public class AnimalTameEvent extends LivingEvent
|
||||
{
|
||||
private final EntityAnimal animal;
|
||||
private final EntityPlayer tamer;
|
||||
|
||||
public AnimalTameEvent(EntityAnimal animal, EntityPlayer tamer)
|
||||
{
|
||||
super(animal);
|
||||
this.animal = animal;
|
||||
this.tamer = tamer;
|
||||
}
|
||||
|
||||
public EntityAnimal getAnimal()
|
||||
{
|
||||
return animal;
|
||||
}
|
||||
|
||||
public EntityPlayer getTamer()
|
||||
{
|
||||
return tamer;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user