Начинающий
- Статус
- Оффлайн
- Регистрация
- 15 Мар 2025
- Сообщения
- 4
- Реакции
- 0
напастил жоские кулдауны время показывает 0 секунд
Java:
[USER=1367676]@override[/USER]
public void render(EventDisplay eventDisplay) {
MatrixStack ms = eventDisplay.getMatrixStack();
float posX = dragging.getX();
float posY = dragging.getY();
float fontSize = 8;
float padding = 5;
int iconcolor = ColorUtils.rgb(190, 185, 255);
drawStyledRect(posX, posY, width, height, 4);
Scissor.push();
Scissor.setFromComponentCoordinates(posX, posY, width, height);
Fonts.sfui.drawText(ms, "Cooldowns", posX + 18, posY + 5.5f, ColorUtils.rgba(255, 255, 255, 255), fontSize);
posY += fontSize + padding * 2;
float maxWidth = Fonts.sfui.getWidth("Cooldowns", fontSize) + padding * 2;
float localHeight = fontSize + padding * 2;
posY += 3f;
for (Item item : Registry.ITEM) {
float cooldown = mc.player.getCooldownTracker().getCooldown(item, mc.getRenderPartialTicks());
if (cooldown > 0) {
String itemName = new ItemStack(item).getDisplayName().getString();
String cooldownText = String.format("%.1fs", cooldown * item.getUseDuration(new ItemStack(item)) / 20f);
float nameWidth = Fonts.sfui.getWidth(itemName, fontSize);
float cooldownWidth = Fonts.sfui.getWidth(cooldownText, fontSize);
float iconSize = 10;
float iconPadding = 2;
float totalWidth = nameWidth + cooldownWidth + padding * 3 + iconSize + iconPadding;
float rectHeight = fontSize + padding;
DisplayUtils.drawRoundedRect(
posX + 2,
posY - padding / 2 - 2,
width - 4,
rectHeight + 1,
2,
ColorUtils.rgba(255, 255, 255, 15)
);
drawItemIcon(new ItemStack(item), posX + padding, posY - 2, iconSize, iconSize);
Fonts.sfui.drawText(ms, itemName, posX + padding + iconSize + iconPadding * 2, posY - 1,
ColorUtils.rgba(255, 255, 255, 255), fontSize);
Fonts.sfui.drawText(ms, cooldownText, posX + width - padding - cooldownWidth, posY - 1,
ColorUtils.rgba(255, 255, 255, 255), fontSize);
if (totalWidth > maxWidth) {
maxWidth = totalWidth;
}
posY += (fontSize + padding + 2);
localHeight += (fontSize + padding + 2);
}
}
Scissor.pop();
width = Math.max(maxWidth, 85);
height = localHeight + 1.5f;
dragging.setWidth(width);
dragging.setHeight(height);
}