- Выберите загрузчик игры
- Vanilla
- OptiFine
Java:
DraggableTargetHud draggableTargetHud = (DraggableTargetHud) Interfaces.getInstance().
draggableStorage.getDraggableClass(DraggableTargetHud.class);
EntityLivingBase target = getTarget();
this.openAnimation = (float) AnimationMath.animation(this.openAnimation, target != null ? 1 : 0, (float) (2 * AnimationMath.deltaTime()));
this.animations[0].setDuration(300);
this.animations[0].setDirection(target != null ? Direction.FORWARDS : Direction.BACKWARDS);
if (this.animations[0].getOutput() == 0) {
target = null;
}
GL11.glPushMatrix();
if (target != null) {
float x = draggableTargetHud.getX();
float y = draggableTargetHud.getY();
String name = target.getName();
double hp = (target.getHealth() / target.getMaxHealth() * 100);
hp = MathUtils.clamp(hp, 0.0f, 100f);
double stateHealth = (target.getHealth() / target.getMaxHealth() * 70);
stateHealth = MathHelper.clamp(stateHealth, 0, 70);
this.animation = (float) MathUtils.interpolator(hp + target.getAbsorptionAmount(), this.animation, 0.05d);
this.healthValue = AnimationMath.qualityAnimation(this.healthValue, (float) stateHealth, (float) (7.5f * AnimationMath.deltaTime()));
long textDelay = (long) (System.currentTimeMillis() / 740);
GL11.glTranslated(x - 2, y - 2, 0);
GL11.glScaled(this.animations[0].getOutput(),1, 1);
GL11.glTranslated(-(x - 2), -(y - 2), 0);
this.animations[1].setDirection(stateHealth <= 40 ? Direction.FORWARDS : Direction.BACKWARDS);
this.animations[1].setDuration(400);
if (stateHealth <= 40)
{
GL11.glPushMatrix();
GL11.glTranslated(x - 30, y - 125, 0);
GL11.glScaled(this.animations[1].getOutput(), 1, 0);
GL11.glTranslated(-(x - 30), -(y - 125), 0);
RenderEngine.drawImage(texture, x - 30, y - 125, 100, 130, new Color(255,0,0,255));
GL11.glPopMatrix();
}
RoundedUtils.drawRound(x - 1.6f, y + 2.6f, 33f, 34.5f, 5, new Color(21,21,21,255));
RoundedUtils.drawRound(x + 100, y + 31.5f, 11, 11, 5, new Color(21,21,21,190));
RoundedUtils.drawRound(x + 40, y + 2.5f, mc.mntsb[14].getStringWidth(name) + 21, 9, 3, new Color(21,21,21,190));
RoundedUtils.drawRound(x + 40, y + 31.5f, mc.mntsb[13].getStringWidth(String.format("%.2f%%", this.animation)) + 2, 10, 3, new Color(21,21,21,190));
RoundedUtils.drawRound(x + 39, y + 15.2f, 72, 13, 0, new Color(41,41,41,255));
GL11.glPushMatrix();
GL11.glTranslated(x + 40, y + 16, 1);
GL11.glScalef(1.0f, 1.1f, 1.0f);
this.shaderBG.draw(0,0, 60, 60, healthValue, healthValue);
GL11.glPopMatrix();
mc.mntsb[14].drawStringWithShadow(name, x + 59, y + 5.5f, -1);
mc.mntsb[14].drawStringWithShadow(textDelay % 2 == 0 ? "(^_-)" : "(-_^)", x + 41, y + 5.5f, -1);
mc.mntsb[13].drawStringWithShadow(String.format("%.2f%%", this.animation), x + 41.5f,
y + 35.5f, 0xffffffff);
GL11.glPushMatrix();
GL11.glTranslated(x + 99.5f, y + 30f, 0);
GL11.glScaled(0.77, 0.77, 0.77);
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
GlStateManager.clear(256);
GlStateManager.enableDepth();
GlStateManager.disableAlpha();
mc.getRenderItem().zLevel = -150.0f;
RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(mc.player, target.getHeldItemOffhand(), 0, 0);
mc.getRenderItem().zLevel = 0.0f;
RenderHelper.disableStandardItemLighting();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(x + 99.5f, y + 30f, 0);
GL11.glScalef(1.0f, 1.0f, 1.0f);
RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemOverlays(mc.mntsb[10], target.getHeldItemOffhand(), -7, 8);
RenderHelper.disableStandardItemLighting();
GL11.glPopMatrix();
try {
StencilUtility.initStencilToWrite();
ShaderAdoption.RQ_SHADER.draw(x, y + 5, 30,30, 5, new Color(31,31,31,255));
StencilUtility.readStencilBuffer(1);
if (target instanceof EntityLiving) {
RenderEngine.drawImage(new ResourceLocation("client/images/EntityLivingImage.png"), x, y + 5, 30, 30, Color.WHITE);
} else {
RenderEngine.drawFace(x, y + 5, 8.0f, 8.0f, 8, 8, 30, 30, 64.0f, 64.0f, target);
}
StencilUtility.uninitStencilBuffer();
}catch (Exception e) {
e.printStackTrace();
}
}
GL11.glPopMatrix();
}
});
Последнее редактирование: