improve overlay
This commit is contained in:
parent
f1bca42611
commit
3396dd73b2
1 changed files with 10 additions and 0 deletions
|
@ -1175,6 +1175,8 @@ public class Client implements IThreadListener {
|
|||
String desc = null;
|
||||
String line1 = null;
|
||||
String line2 = null;
|
||||
int color = 0x000000;
|
||||
float bar = -1.0f;
|
||||
if((this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) || this.pointedLiquid != null) {
|
||||
BlockPos pos = this.pointedLiquid != null ? this.pointedLiquid : this.pointed.block;
|
||||
State state = this.world.getState(pos);
|
||||
|
@ -1192,6 +1194,10 @@ public class Client implements IThreadListener {
|
|||
desc = (entity instanceof EntityNPC npc ? (!npc.canCounter(this.player) ? Color.GREEN : (npc.canAttack(this.player) ? Color.RED : Color.BLUE)) : Color.LIGHT_GRAY) + entity.getCommandName();
|
||||
line1 = entity.getInfo(this.player);
|
||||
line2 = Color.CYAN + EntityRegistry.getEntityName(EntityRegistry.getEntityString(entity));
|
||||
if(entity instanceof EntityLiving living) {
|
||||
bar = (float)living.getHealth() / (float)living.getMaxHealth();
|
||||
color = living.getColor();
|
||||
}
|
||||
}
|
||||
if(desc != null) {
|
||||
Drawing.drawRectBorder(this.fbX / 2 - 180, 20, 360, 60, 0xff6f6f6f, 0xff000000, 0xffafafaf, 0xff4f4f4f);
|
||||
|
@ -1200,6 +1206,10 @@ public class Client implements IThreadListener {
|
|||
Drawing.drawTextCentered(line1, this.fbX / 2, 80 - 4 - Font.YGLYPH * 2 - 2, 0xffffffff);
|
||||
if(line2 != null)
|
||||
Drawing.drawTextCentered(line2, this.fbX / 2, 80 - 4 - Font.YGLYPH, 0xffffffff);
|
||||
if(bar >= 0.0f) {
|
||||
Drawing.drawRect(this.fbX / 2 - 140, 24 + Font.YGLYPH + 2, 280, 6, 0xff202020, 0xffcfcfcf, 0xff3f3f3f);
|
||||
Drawing.drawGradient(this.fbX / 2 - 140 + 1, 24 + Font.YGLYPH + 2 + 1, (int)(278.0f * bar), 4, color | 0xff000000, Util.mixColor(color | 0xff000000, 0xff000000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue