Paper/nms-patches/EntitySilverfish.patch

27 lines
1.6 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntitySilverfish.java
+++ b/net/minecraft/server/EntitySilverfish.java
2016-06-09 03:43:49 +02:00
@@ -156,6 +156,11 @@
2015-02-26 23:41:06 +01:00
IBlockData iblockdata = world.getType(blockposition);
2016-02-29 22:32:46 +01:00
if (BlockMonsterEggs.i(iblockdata)) {
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
2016-07-08 03:12:40 +02:00
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition, Blocks.MONSTER_EGG, Block.getId(BlockMonsterEggs.getById(iblockdata.getBlock().toLegacyData(iblockdata)))).isCancelled()) {
2015-02-26 23:41:06 +01:00
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, Blocks.MONSTER_EGG.getBlockData().set(BlockMonsterEggs.VARIANT, BlockMonsterEggs.EnumMonsterEggVarient.a(iblockdata)), 3);
2016-02-29 22:32:46 +01:00
this.silverfish.doSpawnEffect();
2015-02-26 23:41:06 +01:00
this.silverfish.die();
2016-06-09 03:43:49 +02:00
@@ -199,6 +204,11 @@
2015-02-26 23:41:06 +01:00
IBlockData iblockdata = world.getType(blockposition1);
if (iblockdata.getBlock() == Blocks.MONSTER_EGG) {
+ // CraftBukkit start
2016-07-08 03:12:40 +02:00
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, Blocks.AIR, 0).isCancelled()) {
2015-02-26 23:41:06 +01:00
+ continue;
+ }
+ // CraftBukkit end
if (world.getGameRules().getBoolean("mobGriefing")) {
world.setAir(blockposition1, true);
} else {