2021-03-16 09:00:00 +11:00
|
|
|
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
|
|
|
|
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -30,6 +30,11 @@
|
|
|
|
import net.minecraft.world.level.block.BlockMonsterEggs;
|
2023-06-24 17:15:05 +10:00
|
|
|
import net.minecraft.world.level.block.state.IBlockData;
|
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
2024-02-21 20:55:34 +11:00
|
|
|
+import org.bukkit.event.entity.EntityRemoveEvent;
|
2023-06-24 17:15:05 +10:00
|
|
|
+// CraftBukkit end
|
|
|
|
+
|
|
|
|
public class EntitySilverfish extends EntityMonster {
|
|
|
|
|
|
|
|
@Nullable
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -157,6 +162,11 @@
|
2018-07-15 10:00:00 +10:00
|
|
|
Block block = iblockdata.getBlock();
|
2015-02-26 22:41:06 +00:00
|
|
|
|
2018-07-15 10:00:00 +10:00
|
|
|
if (block instanceof BlockMonsterEggs) {
|
2015-02-26 22:41:06 +00:00
|
|
|
+ // CraftBukkit start
|
2023-06-24 17:15:05 +10:00
|
|
|
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
|
2015-02-26 22:41:06 +00:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-06-11 15:00:00 +10:00
|
|
|
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
2021-11-22 09:00:00 +11:00
|
|
|
world.destroyBlock(blockposition1, true, this.silverfish);
|
2015-02-26 22:41:06 +00:00
|
|
|
} else {
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -226,9 +236,14 @@
|
2021-11-22 09:00:00 +11:00
|
|
|
IBlockData iblockdata = world.getBlockState(blockposition);
|
2021-06-11 15:00:00 +10:00
|
|
|
|
2021-11-22 09:00:00 +11:00
|
|
|
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {
|
2021-06-11 15:00:00 +10:00
|
|
|
+ // CraftBukkit start
|
2023-06-24 17:15:05 +10:00
|
|
|
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata))) {
|
2021-06-11 15:00:00 +10:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2021-11-22 09:00:00 +11:00
|
|
|
world.setBlock(blockposition, BlockMonsterEggs.infestedStateByHost(iblockdata), 3);
|
|
|
|
this.mob.spawnAnim();
|
2024-02-21 20:55:34 +11:00
|
|
|
- this.mob.discard();
|
|
|
|
+ this.mob.discard(EntityRemoveEvent.Cause.ENTER_BLOCK); // CraftBukkit - add Bukkit remove cause
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|