Skip to content

Commit

Permalink
fix: 修复隐身nametag可见的bug
Browse files Browse the repository at this point in the history
close #32
  • Loading branch information
SuperSkidder committed Aug 24, 2024
1 parent 3f3257f commit afdbc37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package top.fpsmaster.forge.mixin;

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
Expand All @@ -22,7 +24,10 @@ public abstract class MixinRenderLivingBase {
@Inject(method = "canRenderName(Lnet/minecraft/entity/EntityLivingBase;)Z", at = @At("HEAD"), cancellable = true)
public void tag(EntityLivingBase entity, CallbackInfoReturnable<Boolean> cir) {
if (LevelTag.using && LevelTag.showSelf.getValue()) {
cir.setReturnValue(true);
EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player;
boolean flag = !entity.isInvisibleToPlayer(entityplayersp);

cir.setReturnValue(flag);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package top.fpsmaster.forge.mixin;

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
Expand All @@ -22,7 +24,10 @@ public abstract class MixinRenderLivingBase {
@Inject(method = "canRenderName(Lnet/minecraft/entity/EntityLivingBase;)Z", at = @At("HEAD"), cancellable = true)
public void tag(EntityLivingBase entity, CallbackInfoReturnable<Boolean> cir) {
if (LevelTag.using && LevelTag.showSelf.getValue()) {
cir.setReturnValue(true);
EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;
boolean flag = !entity.isInvisibleToPlayer(entityplayersp);

cir.setReturnValue(flag);
}
}

Expand Down

0 comments on commit afdbc37

Please sign in to comment.