Paper/patches/server/0512-Add-BellRingEvent.patch
Shane Freeder aa52bf9e33
Remove "Implement-Chunk-Priority-Urgency-System-for-Chunks" (Fixes #5980)
Mojang made some changes to priorities in 1.17 and it seems that these changes
conflict with the changes made in this patch, which in some cases appears to
cause excessive rescheduling of tasks.

This, however, is not confirmed as such but seems to be the behavior that we're
seeing to cause this issue, if mojang has adopted the changes we suggested,
then a good chunk of this patch may be unneeded, but, this needs a much better
look than I'm currently able to do
2021-08-14 14:55:55 +01:00

29 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Eearslya Sleiarion <eearslya@gmail.com>
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 3392d9b45d4bfba7ad3e3a84cdd4f2a29b58e4ff..1864984197a6b28cccb3a57b6856f61766d6a467 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.RING_BELL, pos);