Describe the bug
Every 120 seconds the rendered hearts will briefly flicker.
How To Reproduce
Steps to reproduce the behavior:
- Set "[x] Show for players" and "[x] Always show for players" and "Indicator Type: Hearts".
- Join a server with 2 players.
- Look permanently at the second player and wait for about 2 minutes.
=> rendered hearts will briefly flicker.
Expected behavior
Rendered hearts will be rendered permanently, and not flicker.
Desktop (please complete the following information):
- Minecraft Version: 1.21.8
- Java Version: 21
- Mod Version: 21.6.0
Additional context
I think it might be caused by how the time_after_hit is handled:
For all entities it is set to time_after_hit (if set and applicable) or 2400 ticks = 120 seconds.
|
UUIDS.put(livingEntity.getUuid(), ModConfig.HANDLER.instance().after_attack ? (ModConfig.HANDLER.instance().time_after_hit * 20) : 2400); |
And on each tick, all entities are looped and eventually they get removed from the renderer:
|
public static void trimEntities(ClientWorld world) { |
|
// Check if there's a need to trim entries |
|
Iterator<Map.Entry<UUID, Integer>> iterator = UUIDS.entrySet().iterator(); |
|
while (iterator.hasNext()) { |
|
Map.Entry<UUID, Integer> entry = iterator.next(); |
|
entry.setValue(entry.getValue() - 1); |
|
if (entry.getValue() <= 0) { |
|
iterator.remove(); // Safe removal during iteration |
|
} |
|
} |
I guess it is to prevent piling up too many UUIDs. But there should be a better way to clean them up, without flicker.
Describe the bug
Every 120 seconds the rendered hearts will briefly flicker.
How To Reproduce
Steps to reproduce the behavior:
=> rendered hearts will briefly flicker.
Expected behavior
Rendered hearts will be rendered permanently, and not flicker.
Desktop (please complete the following information):
Additional context
I think it might be caused by how the time_after_hit is handled:
For all entities it is set to time_after_hit (if set and applicable) or 2400 ticks = 120 seconds.
HealthIndicators/common/src/main/java/io/github/adytech99/healthindicators/RenderTracker.java
Line 98 in 8aea0c6
And on each tick, all entities are looped and eventually they get removed from the renderer:
HealthIndicators/common/src/main/java/io/github/adytech99/healthindicators/RenderTracker.java
Lines 72 to 81 in 8aea0c6
I guess it is to prevent piling up too many UUIDs. But there should be a better way to clean them up, without flicker.