Skip to content

[Bug Report] Rendered hearts occasionally flicker #57

@sepulzera

Description

@sepulzera

Describe the bug
Every 120 seconds the rendered hearts will briefly flicker.

How To Reproduce
Steps to reproduce the behavior:

  1. Set "[x] Show for players" and "[x] Always show for players" and "Indicator Type: Hearts".
  2. Join a server with 2 players.
  3. 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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions