var mobDistance = 32;
var pos = player.position
var lookVec = player.lookVec
var target = player.lookVec.scale(mobDistance).add(pos);
var results = player.rayTrace(pos, target);
var hitPos = results[0];
var blockCoords = results[1];
var entityHit = results[2];
if( entityHit != null &&
entityHit.getClassType() != "Painting" &&
entityHit.getClassType() != "FallingSand" &&
entityHit.getClassType() != "Minecart" &&
entityHit.getClassType() != "Boat" )
{
if(entityHit.health > entityHit.maxHealth)
entityHit.maxHealth = entityHit.health;
HealthPcnt = entityHit.health/entityHit.maxHealth;
UIRect((ui.getWidth()/2)-(104),4,208,32,(0.0 + (1.0-HealthPcnt))*0.1,1.0*HealthPcnt*0.1,0.0,0.6)
UIRect((ui.getWidth()/2)-(100),18,200,14,0.0,0.0,0.0,0.5)
UIRect((ui.getWidth()/2)-(100),18,200*HealthPcnt,14,(0.0 + (1.0-HealthPcnt)),1.0*HealthPcnt,0.0,0.5);
DaString = Math.max(Math.round(100*HealthPcnt),0)+"%";
DaClass = entityHit.getClassType();
UILabel(DaClass,(ui.getWidth()/2)-(ui.getStringWidth(DaClass)/2),8)
UILabel(DaString,(ui.getWidth()/2)-(ui.getStringWidth(DaString)/2),21)
}
if ( entityHit == null)
{
UIRect((ui.getWidth()/2)-(104),4,208,32,(0.0 + (1.0-HealthPcnt))*0.1,1.0*HealthPcnt*0.1,0.0,0.6)
}