aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE (renamed from LICENSE.txt)2
-rw-r--r--src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java21
-rw-r--r--src/client/resources/molehunt.client.mixins.json3
-rw-r--r--src/main/resources/molehunt.mixins.json3
4 files changed, 25 insertions, 4 deletions
diff --git a/LICENSE.txt b/LICENSE
index f7c80a6..b474264 100644
--- a/LICENSE.txt
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2024
+Copyright (c) 2024 William Hergès
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
diff --git a/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java b/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java
new file mode 100644
index 0000000..d7795dd
--- /dev/null
+++ b/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java
@@ -0,0 +1,21 @@
+package world.anhgelus.molehunt.client.mixin;
+
+import net.minecraft.client.render.VertexConsumerProvider;
+import net.minecraft.client.render.entity.EntityRenderer;
+import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.PlayerEntity;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(EntityRenderer.class)
+public abstract class NoNametags<T extends Entity> {
+ @Inject(at = @At("HEAD"), method = "render", cancellable = true)
+ private void renderLabelOrNot(T entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
+ if (!(entity instanceof PlayerEntity)) return;
+
+ ci.cancel();
+ }
+} \ No newline at end of file
diff --git a/src/client/resources/molehunt.client.mixins.json b/src/client/resources/molehunt.client.mixins.json
index 149a39e..e6a9f8e 100644
--- a/src/client/resources/molehunt.client.mixins.json
+++ b/src/client/resources/molehunt.client.mixins.json
@@ -1,9 +1,10 @@
{
"required": true,
"minVersion": "0.8",
- "package": "world.anhgelus.molehunt.mixin.client",
+ "package": "world.anhgelus.molehunt.client.mixin",
"compatibilityLevel": "JAVA_21",
"client": [
+ "NoNametags"
],
"injectors": {
"defaultRequire": 1
diff --git a/src/main/resources/molehunt.mixins.json b/src/main/resources/molehunt.mixins.json
index 5b76af8..8acee9a 100644
--- a/src/main/resources/molehunt.mixins.json
+++ b/src/main/resources/molehunt.mixins.json
@@ -3,8 +3,7 @@
"minVersion": "0.8",
"package": "world.anhgelus.molehunt.mixin",
"compatibilityLevel": "JAVA_21",
- "mixins": [
- ],
+ "mixins": [],
"injectors": {
"defaultRequire": 1
}