Files
CatServer/patches/net/minecraft/entity/monster/EntitySilverfish.java.patch
2018-09-08 11:39:03 +08:00

27 lines
1.7 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySilverfish.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySilverfish.java
@@ -221,6 +221,11 @@
if (BlockSilverfish.canContainSilverfish(iblockstate))
{
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockpos, Blocks.MONSTER_EGG, Block.getIdFromBlock(BlockSilverfish.getBlockById(iblockstate.getBlock().getMetaFromState(iblockstate)))).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setBlockState(blockpos, Blocks.MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.forModelBlock(iblockstate)), 3);
this.silverfish.spawnExplosionParticle();
this.silverfish.setDead();
@@ -273,6 +278,11 @@
if (iblockstate.getBlock() == Blocks.MONSTER_EGG)
{
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockpos1, Blocks.AIR, 0).isCancelled()) {
+ continue;
+ }
+ // CraftBukkit end
if (world.getGameRules().getBoolean("mobGriefing"))
{
world.destroyBlock(blockpos1, true);