Commits

Doc authored and md_5 committed 743e59541b6
SPIGOT-8016: Call knockback event for mace area knockback
No tags

nms-patches/net/minecraft/world/item/MaceItem.patch

Added
1 +--- a/net/minecraft/world/item/MaceItem.java
2 ++++ b/net/minecraft/world/item/MaceItem.java
3 +@@ -27,6 +27,10 @@
4 + import net.minecraft.world.level.block.state.IBlockData;
5 + import net.minecraft.world.phys.Vec3D;
6 +
7 ++// CraftBukkit start
8 ++import org.bukkit.craftbukkit.util.CraftVector;
9 ++// CraftBukkit end
10 ++
11 + public class MaceItem extends Item {
12 +
13 + private static final int DEFAULT_ATTACK_DAMAGE = 5;
14 +@@ -144,7 +148,15 @@
15 + Vec3D vec3d1 = vec3d.normalize().scale(d0);
16 +
17 + if (d0 > 0.0D) {
18 +- entityliving.push(vec3d1.x, 0.699999988079071D, vec3d1.z);
19 ++ // entityliving.push(vec3d1.x, 0.699999988079071D, vec3d1.z); // CraftBukkit - moved below
20 ++ // CraftBukkit start - EntityKnockbackEvent
21 ++ Vec3D vec3dPush = new Vec3D(vec3d1.x, 0.699999988079071D, vec3d1.z);
22 ++ Vec3D result = entity.getDeltaMovement().add(vec3dPush);
23 ++ org.bukkit.event.entity.EntityKnockbackEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) entityliving.getBukkitEntity(), entity1, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK, d0, result, vec3dPush.x, vec3dPush.y, vec3dPush.z);
24 ++ if (!event.isCancelled()) {
25 ++ entityliving.push(CraftVector.toNMS(event.getFinalKnockback()));
26 ++ }
27 ++ // CraftBukkit end
28 + if (entityliving instanceof EntityPlayer) {
29 + EntityPlayer entityplayer = (EntityPlayer) entityliving;
30 +

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut