SPIGOT-7072: Call events for stepping on sculk sensors and sculk shriekers

By: BlackHole <black-hole@live.com>
This commit is contained in:
CraftBukkit/Spigot
2022-06-23 20:25:36 +10:00
parent 6e92592b55
commit c6f488dfd5
2 changed files with 31 additions and 4 deletions

View File

@@ -1,6 +1,14 @@
--- a/net/minecraft/world/level/block/SculkShriekerBlock.java
+++ b/net/minecraft/world/level/block/SculkShriekerBlock.java
@@ -140,10 +140,17 @@
@@ -56,6 +56,7 @@
EntityPlayer entityplayer = SculkShriekerBlockEntity.tryGetPlayer(entity);
if (entityplayer != null) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityplayer, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null).isCancelled()) return; // CraftBukkit
worldserver.getBlockEntity(blockposition, TileEntityTypes.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> {
sculkshriekerblockentity.tryShriek(worldserver, entityplayer);
});
@@ -140,10 +141,17 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);