Hide Names - Java made Minecraft Mod
One mixin. Zero nametags. Infinite paranoia.
A Fabric mod for Minecraft 1.21 that removes player nametags - built with Java 21 and SpongePowered Mixin to make hide-and-seek actually playable.
Let's talk about a problem that really should not exist.
You start Minecraft with your friends. Someone suggests hide-and-seek. Everyone runs off. Sounds good, except there is still a floating white nametag above every player's head, visible through walls, across biomes, and from far too far away. Mojang decided players should always know where everyone is.
At that point, hide-and-seek is just seek.
So I made a mod that removes player nametags. That is all it does. The core logic is thirteen lines long.
What It Actually Does
Hide Names is a client-side Fabric mod for Minecraft 1.21 that removes player nametags from rendering. Compasses, maps, and other tracking tools still work. Only the floating text above player heads disappears. There are no config screens, no settings menus, and no long setup guide. You install it and the nametags are gone.
Thirteen Lines of Bytecode Surgery
Minecraft's rendering pipeline does not give you a simple setNametagVisible(false) option. Nametags are drawn deep inside EntityRenderer.renderLabelIfPresent(), which handles label rendering for every entity in the game. There is no event hook and no built-in toggle for this.
The mod uses SpongePowered Mixin, which lets you inject code directly into Minecraft's compiled classes at launch. The injection targets the first instruction in the label-rendering method. If the entity is a player, the method is cancelled before anything gets drawn.
Here is the whole core of it:
@Mixin(EntityRenderer.class)
public abstract class EntityRendererMixin {
@Inject(
method = "renderLabelIfPresent",
at = @At("HEAD"),
cancellable = true
)
private void hidePlayerNametags(
Entity entity, Text text, MatrixStack matrices,
VertexConsumerProvider vertexConsumers,
int light, float distance, CallbackInfo ci
) {
if (entity instanceof PlayerEntity) {
ci.cancel();
}
}
}
@Inject at HEAD means the hook runs before the original code starts. ci.cancel() stops the method completely, so there is no label calculation, no buffer write, and no draw call. Player nametags disappear, while mob labels and item names still render normally.
Why Mixin and Not an Override?
The other option would be to override the whole renderer class. That means shipping a full replacement, making your change, and hoping no other mod touches the same area. In practice, that becomes fragile very quickly.
Mixin is more precise. It changes only what is needed, works better with other mods, and does not require shipping a copied renderer implementation. The learning curve is steeper because you need to understand injection points, callback signatures, and the @At targeting system. For a mod this small, that is probably the hardest part. It is still the right approach if you want the mod to be maintainable and more compatible over time.
The Stack
| Runtime | Java 21 |
| Mod Loader | Fabric API 0.102.0 |
| Minecraft | 1.21 |
| Build | Gradle 8.14 + Fabric Loom |
| Injection | SpongePowered Mixin (bytecode-level) |
| Licence | MIT, open source |
Project Layout
Even for a small mod, structure still matters. One mixin today can become several later.
src/main/java/net/mc121/hide_names_fabric/
├── HideNamesFabric.java // Mod entrypoint & logger
├── client/
│ └── NametagHiderClientMod.java // Client initialiser
└── mixin/
└── EntityRendererMixin.java // The core injection
The mixin configuration lives in hide-names-fabric.mixins.json, which tells Fabric Loader which classes should be transformed at launch. The mod entrypoint registers with the Fabric lifecycle, and the client initialiser keeps client-specific setup separate in case the mod grows later.
The CI Pipeline
Every push and pull request triggers a GitHub Actions build on Ubuntu 24.04. That includes JDK 21 validation, Gradle wrapper verification, full compilation, and artifact capture. Nothing gets merged without a passing build.
What's Next
The mod works, but it is intentionally minimal right now. The roadmap includes command toggles for server operators, friend and team lists so certain players can still see each other, and ports for versions from 1.20 upward. Development is paused while I focus on .NET at university, but the codebase is open, documented, and MIT-licensed. I still read pull requests.
Read my Minecraft post updates and join my Patreon
If you want updates as soon as they happen, you can subscribe to my newsletter through the footer link on the site. I also created a dedicated issue thread, number 32, for project updates and discussion. I am serious about continuing Minecraft mod work.
I also recommend joining the free tier on my Patreon. Updates there are more detailed, arrive earlier, and are aimed directly at people following the project.