Paper/patches/server/0673-Add-BellRevealRaiderEvent.patch

33 lines
1.9 KiB
Diff
Raw Normal View History

2021-06-15 05:50:26 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Wed, 26 May 2021 17:09:07 -0400
Subject: [PATCH] Add BellRevealRaiderEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
2021-11-24 23:50:33 +01:00
index b06e911acb825883c93da73358fa81653e8a0d4a..41e139c750dd3aadb7692e362e2d83f43799c905 100644
2021-06-15 05:50:26 +02:00
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
@@ -138,7 +138,7 @@ public class BellBlockEntity extends BlockEntity {
private static void makeRaidersGlow(Level world, BlockPos pos, List<LivingEntity> hearingEntities) {
2021-11-24 23:50:33 +01:00
hearingEntities.stream().filter((entity) -> {
return isRaiderWithinRange(pos, entity);
2021-06-15 05:50:26 +02:00
- }).forEach(BellBlockEntity::glow);
+ }).forEach(entity -> glow(entity, pos)); // Paper - pass BlockPos
}
private static void showBellParticles(Level world, BlockPos pos, List<LivingEntity> hearingEntities) {
@@ -170,7 +170,11 @@ public class BellBlockEntity extends BlockEntity {
return entity.isAlive() && !entity.isRemoved() && pos.closerThan(entity.position(), 48.0D) && entity.getType().is(EntityTypeTags.RAIDERS);
}
- private static void glow(LivingEntity entity) {
+ // Paper start
+ private static void glow(LivingEntity entity) { glow(entity, null); }
2021-11-24 23:50:33 +01:00
+ private static void glow(LivingEntity entity, @javax.annotation.Nullable BlockPos pos) {
2021-06-15 05:50:26 +02:00
+ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level.getWorld().getBlockAt(net.minecraft.server.MCUtil.toLocation(entity.level, pos)), entity.getBukkitEntity()).callEvent()) return;
+ // Paper end
entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60));
}