Skip to content

Commit

Permalink
fix: 修复1.12不显示生命值的bug
Browse files Browse the repository at this point in the history
调整生命条隐藏距离
  • Loading branch information
SuperSkidder committed Jul 5, 2024
1 parent 16b5b81 commit 5840dda
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import top.fpsmaster.FPSMaster;
import top.fpsmaster.features.impl.utility.LevelTag;
import top.fpsmaster.interfaces.ProviderManager;
import top.fpsmaster.modules.client.PlayerManager;
import top.fpsmaster.features.impl.optimizes.CheckEntity;
import top.fpsmaster.features.impl.optimizes.Performance;
Expand Down Expand Up @@ -57,6 +59,38 @@ public void preRender(Entity entity, double x, double y, double z, float entityY
}
}

@Inject(method = "renderLivingLabel", at = @At("HEAD"), cancellable = true)
protected void renderLivingLabel(Entity entityIn, String str, double x, double y, double z, int maxDistance, CallbackInfo ci) {
if (LevelTag.health.getValue()) {
double d = entityIn.getDistanceSq(this.renderManager.renderViewEntity);
if (d < 100) {
float f = 1.6F;
float g = 0.016666668F * f;
GlStateManager.pushMatrix();
GlStateManager.translate((float) x + 0.0F, (float) y + entityIn.height + 0.5F, (float) z);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(-g, -g, g);
GlStateManager.disableLighting();
GlStateManager.depthMask(false);
GlStateManager.disableDepth();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
ProviderManager.guiIngameProvider.drawHealth(entityIn);
GlStateManager.disableTexture2D();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.popMatrix();
}
} else {
ci.cancel();
}
}


@Inject(method = "renderName",at = @At("HEAD"), cancellable = true)
public void ignore(Entity entity, double x, double y, double z, CallbackInfo ci){
if (Performance.using && Performance.ignoreStands.getValue() && entity instanceof EntityArmorStand) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void doRender(Entity entity, double x, double y, double z, float entityYa
protected void renderLivingLabel(Entity entityIn, String str, double x, double y, double z, int maxDistance, CallbackInfo ci) {
if (LevelTag.health.getValue()) {
double d = entityIn.getDistanceSqToEntity(this.renderManager.livingPlayer);
if (d < 20) {
if (d < 100) {
float f = 1.6F;
float g = 0.016666668F * f;
GlStateManager.pushMatrix();
Expand Down

0 comments on commit 5840dda

Please sign in to comment.