Advertisement
ButterAleks

LivingSetAttackTargetEvent

Apr 8th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. /*
  2. * Minecraft Forge
  3. * Copyright (c) 2016-2018.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation version 2.1
  8. * of the License.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19.  
  20. package net.minecraftforge.event.entity.living;
  21.  
  22. import net.minecraft.entity.EntityLiving;
  23. import net.minecraft.entity.EntityLivingBase;
  24. import net.minecraftforge.common.ForgeHooks;
  25. import net.minecraftforge.common.MinecraftForge;
  26. import net.minecraftforge.fml.common.eventhandler.Cancelable;
  27.  
  28. /**
  29. * LivingSetAttackTargetEvent is fired when an Entity sets a target to attack.<br>
  30. * This event is fired whenever an Entity sets a target to attack in
  31. * {@link EntityLiving#setAttackTarget(EntityLivingBase)} and
  32. * {@link EntityLivingBase#setRevengeTarget(EntityLivingBase)}.<br>
  33. * <br>
  34. * This event is fired via the {@link ForgeHooks#onLivingSetAttackTarget(EntityLivingBase, EntityLivingBase)}.<br>
  35. * <br>
  36. * {@link #target} contains the newly targeted Entity.<br>
  37. * <br>
  38. * This event is not {@link Cancelable}.<br>
  39. * <br>
  40. * This event does not have a result. {@link HasResult}<br>
  41. * <br>
  42. * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
  43. **/
  44. public class LivingSetAttackTargetEvent extends LivingEvent
  45. {
  46.  
  47. private final EntityLivingBase target;
  48. public LivingSetAttackTargetEvent(EntityLivingBase entity, EntityLivingBase target)
  49. {
  50. super(entity);
  51. this.target = target;
  52. }
  53.  
  54. public EntityLivingBase getTarget()
  55. {
  56. return target;
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement