Skip to content

Always show mob nametags without crosshair + cache LevelHead tag scan - #48

Draft
dsnsgithub wants to merge 1 commit into
mainfrom
mob-nametags-without-crosshair
Draft

dsnsgithub wants to merge 1 commit into
mainfrom
mob-nametags-without-crosshair

Conversation

@dsnsgithub

Copy link
Copy Markdown
Owner

Summary

  • Add a new Always Show Entity Name Tags option (on by default, under Rendering → Name Tags). In vanilla 1.8.9, a mob's custom name tag only renders while it is under the crosshair; this makes named mobs always render it, matching newer versions. The hasCustomName() check is untouched so unnamed mobs stay tag-free, and players are unaffected (PlayerRenderer doesn't route through MobRenderer).
  • Cache the LevelHead tagsAbove scan per entity per tick (Int2ObjectOpenHashMap<double[]> keyed by network id). The scan iterates every loaded entity in a box, previously once per nametag per frame — the big FPS cost with LevelHead enabled on Hypixel. Cache entries are invalidated when entity.ticks or baseAbove changes and the map is cleared past 1024 entries.

Implementation notes

  • New MobRendererMixin uses @ModifyExpressionValue on the EntityRenderDispatcher.targetEntity GETFIELD inside MobRenderer.shouldRenderNameTag, returning the MobEntity itself when the option is enabled so the mob == targetEntity comparison passes.
  • Default profiles (default-profile.json and the pack override) both set the new option to "true".

- Add alwaysShowEntityNametags option (default on): fake the crosshair
  check in MobRenderer.shouldRenderNameTag so named mobs render their
  nametag without being targeted, matching newer versions. Unnamed mobs
  stay tag-free; players are unaffected.
- Cache the LevelHead tagsAbove entity scan per entity per tick in an
  Int2ObjectOpenHashMap to avoid iterating all loaded entities every
  frame.
@dsnsgithub
dsnsgithub force-pushed the mob-nametags-without-crosshair branch from bac793b to b86c6e7 Compare November 13, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant