summaryrefslogtreecommitdiffstats
path: root/nms-patches/PathfinderGoalRemoveBlock.patch
blob: 7da7e60e5d977033f1079154f9a8c412c76fca26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- a/net/minecraft/server/PathfinderGoalRemoveBlock.java
+++ b/net/minecraft/server/PathfinderGoalRemoveBlock.java
@@ -2,6 +2,10 @@
 
 import java.util.Random;
 import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.entity.EntityInteractEvent;
+// CraftBukkit end
 
 public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
 
@@ -66,6 +70,14 @@
             }
 
             if (this.h > 60) {
+                // CraftBukkit start - Step on eggs
+                EntityInteractEvent event = new EntityInteractEvent(this.entity.getBukkitEntity(), CraftBlock.at(world, blockposition1));
+                world.getServer().getPluginManager().callEvent((EntityInteractEvent) event);
+
+                if (event.isCancelled()) {
+                    return;
+                }
+                // CraftBukkit end
                 world.setAir(blockposition1);
                 if (!world.isClientSide) {
                     for (int i = 0; i < 20; ++i) {