aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranhgelus <anhgelus.morhtuuzh@proton.me>2024-08-23 13:42:56 +0000
committeranhgelus <anhgelus.morhtuuzh@proton.me>2024-08-23 13:42:56 +0000
commit7fd5caf38a9b3ef71d94d9085ee92b47c3c449e3 (patch)
treee9c822d0e4f57c52bdd0980e948570a1493c26d5
parent7f6043a230b83cff57126625cd8b19063c85a599 (diff)
feat(config): disable mixins according to config's packet
-rw-r--r--src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java3
-rw-r--r--src/client/java/world/anhgelus/molehunt/client/mixin/NoPlayerListHud.java2
-rw-r--r--src/client/java/world/anhgelus/molehunt/client/mixin/NoSkin.java12
3 files changed, 11 insertions, 6 deletions
diff --git a/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java b/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java
index 7996c49..3482abb 100644
--- a/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java
+++ b/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java
@@ -9,12 +9,13 @@ 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;
+import world.anhgelus.molehunt.client.MolehuntClient;
@Mixin(EntityRenderer.class)
public 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;
+ if (!(entity instanceof PlayerEntity) || MolehuntClient.showNameTags()) return;
ci.cancel();
}
} \ No newline at end of file
diff --git a/src/client/java/world/anhgelus/molehunt/client/mixin/NoPlayerListHud.java b/src/client/java/world/anhgelus/molehunt/client/mixin/NoPlayerListHud.java
index 8ef33fd..00308ea 100644
--- a/src/client/java/world/anhgelus/molehunt/client/mixin/NoPlayerListHud.java
+++ b/src/client/java/world/anhgelus/molehunt/client/mixin/NoPlayerListHud.java
@@ -5,11 +5,13 @@ 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;
+import world.anhgelus.molehunt.client.MolehuntClient;
@Mixin(PlayerListHud.class)
public class NoPlayerListHud {
@Inject(at = @At("HEAD"), method = "render", cancellable = true)
public void render(CallbackInfo ci) {
+ if (MolehuntClient.showTab()) return;
ci.cancel();
}
}
diff --git a/src/client/java/world/anhgelus/molehunt/client/mixin/NoSkin.java b/src/client/java/world/anhgelus/molehunt/client/mixin/NoSkin.java
index 425ded7..775d789 100644
--- a/src/client/java/world/anhgelus/molehunt/client/mixin/NoSkin.java
+++ b/src/client/java/world/anhgelus/molehunt/client/mixin/NoSkin.java
@@ -8,17 +8,19 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import world.anhgelus.molehunt.Molehunt;
+import world.anhgelus.molehunt.client.MolehuntClient;
@Mixin(AbstractClientPlayerEntity.class)
public class NoSkin {
@Inject(at = @At("HEAD"), method = "getSkinTextures", cancellable = true)
public void getSkin(CallbackInfoReturnable<SkinTextures> cir) {
+ if (MolehuntClient.showSkins()) return;
cir.setReturnValue(new SkinTextures(
- Identifier.of(Molehunt.MOD_ID, "textures/skin.png"),
- null,
- null,
- null,
- SkinTextures.Model.WIDE, true)
+ Identifier.of(Molehunt.MOD_ID, "textures/skin.png"),
+ null,
+ null,
+ null,
+ SkinTextures.Model.WIDE, true)
);
}
}