From df28f86cce4c3e807521ceed8125efec35ccd1ac Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 16 Jun 2021 08:34:34 +1000 Subject: [PATCH] SPIGOT-6562: Add more specific sculk sensor event By: md_5 --- .../vibrations/VibrationListener.patch | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 paper-server/nms-patches/net/minecraft/world/level/gameevent/vibrations/VibrationListener.patch diff --git a/paper-server/nms-patches/net/minecraft/world/level/gameevent/vibrations/VibrationListener.patch b/paper-server/nms-patches/net/minecraft/world/level/gameevent/vibrations/VibrationListener.patch new file mode 100644 index 0000000000..e73b1381bc --- /dev/null +++ b/paper-server/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;