Skip to content

Commit

Permalink
Fixed NameTags Bots option making a confirmed bot's name tag disappea…
Browse files Browse the repository at this point in the history
…r instead of having the default tag when disabled. (CCBlueX#1306)
  • Loading branch information
mems01 authored Sep 10, 2023
1 parent f8750e3 commit b53914a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import net.ccbluex.liquidbounce.utils.render.RenderUtils.quickDrawRect
import net.ccbluex.liquidbounce.utils.render.RenderUtils.resetCaps
import net.ccbluex.liquidbounce.value.*
import net.minecraft.client.renderer.GlStateManager.*
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.potion.Potion
Expand Down Expand Up @@ -303,4 +304,9 @@ object NameTags : Module("NameTags", ModuleCategory.RENDER) {

return prefix + "§c " + (if (healthInInt) result.toInt() else decimalFormat.format(result)) + suffix
}

fun shouldRenderNameTags(entity: Entity) =
state && entity is EntityLivingBase && (ESP.state && ESP.renderNameTags || isSelected(entity, false) && (!isBot(
entity
) || bot))
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private <T extends EntityLivingBase> void injectChamsPost(T entity, double x, do

@Inject(method = "canRenderName(Lnet/minecraft/entity/EntityLivingBase;)Z", at = @At("HEAD"), cancellable = true)
private <T extends EntityLivingBase> void canRenderName(T entity, CallbackInfoReturnable<Boolean> callbackInfoReturnable) {
if (!ESP.INSTANCE.getRenderNameTags() || (NameTags.INSTANCE.getState() && EntityUtils.INSTANCE.isSelected(entity, false))) {
if (NameTags.INSTANCE.shouldRenderNameTags(entity)) {
callbackInfoReturnable.setReturnValue(false);
}
}
Expand Down

0 comments on commit b53914a

Please sign in to comment.