From e7a63287d8b167d9257d4152144e7d384e07dad8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 16 Jun 2021 08:34:34 +1000 Subject: [PATCH] SPIGOT-6562: Add more specific sculk sensor event --- .../vibrations/VibrationListener.patch | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 nms-patches/net/minecraft/world/level/gameevent/vibrations/VibrationListener.patch diff --git a/nms-patches/net/minecraft/world/level/gameevent/vibrations/VibrationListener.patch b/nms-patches/net/minecraft/world/level/gameevent/vibrations/VibrationListener.patch new file mode 100644 index 000000000..e73b1381b --- /dev/null +++ b/nms-patches/net/minecraft/world/level/gameevent/vibrations/VibrationListener.patch @@ -0,0 +1,31 @@ +--- a/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java ++++ b/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java +@@ -18,6 +18,13 @@ + import net.minecraft.world.phys.MovingObjectPosition; + import net.minecraft.world.phys.Vec3D; + ++// CraftBukkit start ++import net.minecraft.core.IRegistry; ++import org.bukkit.craftbukkit.block.CraftBlock; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.bukkit.event.block.BlockReceiveGameEvent; ++// CraftBukkit end ++ + public class VibrationListener implements GameEventListener { + + protected final PositionSource listenerSource; +@@ -67,7 +74,13 @@ + } else { + BlockPosition blockposition1 = (BlockPosition) optional.get(); + +- if (!this.config.a(world, this, blockposition, gameevent, entity)) { ++ // CraftBukkit start ++ boolean defaultCancel = !this.config.a(world, this, blockposition, gameevent, entity); ++ BlockReceiveGameEvent event = new BlockReceiveGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), CraftBlock.at(world, blockposition), (entity == null) ? null : entity.getBukkitEntity()); ++ event.setCancelled(defaultCancel); ++ world.getCraftServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ // CraftBukkit end + return false; + } else if (this.a(world, blockposition, blockposition1)) { + return false;