Начинающий
- Статус
- Оффлайн
- Регистрация
- 19 Янв 2024
- Сообщения
- 203
- Реакции
- 0
- Выберите загрузчик игры
- OptiFine
Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:
- бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
- маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
- приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
- обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.
Спасибо!
крч мне было нечем заняться и заскидил насралтам нотифки вроде красота так шо вот вам пасаны
SS - прикрепил
если че сами фиксите ошибки помогать не буду.
SS - прикрепил
Пожалуйста, авторизуйтесь для просмотра ссылки.
если че сами фиксите ошибки помогать не буду.
Код:
package newcode.fun.control.notif;
import com.mojang.blaze3d.matrix.MatrixStack;
import java.awt.Color;
import java.util.concurrent.CopyOnWriteArrayList;
import newcode.fun.utils.IMinecraft;
import newcode.fun.utils.anim.Animation;
import newcode.fun.utils.anim.Direction;
import newcode.fun.utils.anim.impl.DecelerateAnimation;
import newcode.fun.utils.font.Fonts;
import newcode.fun.utils.render.RenderUtils;
import newcode.fun.utils.render.RenderUtils.Render2D;
import newcode.fun.utils.render.animation.AnimationMath;
public class NotifManager {
private final CopyOnWriteArrayList<Notification> notifications = new CopyOnWriteArrayList();
public NotifManager() {
}
public void add(String text, String content, int time) {
this.notifications.add(new Notification(text, content, time));
}
public void draw(MatrixStack stack) {
int yOffset = 0;
for (Notification notification : this.notifications) {
if (System.currentTimeMillis() - notification.getTime() > (long)notification.time2 * 500L - 300L) {
notification.animation.setDirection(Direction.BACKWARDS);
} else {
notification.animation.setDirection(Direction.FORWARDS);
}
notification.alpha = (float)notification.animation.getOutput();
if (System.currentTimeMillis() - notification.getTime() > (long)notification.time2 * 350L) {
notification.yAnimation.setDirection(Direction.BACKWARDS);
} else {
notification.yAnimation.setDirection(Direction.FORWARDS);
}
if (notification.yAnimation.finished(Direction.BACKWARDS)) {
this.notifications.remove(notification);
} else {
float x = (float)IMinecraft.mc.getMainWindow().scaledWidth() / 1.85F;
float y = (float)IMinecraft.mc.getMainWindow().scaledHeight() / 1.95F;
notification.yAnimation.setEndPoint((double)yOffset);
notification.yAnimation.setDuration(200);
y -= (float)((double)notification.draw(stack) * notification.yAnimation.getOutput());
notification.setX(x);
notification.setY(AnimationMath.fast(notification.getY(), y, 25.0F));
--yOffset;
}
}
}
private class Notification {
private float x;
private float y;
private String text;
private String content;
private long time;
public Animation animation;
public Animation yAnimation;
float alpha;
int time2;
public Notification(String text, String content, int time) {
this.y = (float)(IMinecraft.mc.getMainWindow().scaledHeight() + 25);
this.time = System.currentTimeMillis();
this.animation = new DecelerateAnimation(500, (double)1.0F, Direction.FORWARDS);
this.yAnimation = new DecelerateAnimation(150, (double)1.0F, Direction.FORWARDS);
this.time2 = 3;
this.text = text;
this.content = content;
this.time2 = time;
}
public float draw(MatrixStack stack) {
float textWidth = Fonts.msSemiBold[12].getWidth(this.text) + 28.0F;
float centerX = this.x - textWidth / 2.0F;
Render2D.drawRoundedCorner(centerX - 53.0F, this.y + 15.0F, textWidth, 11.0F, 4.0F, (new Color(30, 30, 30, 210)).getRGB());
Render2D.drawRect(centerX - 36.1F, this.y + 18.0F, 0.5F, 5.5F, (new Color(200, 200, 200, 100)).getRGB());
// Определяем цвета
int defaultColor = RenderUtils.reAlphaInt(-1, (int)(255.0F * this.alpha));
int enabledColor = RenderUtils.reAlphaInt(new Color(50, 252, 50).getRGB(), (int)(255.0F * this.alpha));
int disabledColor = RenderUtils.reAlphaInt(new Color(246, 48, 48).getRGB(), (int)(255.0F * this.alpha));
// Разбиваем текст на части
String lowerText = this.text.toLowerCase();
float currentX = centerX - 31.0F;
if (lowerText.contains("enabled")) {
int index = lowerText.indexOf("enabled");
String beforeEnabled = this.text.substring(0, index);
String enabledPart = this.text.substring(index, index + "enabled".length());
String afterEnabled = this.text.substring(index + "enabled".length());
if (!beforeEnabled.isEmpty()) {
Fonts.msSemiBold[12].drawString(stack, beforeEnabled, (double)currentX, (double)(this.y + 19.0F), defaultColor);
currentX += Fonts.msSemiBold[12].getWidth(beforeEnabled);
}
Fonts.msSemiBold[12].drawString(stack, enabledPart, (double)currentX, (double)(this.y + 19.0F), enabledColor);
currentX += Fonts.msSemiBold[12].getWidth(enabledPart);
if (!afterEnabled.isEmpty()) {
Fonts.msSemiBold[12].drawString(stack, afterEnabled, (double)currentX, (double)(this.y + 19.0F), defaultColor);
}
} else if (lowerText.contains("disabled")) {
int index = lowerText.indexOf("disabled");
String beforeDisabled = this.text.substring(0, index);
String disabledPart = this.text.substring(index, index + "disabled".length());
String afterDisabled = this.text.substring(index + "disabled".length());
if (!beforeDisabled.isEmpty()) {
Fonts.msSemiBold[12].drawString(stack, beforeDisabled, (double)currentX, (double)(this.y + 19.0F), defaultColor);
currentX += Fonts.msSemiBold[12].getWidth(beforeDisabled);
}
Fonts.msSemiBold[12].drawString(stack, disabledPart, (double)currentX, (double)(this.y + 19.0F), disabledColor);
currentX += Fonts.msSemiBold[12].getWidth(disabledPart);
if (!afterDisabled.isEmpty()) {
Fonts.msSemiBold[12].drawString(stack, afterDisabled, (double)currentX, (double)(this.y + 19.0F), defaultColor);
}
} else {
Fonts.msSemiBold[12].drawString(stack, this.text, (double)(centerX - 31.0F), (double)(this.y + 19.0F), defaultColor);
}
// Отрисовка иконок с правильными цветами
if (lowerText.contains("enabled")) {
Fonts.nursultan[16].drawString(stack, "J", (double)(centerX - 48.0F), (double)(this.y + 20.0F), enabledColor);
} else if (lowerText.contains("disabled")) {
Fonts.nursultan[16].drawString(stack, "K", (double)(centerX - 48.0F), (double)(this.y + 20.0F), disabledColor);
}
if (this.text.contains("был забинжен на кнопку")) {
Fonts.nursultan[16].drawString(stack, "H", (double)(centerX - 48.0F), (double)(this.y + 20.0F), defaultColor);
}
return 12.0F;
}
public float getX() {
return this.x;
}
public float getY() {
return this.y;
}
public void setX(float x) {
this.x = x;
}
public void setY(float y) {
this.y = y;
}
public String getText() {
return this.text;
}
public String getContent() {
return this.content;
}
public long getTime() {
return this.time;
}
}
}