Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Часть функционала NotificationWidget | EvaWare V3

Начинающий
Начинающий
Статус
Онлайн
Регистрация
10 Июл 2025
Сообщения
30
Реакции
0
Выберите загрузчик игры
  1. Прочие моды
Решил чутка переделать тему killse

SS:
1768901650618.png
1768901655325.png


Создаём по пути sweetie/evaware/client/ui/widget/overlay файл NotificationWidget.java
NotificationWidget.java:
Expand Collapse Copy
package sweetie.evaware.client.ui.widget.overlay;
import lombok.Getter;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import sweetie.evaware.api.event.events.render.Render2DEvent;
import sweetie.evaware.api.utils.animation.*;
import sweetie.evaware.api.utils.render.RenderUtil;
import sweetie.evaware.api.utils.render.fonts.Fonts;
import sweetie.evaware.client.ui.widget.Widget;
import java.awt.Color;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
public class NotificationWidget extends Widget{
    @Getter private static NotificationWidget instance;
    private final List<Notification>notifications=new CopyOnWriteArrayList<>();
    private Notification tN;
    public NotificationWidget(){super(150f,50f);setInstance(this);setEnabled(true);}
    public static void setInstance(NotificationWidget i){instance=i;}
    @Override public String getName(){return "Notifications";}
    @Override public void render(Render2DEvent.Render2DEventData e){
        if(mc.player==null)return;
        if(mc.currentScreen instanceof ChatScreen){
            if(tN==null||!notifications.contains(tN)){tN=new Notification("Test Notification",NotificationType.INFO);tN.keep=true;notifications.add(tN);}
        }else if(tN!=null){tN.keep=false;tN=null;}
        MatrixStack ms=e.matrixStack();
        notifications.removeIf(Notification::rm);
        float x=getDraggable().getX(),y=getDraggable().getY(),h=scaled(11),gap=scaled(2),cy=y,mw=scaled(60);
        for(Notification n:notifications){
            n.a.update();
            if(n.ex&&n.a.getValue()<0.05)continue;
            float v=(float)n.a.getValue(),fs=scaled(6f),p=scaled(3f);
            int a=MathHelper.clamp((int)(240*v),0,255),ta=MathHelper.clamp((int)(255*v),5,255);
            float tw=Fonts.SF_MEDIUM.getWidth(n.text,fs),w=p*2+tw+scaled(4);
            if(w>mw)mw=w;n.w=w;
            float cx=x+w/2f,centY=cy+h/2f;
            ms.push();ms.translate(cx,centY,0);ms.scale(v,v,1f);ms.translate(-cx,-centY,0);
            RenderUtil.BLUR_RECT.draw(ms,x,cy,w,h,1,new Color(12,12,18,a));
            Color c=n.keep?Color.getHSBColor((System.currentTimeMillis()%2000)/2000f,0.7f,1f):n.type.c;
            RenderUtil.RECT.draw(ms,x,cy+h-1.5f,w*n.pct(),1.5f,0f,new Color(c.getRed(),c.getGreen(),c.getBlue(),ta));
            Fonts.SF_MEDIUM.drawText(ms,n.text,x+p,cy+h/2f-fs/2f+0.5f,fs,new Color(255,255,255,ta));
            ms.pop();cy+=(h+gap)*v;
        }
        getDraggable().setWidth(mw);getDraggable().setHeight(Math.max(20f,cy-y));
    }
    public static void notify(String m,NotificationType t){if(instance!=null)instance.notifications.add(new Notification(m,t));}
    @Override public void render(MatrixStack m){}
    private static class Notification{
        String text;NotificationType type;AnimationUtil a=new AnimationUtil();
        long s=System.currentTimeMillis(),m=2000;boolean ex,keep;float w;
        Notification(String t,NotificationType tp){text=t;type=tp;a.setValue(0);a.run(1.0,300,Easing.BACK_OUT);}
        float pct(){if(keep)return(float)(0.5f+0.5f*Math.sin(System.currentTimeMillis()/300.0));long e=System.currentTimeMillis()-s;return Math.max(0,Math.min(1,(float)(m-e)/m));}
        boolean rm(){if(keep)return false;if(!ex&&System.currentTimeMillis()-s>m){ex=true;a.run(0.0,300,Easing.SINE_IN);}return ex&&a.isFinished()&&a.getValue()<=0.05;}
    }
    public enum NotificationType{
        SUCCESS(new Color(80,255,140)),INFO(new Color(80,180,255)),WARNING(new Color(255,215,80)),ERROR(new Color(255,60,60));
        Color c;NotificationType(Color co){c=co;}
    }
}

После этого идём в файл Module (путь: sweetie/evaware/api/module/Module.java)
и после строчки ToggleSoundsModule.playToggle(newState); (у меня это 55 у вас может быть другая)
пишем :
NotificationWidget.notify(name + (enabled ? " enabled" : " disabled"),enabled ? NotificationWidget.NotificationType.SUCCESS : NotificationWidget.NotificationType.ERROR);

Потом в WidgetManager.java (путь: sweetie/evaware/client/ui/widget/WidgetManager.java)
добавляем в void load наши нотифки
new NotificationWidget()
 
Решил чутка переделать тему killse

SS:Посмотреть вложение 325207Посмотреть вложение 325208

Создаём по пути sweetie/evaware/client/ui/widget/overlay файл NotificationWidget.java
NotificationWidget.java:
Expand Collapse Copy
package sweetie.evaware.client.ui.widget.overlay;
import lombok.Getter;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import sweetie.evaware.api.event.events.render.Render2DEvent;
import sweetie.evaware.api.utils.animation.*;
import sweetie.evaware.api.utils.render.RenderUtil;
import sweetie.evaware.api.utils.render.fonts.Fonts;
import sweetie.evaware.client.ui.widget.Widget;
import java.awt.Color;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
public class NotificationWidget extends Widget{
    @Getter private static NotificationWidget instance;
    private final List<Notification>notifications=new CopyOnWriteArrayList<>();
    private Notification tN;
    public NotificationWidget(){super(150f,50f);setInstance(this);setEnabled(true);}
    public static void setInstance(NotificationWidget i){instance=i;}
    @Override public String getName(){return "Notifications";}
    @Override public void render(Render2DEvent.Render2DEventData e){
        if(mc.player==null)return;
        if(mc.currentScreen instanceof ChatScreen){
            if(tN==null||!notifications.contains(tN)){tN=new Notification("Test Notification",NotificationType.INFO);tN.keep=true;notifications.add(tN);}
        }else if(tN!=null){tN.keep=false;tN=null;}
        MatrixStack ms=e.matrixStack();
        notifications.removeIf(Notification::rm);
        float x=getDraggable().getX(),y=getDraggable().getY(),h=scaled(11),gap=scaled(2),cy=y,mw=scaled(60);
        for(Notification n:notifications){
            n.a.update();
            if(n.ex&&n.a.getValue()<0.05)continue;
            float v=(float)n.a.getValue(),fs=scaled(6f),p=scaled(3f);
            int a=MathHelper.clamp((int)(240*v),0,255),ta=MathHelper.clamp((int)(255*v),5,255);
            float tw=Fonts.SF_MEDIUM.getWidth(n.text,fs),w=p*2+tw+scaled(4);
            if(w>mw)mw=w;n.w=w;
            float cx=x+w/2f,centY=cy+h/2f;
            ms.push();ms.translate(cx,centY,0);ms.scale(v,v,1f);ms.translate(-cx,-centY,0);
            RenderUtil.BLUR_RECT.draw(ms,x,cy,w,h,1,new Color(12,12,18,a));
            Color c=n.keep?Color.getHSBColor((System.currentTimeMillis()%2000)/2000f,0.7f,1f):n.type.c;
            RenderUtil.RECT.draw(ms,x,cy+h-1.5f,w*n.pct(),1.5f,0f,new Color(c.getRed(),c.getGreen(),c.getBlue(),ta));
            Fonts.SF_MEDIUM.drawText(ms,n.text,x+p,cy+h/2f-fs/2f+0.5f,fs,new Color(255,255,255,ta));
            ms.pop();cy+=(h+gap)*v;
        }
        getDraggable().setWidth(mw);getDraggable().setHeight(Math.max(20f,cy-y));
    }
    public static void notify(String m,NotificationType t){if(instance!=null)instance.notifications.add(new Notification(m,t));}
    @Override public void render(MatrixStack m){}
    private static class Notification{
        String text;NotificationType type;AnimationUtil a=new AnimationUtil();
        long s=System.currentTimeMillis(),m=2000;boolean ex,keep;float w;
        Notification(String t,NotificationType tp){text=t;type=tp;a.setValue(0);a.run(1.0,300,Easing.BACK_OUT);}
        float pct(){if(keep)return(float)(0.5f+0.5f*Math.sin(System.currentTimeMillis()/300.0));long e=System.currentTimeMillis()-s;return Math.max(0,Math.min(1,(float)(m-e)/m));}
        boolean rm(){if(keep)return false;if(!ex&&System.currentTimeMillis()-s>m){ex=true;a.run(0.0,300,Easing.SINE_IN);}return ex&&a.isFinished()&&a.getValue()<=0.05;}
    }
    public enum NotificationType{
        SUCCESS(new Color(80,255,140)),INFO(new Color(80,180,255)),WARNING(new Color(255,215,80)),ERROR(new Color(255,60,60));
        Color c;NotificationType(Color co){c=co;}
    }
}

После этого идём в файл Module (путь: sweetie/evaware/api/module/Module.java)
и после строчки ToggleSoundsModule.playToggle(newState); (у меня это 55 у вас может быть другая)
пишем :
NotificationWidget.notify(name + (enabled ? " enabled" : " disabled"),enabled ? NotificationWidget.NotificationType.SUCCESS : NotificationWidget.NotificationType.ERROR);

Потом в WidgetManager.java (путь: sweetie/evaware/client/ui/widget/WidgetManager.java)
добавляем в void load наши нотифки
new NotificationWidget()
/up чел сделал норм гайд, еслли не нравиться дропните нейронке она вам доделает
 
Назад
Сверху Снизу