PaperMC/paper-server/nms-patches/net/minecraft/world/entity/monster/EntitySilverfish.patch
CraftBukkit/Spigot b97cc9b99f #1209: Clean up various patches
By: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
2023-06-24 17:15:05 +10:00

37 lines
1.8 KiB
Diff

--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
@@ -33,6 +33,10 @@
import net.minecraft.world.level.block.BlockMonsterEggs;
import net.minecraft.world.level.block.state.IBlockData;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class EntitySilverfish extends EntityMonster {
@Nullable
@@ -175,6 +179,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockMonsterEggs) {
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
+ continue;
+ }
+ // CraftBukkit end
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
world.destroyBlock(blockposition1, true, this.silverfish);
} else {
@@ -244,6 +253,11 @@
IBlockData iblockdata = world.getBlockState(blockposition);
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata))) {
+ return;
+ }
+ // CraftBukkit end
world.setBlock(blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata), 3);
this.mob.spawnAnim();
this.mob.discard();