aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0471-Add-BellRingEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0471-Add-BellRingEvent.patch')
-rw-r--r--patches/server/0471-Add-BellRingEvent.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/patches/server/0471-Add-BellRingEvent.patch b/patches/server/0471-Add-BellRingEvent.patch
new file mode 100644
index 0000000000..e6528721cf
--- /dev/null
+++ b/patches/server/0471-Add-BellRingEvent.patch
@@ -0,0 +1,28 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Eearslya Sleiarion <[email protected]>
+Date: Sun, 23 Aug 2020 13:04:02 +0200
+Subject: [PATCH] Add BellRingEvent
+
+Add a new event, BellRingEvent, to trigger whenever a player rings a
+village bell. Passes along the bell block and the player who rang it.
+
+diff --git a/src/main/java/net/minecraft/world/level/block/BellBlock.java b/src/main/java/net/minecraft/world/level/block/BellBlock.java
+index a4da6418c17e145333aa5efe427826ba53293e4d..14002e1f67e3dce421584c01e8f91769509638b7 100644
+--- a/src/main/java/net/minecraft/world/level/block/BellBlock.java
++++ b/src/main/java/net/minecraft/world/level/block/BellBlock.java
+@@ -3,6 +3,7 @@ package net.minecraft.world.level.block;
+ import javax.annotation.Nullable;
+ import net.minecraft.core.BlockPos;
+ import net.minecraft.core.Direction;
++import net.minecraft.server.MCUtil;
+ import net.minecraft.sounds.SoundEvents;
+ import net.minecraft.sounds.SoundSource;
+ import net.minecraft.stats.Stats;
+@@ -131,6 +132,7 @@ public class BellBlock extends BaseEntityBlock {
+ direction = world.getBlockState(pos).getValue(FACING);
+ }
+
++ if (!new io.papermc.paper.event.block.BellRingEvent(world.getWorld().getBlockAt(MCUtil.toLocation(world, pos)), entity == null ? null : entity.getBukkitEntity()).callEvent()) return false; // Paper - BellRingEvent
+ ((BellBlockEntity)blockEntity).onHit(direction);
+ world.playSound((Player)null, pos, SoundEvents.BELL_BLOCK, SoundSource.BLOCKS, 2.0F, 1.0F);
+ world.gameEvent(entity, GameEvent.BLOCK_CHANGE, pos);