mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
7c2dc4b342
* finish implementing all adventure components in codecs * add some initial tests * Add round trip tests for text and translatable components * Add more round trip test data (score component is failing) * Add more round trip test data * Fix SCORE_COMPONENT_MAP_CODEC * Improve test failure messages * Add failure cases * Add a couple more test data * Make use of AdventureCodecs * Update patches after rebase * Squash changes into adventure patch * Fix AT formatting * update comment --------- Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
39 lines
1.8 KiB
Diff
39 lines
1.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: giacomo <32515303+giacomozama@users.noreply.github.com>
|
|
Date: Sat, 10 Oct 2020 12:15:33 +0200
|
|
Subject: [PATCH] Fixed TileEntityBell memory leak
|
|
|
|
TileEntityBell has a list of entities (entitiesAtRing) that was not being cleared at the right time, causing leaks whenever a bell would be rung near a crowd of entities.
|
|
|
|
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
|
|
index 30e9d4b20005dc6d20baf578f2ae958bdfcea02a..b446d6549922f3dabaaa05793d8ee3eb45566ac3 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
|
@@ -63,6 +63,11 @@ public class BellBlockEntity extends BlockEntity {
|
|
|
|
if (blockEntity.ticks >= 50) {
|
|
blockEntity.shaking = false;
|
|
+ // Paper start
|
|
+ if (!blockEntity.resonating) {
|
|
+ blockEntity.nearbyEntities.clear();
|
|
+ }
|
|
+ // Paper end
|
|
blockEntity.ticks = 0;
|
|
}
|
|
|
|
@@ -76,6 +81,7 @@ public class BellBlockEntity extends BlockEntity {
|
|
++blockEntity.resonationTicks;
|
|
} else {
|
|
bellEffect.run(world, pos, blockEntity.nearbyEntities);
|
|
+ blockEntity.nearbyEntities.clear(); // Paper
|
|
blockEntity.resonating = false;
|
|
}
|
|
}
|
|
@@ -125,6 +131,7 @@ public class BellBlockEntity extends BlockEntity {
|
|
}
|
|
}
|
|
|
|
+ this.nearbyEntities.removeIf(e -> !e.isAlive()); // Paper
|
|
}
|
|
|
|
private static boolean areRaidersNearby(BlockPos pos, List<LivingEntity> hearingEntities) {
|