Скинул Notification и NotificationManager
Вот я случайно с хайдом отправил
Notification:
// Decompiled with: CFR 0.152
// Class Version: 17
package wtf.expensive.notification;
import com.mojang.blaze3d.matrix.MatrixStack;
import java.awt.Color;
import wtf.expensive.notification.NotificationManager;
import wtf.expensive.util.IMinecraft;
import wtf.expensive.util.animations.Animation;
import wtf.expensive.util.animations.Direction;
import wtf.expensive.util.animations.impl.DecelerateAnimation;
import wtf.expensive.util.font.Fonts;
import wtf.expensive.util.render.RenderUtil;
public class Notification {
public float x;
public float y;
public String text;
public String content;
public long time;
public Animation animation;
public Animation yAnimation;
public float alpha;
public int time2;
public final NotificationManager this$0;
public Notification(NotificationManager var1, String var2, String var3, int var4) {
this.this$0 = var1;
this.y = IMinecraft.mc.getMainWindow().scaledHeight() + 25;
this.time = System.currentTimeMillis();
this.animation = new DecelerateAnimation(500, 1.0, Direction.FORWARDS);
this.yAnimation = new DecelerateAnimation(150, 1.0, Direction.FORWARDS);
this.time2 = 3;
this.text = var2;
this.content = var3;
this.time2 = var4;
}
public float draw(MatrixStack var1) {
float var2 = Fonts.msSemiBold[12].getWidth(this.text) + 28.0f;
float var3 = this.x - var2 / 2.0f;
RenderUtil.Render2D.drawRoundedCorner(var3 - 53.0f, this.y + 15.0f, var2, 11.0f, 4.0f, new Color(30, 30, 30, 210).getRGB());
RenderUtil.Render2D.drawRect(var3 - 36.1f, this.y + 18.0f, 0.5f, 5.5f, new Color(200, 200, 200, 100).getRGB());
Fonts.msSemiBold[12].drawString(var1, this.text, (double)(var3 - 31.0f), (double)(this.y + 19.0f), RenderUtil.reAlphaInt(-1, (int)(255.0f * this.alpha)));
if (this.text.contains("Включен")) {
Fonts.nursultan[16].drawString(var1, "K", (double)(var3 - 48.0f), (double)(this.y + 20.0f), -1);
} else {
Fonts.nursultan[16].drawString(var1, "J", (double)(var3 - 48.0f), (double)(this.y + 20.0f), -1);
}
if (this.text.contains("был забинжен на кнопку")) {
Fonts.nursultan[16].drawString(var1, "H", (double)(var3 - 48.0f), (double)(this.y + 20.0f), -1);
}
return 12.0f;
}
public float getX() {
return this.x;
}
public float getY() {
return this.y;
}
public void setX(float var1) {
this.x = var1;
}
public void setY(float var1) {
this.y = var1;
}
public String getText() {
return this.text;
}
public String getContent() {
return this.content;
}
public long getTime() {
return this.time;
}
}
NotificationManager:
// Decompiled with: CFR 0.152
// Class Version: 17
package wtf.expensive.notification;
import com.mojang.blaze3d.matrix.MatrixStack;
import java.util.concurrent.CopyOnWriteArrayList;
import wtf.expensive.notification.Notification;
import wtf.expensive.util.IMinecraft;
import wtf.expensive.util.animations.Direction;
import wtf.expensive.util.render.animation.AnimationMath;
public class NotificationManager {
public final CopyOnWriteArrayList<Notification> notifications = new CopyOnWriteArrayList();
public void add(String var1, String var2, int var3) {
this.notifications.add(new Notification(this, var1, var2, var3));
}
public void draw(MatrixStack var1) {
int var2 = 0;
for (Notification var4 : this.notifications) {
if (System.currentTimeMillis() - var4.getTime() > (long)var4.time2 * 500L - 300L) {
var4.animation.setDirection(Direction.BACKWARDS);
} else {
var4.animation.setDirection(Direction.FORWARDS);
}
var4.alpha = (float)var4.animation.getOutput();
if (System.currentTimeMillis() - var4.getTime() > (long)var4.time2 * 350L) {
var4.yAnimation.setDirection(Direction.BACKWARDS);
} else {
var4.yAnimation.setDirection(Direction.FORWARDS);
}
if (var4.yAnimation.finished(Direction.BACKWARDS)) {
this.notifications.remove(var4);
continue;
}
float var5 = (float)IMinecraft.mc.getMainWindow().scaledWidth() / 1.85f;
float var6 = (float)IMinecraft.mc.getMainWindow().scaledHeight() / 1.95f;
var4.yAnimation.setEndPoint(var2);
var4.yAnimation.setDuration(200);
var4.setX(var5);
var4.setY(AnimationMath.fast(var4.getY(), var6 -= (float)((double)var4.draw(var1) * var4.yAnimation.getOutput()), 25.0f));
--var2;
}
}
}