2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
|
|
|
|
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
|
2023-06-24 09:15:05 +02:00
|
|
|
@@ -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 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
Block block = iblockdata.getBlock();
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
if (block instanceof BlockMonsterEggs) {
|
2015-02-26 23:41:06 +01:00
|
|
|
+ // CraftBukkit start
|
2023-06-24 09:15:05 +02:00
|
|
|
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
|
2015-02-26 23:41:06 +01:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-06-11 07:00:00 +02:00
|
|
|
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
2021-11-21 23:00:00 +01:00
|
|
|
world.destroyBlock(blockposition1, true, this.silverfish);
|
2015-02-26 23:41:06 +01:00
|
|
|
} else {
|
2023-06-24 09:15:05 +02:00
|
|
|
@@ -244,6 +253,11 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
IBlockData iblockdata = world.getBlockState(blockposition);
|
2021-06-11 07:00:00 +02:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {
|
2021-06-11 07:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
2023-06-24 09:15:05 +02:00
|
|
|
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata))) {
|
2021-06-11 07:00:00 +02:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
world.setBlock(blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata), 3);
|
|
|
|
this.mob.spawnAnim();
|
|
|
|
this.mob.discard();
|