diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch index fc0846a693..9a0f632637 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch @@ -1,6 +1,26 @@ --- a/net/minecraft/world/level/block/entity/BellBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BellBlockEntity.java -@@ -120,7 +120,7 @@ +@@ -63,6 +63,11 @@ + + if (blockEntity.ticks >= 50) { + blockEntity.shaking = false; ++ // Paper start - Fix bell block entity memory leak ++ if (!blockEntity.resonating) { ++ blockEntity.nearbyEntities.clear(); ++ } ++ // Paper end - Fix bell block entity memory leak + blockEntity.ticks = 0; + } + +@@ -76,6 +81,7 @@ + ++blockEntity.resonationTicks; + } else { + bellEffect.run(world, pos, blockEntity.nearbyEntities); ++ blockEntity.nearbyEntities.clear(); // Paper - Fix bell block entity memory leak + blockEntity.resonating = false; + } + } +@@ -120,11 +126,12 @@ LivingEntity entityliving = (LivingEntity) iterator.next(); if (entityliving.isAlive() && !entityliving.isRemoved() && blockposition.closerToCenterThan(entityliving.position(), 32.0D)) { @@ -9,7 +29,12 @@ } } } -@@ -144,9 +144,13 @@ + ++ this.nearbyEntities.removeIf(e -> !e.isAlive()); // Paper - Fix bell block entity memory leak + } + + private static boolean areRaidersNearby(BlockPos pos, List hearingEntities) { +@@ -144,9 +151,13 @@ } private static void makeRaidersGlow(Level world, BlockPos pos, List hearingEntities) {