|
1 | | -/* |
2 | | - * Minecraft Forge, Patchwork Project |
3 | | - * Copyright (c) 2016-2019, 2019 |
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.LivingEntity; |
23 | | -import net.minecraft.entity.damage.DamageSource; |
24 | | - |
25 | | -/** |
26 | | - * LivingAttackEvent is fired when a living Entity is attacked. |
27 | | - * |
28 | | - * <p>This event is fired whenever a {@link LivingEntity} is attacked in |
29 | | - * {@link LivingEntity#damage(DamageSource, float)} and |
30 | | - * {@link net.minecraft.entity.player.PlayerEntity#damage(DamageSource, float)}.</p> |
31 | | - * |
32 | | - * <p>This event is fired via the {@link com.patchworkmc.impl.event.entity.EntityEvents#onLivingAttack(EntityLivingBase, DamageSource, float)}.</p> |
33 | | - * |
34 | | - * <p>{@link #source} contains the {@link DamageSource} of the attack. |
35 | | - * {@link #amount} contains the amount of damage dealt to the entity.</p> |
36 | | - * |
37 | | - * <p>This event is cancellable. |
38 | | - * If this event is canceled, the {@link LivingEntity} does not take attack damage.</p> |
39 | | - * |
40 | | - * <p>This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.</p> |
41 | | - */ |
42 | | -public class LivingAttackEvent extends LivingEvent { |
43 | | - private final DamageSource source; |
44 | | - private final float damage; |
45 | | - |
46 | | - public LivingAttackEvent() { |
47 | | - this.source = null; |
48 | | - this.damage = 0f; |
49 | | - } |
50 | | - |
51 | | - public LivingAttackEvent(LivingEntity entity, DamageSource source, float damage) { |
52 | | - super(entity); |
53 | | - this.source = source; |
54 | | - this.damage = damage; |
55 | | - } |
56 | | - |
57 | | - public DamageSource getSource() { |
58 | | - return source; |
59 | | - } |
60 | | - |
61 | | - public float getAmount() { |
62 | | - return damage; |
63 | | - } |
64 | | - |
65 | | - @Override |
66 | | - public boolean isCancelable() { |
67 | | - return true; |
68 | | - } |
69 | | -} |
| 1 | +/* |
| 2 | + * Minecraft Forge, Patchwork Project |
| 3 | + * Copyright (c) 2016-2019, 2019 |
| 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.LivingEntity; |
| 23 | +import net.minecraft.entity.damage.DamageSource; |
| 24 | + |
| 25 | +/** |
| 26 | + * LivingAttackEvent is fired when a {@link LivingEntity} is attacked. |
| 27 | + * |
| 28 | + * <p>This event is fired whenever a {@link LivingEntity} is attacked in |
| 29 | + * {@link LivingEntity#damage(DamageSource, float)} and |
| 30 | + * {@link net.minecraft.entity.player.PlayerEntity#damage(DamageSource, float)}.</p> |
| 31 | + * |
| 32 | + * <p>This event is fired via {@link com.patchworkmc.impl.event.entity.EntityEvents#onLivingAttack(LivingEntity, DamageSource, float)}.</p> |
| 33 | + * |
| 34 | + * <p>{@link #source} contains the {@link DamageSource} of the attack. |
| 35 | + * {@link #damage} contains the amount of damage dealt to the entity.</p> |
| 36 | + * |
| 37 | + * <p>This event is cancellable. |
| 38 | + * If this event is canceled, the {@link LivingEntity} does not take attack damage.</p> |
| 39 | + * |
| 40 | + * <p>This event is fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS}.</p> |
| 41 | + */ |
| 42 | +public class LivingAttackEvent extends LivingEvent { |
| 43 | + private final DamageSource source; |
| 44 | + private final float damage; |
| 45 | + |
| 46 | + public LivingAttackEvent() { |
| 47 | + this.source = null; |
| 48 | + this.damage = 0f; |
| 49 | + } |
| 50 | + |
| 51 | + public LivingAttackEvent(LivingEntity entity, DamageSource source, float damage) { |
| 52 | + super(entity); |
| 53 | + this.source = source; |
| 54 | + this.damage = damage; |
| 55 | + } |
| 56 | + |
| 57 | + public DamageSource getSource() { |
| 58 | + return source; |
| 59 | + } |
| 60 | + |
| 61 | + public float getAmount() { |
| 62 | + return damage; |
| 63 | + } |
| 64 | + |
| 65 | + @Override |
| 66 | + public boolean isCancelable() { |
| 67 | + return true; |
| 68 | + } |
| 69 | +} |
0 commit comments