summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntitySilverfish.patch
blob: 6eeae7d5bb56ca0252af28d851c3b300928de370 (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
--- a/net/minecraft/server/EntitySilverfish.java
+++ b/net/minecraft/server/EntitySilverfish.java
@@ -153,6 +153,11 @@
                 IBlockData iblockdata = world.getType(blockposition);
 
                 if (BlockMonsterEggs.j(iblockdata)) {
+                    // CraftBukkit start
+                    if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, BlockMonsterEggs.f(iblockdata.getBlock())).isCancelled()) {
+                        return;
+                    }
+                    // CraftBukkit end
                     world.setTypeAndData(blockposition, BlockMonsterEggs.f(iblockdata.getBlock()), 3);
                     this.a.doSpawnEffect();
                     this.a.die();
@@ -197,6 +202,11 @@
                             Block block = iblockdata.getBlock();
 
                             if (block instanceof BlockMonsterEggs) {
+                                // CraftBukkit start
+                                if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, Blocks.AIR.getBlockData()).isCancelled()) {
+                                    continue;
+                                }
+                                // CraftBukkit end
                                 if (world.getGameRules().getBoolean("mobGriefing")) {
                                     world.setAir(blockposition1, true);
                                 } else {