Начинающий
- Статус
- Оффлайн
- Регистрация
- 23 Июн 2023
- Сообщения
- 140
- Реакции
- 0
Java:
private final Dragging targetInfo = NovaCore.createDraggable(this, "TargetInfo", 20, 90);
private final Animation targetInfoAnimation = new DecelerateAnimation(300, 1);
private PlayerEntity target = null;
private float hpAnim = 0;
//wake up, filthy!
private void onRenderTargetInfo(MatrixStack matrixStack) {
float x = targetInfo.getX();
float y = targetInfo.getY();
targetInfo.setX(x);
targetInfo.setY(y);
target = getTarget(target);
if (target == null) return;
int firstColorStyle =
ColorUtils.setAlpha(ColorUtils.getStaticColorStyle(0), 255),
secondColorStyle = ColorUtils.setAlpha(ColorUtils.getStaticColorStyle(0),255),
firstColorA = ColorUtils.setAlpha(ColorUtils.getStaticColorStyle(90),255),
secondColorA = ColorUtils.setAlpha(ColorUtils.getStaticColorStyle(90),255);
float width = 100;
float height = 38;
int hp = (int) (ClientUtils.isConnectedToServer("reallyworld") ? getHealthFromScoreboard(target)[0] : target.getHealth());
float maxHp = target.getMaxHealth();
float healthAnimation = MathHelper.clamp(hp / maxHp, 0, 1);
hpAnim = ScaleUtils.lerp(hpAnim, healthAnimation, 10);
ScaleUtils.scaleStart(x + (width / 2f), y + (height / 2f), targetInfoAnimation.getOutput());
RenderUtils.Render2D.drawRound(x, y, width, height, 4, ColorUtils.rgba(20, 20, 20, 200));
RenderUtils.Render2D.drawRoundFace(x + 5, y +5, 28, 28,2, 1, (AbstractClientPlayerEntity) target);
RenderUtils.Render2D.drawGradientRound(x + 38, y + 18, (width - 43), 9, new Vector4f(3, 3, 3, 3), ColorUtils.rgba(10, 10, 10, 230), ColorUtils.rgba(10, 10, 10, 230), ColorUtils.rgba(10, 10, 10, 230), ColorUtils.rgba(10, 10, 10, 230));
RenderUtils.Render2D.drawGradientRound(x + 38, y + 18, (width - 43) * hpAnim, 9, new Vector4f(3, 3, 3, 3), firstColorStyle, secondColorStyle, firstColorA, secondColorA);
Fonts.sfMedium[16].drawScissorString(matrixStack,target.getName().getString(), x + 38, y + 10, -1, 24);
Fonts.sfMedium[16].drawString(matrixStack, " - "+ hp + "hp", x + 68.5f, y + 10, -1);
ScaleUtils.scaleEnd();
targetInfo.setWidth(width);
targetInfo.setHeight(height);
}
//я будто зомби ща