Paper/paper-server/nms-patches/net/minecraft/world/entity/monster/EntitySilverfish.patch
CraftBukkit/Spigot 43702a9e10 Update to Minecraft 1.18-pre5
By: md_5 <git@md-5.net>
2021-11-22 09:00:00 +11:00

27 lines
1.6 KiB
Diff

--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
@@ -173,6 +173,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockMonsterEggs) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) {
+ continue;
+ }
+ // CraftBukkit end
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
world.destroyBlock(blockposition1, true, this.silverfish);
} else {
@@ -242,6 +247,11 @@
IBlockData iblockdata = world.getBlockState(blockposition);
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata)).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setBlock(blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata), 3);
this.mob.spawnAnim();
this.mob.discard();