Гайд Notifications | Expensive 3.1

Запастил с невернайгта, короче по пути: src/im/expensive/ui/ создаем класс NotificationManager, туда вставляем этот код:



Java:
Expand Collapse Copy
package fun.ellant.ui;

import com.mojang.blaze3d.matrix.MatrixStack;
import java.util.concurrent.CopyOnWriteArrayList;
import net.minecraft.util.ResourceLocation;
import fun.ellant.utils.animations.Animation;
import fun.ellant.utils.animations.Direction;
import fun.ellant.utils.animations.impl.EaseBackIn;
import fun.ellant.utils.animations.impl.EaseInOutQuad;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.font.Fonts;

public class NotificationManager {
    private final CopyOnWriteArrayList<Notification> notifications = new CopyOnWriteArrayList();
    private MathUtil AnimationMath;
    private ImageType imageType;
    boolean state;

    public void add(String text, String content, int time, ImageType imageType) {
        this.notifications.add(new Notification(text, content, time, imageType));
    }

    public void draw(MatrixStack stack) {
        int yOffset = 0;
        for (Notification notification : this.notifications) {
            if (System.currentTimeMillis() - notification.getTime() <= (long)notification.time2 * 1000L - 300L) {
                notification.yAnimation.setDirection(Direction.FORWARDS);
            }
            notification.alpha = (float)notification.animation.getOutput();
            if (System.currentTimeMillis() - notification.getTime() > (long)notification.time2 * 1000L) {
                notification.yAnimation.setDirection(Direction.BACKWARDS);
            }
            if (notification.yAnimation.finished(Direction.BACKWARDS)) {
                this.notifications.remove(notification);
                continue;
            }
            float x = (float)IMinecraft.mc.getMainWindow().scaledWidth() - (Fonts.sfMedium.getWidth(notification.getText(), 7.0f) + 8.0f) - 10.0f;
            float y = IMinecraft.mc.getMainWindow().scaledHeight() - 40;
            notification.yAnimation.setEndPoint(yOffset);
            notification.yAnimation.setDuration(500);
            notification.setX(x);
            notification.setY(MathUtil.fast(notification.getY(), y -= (float)((double)notification.draw(stack) * notification.yAnimation.getOutput() + 3.0), 15.0f));
            ++yOffset;
        }
    }

    private class Notification {
        private float x = 0.0f;
        private float y = IMinecraft.mc.getMainWindow().scaledHeight() + 24;
        private String text;
        private String content;
        private long time = System.currentTimeMillis();
        public Animation animation = new EaseInOutQuad(500, 1.0, Direction.FORWARDS);
        public Animation yAnimation = new EaseBackIn(500, 1.0, 1.0f);
        private ImageType imageType;
        float alpha;
        int time2 = 3;
        private boolean isState;
        private boolean state;

        public Notification(String text, String content, int time, ImageType imageType) {
            this.text = text;
            this.content = content;
            this.time2 = time;
            this.imageType = imageType;
        }

        public float draw(MatrixStack stack) {
            float width = Fonts.sfMedium.getWidth(this.text, 7.0f) + 8.0f;
            DisplayUtils.drawRoundedRect(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3.0f, ColorUtils.rgb(23, 22, 22));
            DisplayUtils.drawShadow(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3, ColorUtils.rgb(23, 22, 22));
            if (this.imageType == ImageType.FIRST_PHOTO) {
                ResourceLocation key = new ResourceLocation("expensive/images/hud/notify.png");
                DisplayUtils.drawImage(key, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(255, 0, 0));
            } else {
                ResourceLocation key1 = new ResourceLocation("expensive/images/hud/notify2.png");
                DisplayUtils.drawImage(key1, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(0, 255, 0));
            }
            Fonts.montserrat.drawText(stack, this.text, this.x - 407.0f + 50.0f, this.y - 22.0f, -1, 7.0f, 0.05f);
            int enabledColor = ColorUtils.rgba(0, 255, 0, 255);
            int disabledColor = ColorUtils.rgba(255, 0, 0, 255);
            int contentColor = this.state ? enabledColor : disabledColor;
            Fonts.sfMedium.drawText(stack, this.content, this.x, this.y, ColorUtils.rgb(0, 255, 0), 4.0f, 0.05f);
            return 24.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;
        }
    }

    public static enum ImageType {
        FIRST_PHOTO,
        SECOND_PHOTO;

    }
}

UPDATEEEEEEE


Забыл сказать тоже важное, то что вы должны сделать

Переходим в im/expensive/ui/display/impl и тут создаём NotificationsRenderer, сюда вставляем:


Java:
Expand Collapse Copy
/*
* Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
*/
package fun.ellant.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.StringTextComponent;
import fun.ellant.Ellant;
import fun.ellant.events.EventDisplay;
import fun.ellant.functions.api.Function;
import fun.ellant.functions.api.FunctionRegistry;
import fun.ellant.ui.display.ElementRenderer;
import fun.ellant.ui.styles.Style;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.Scissor;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.utils.text.GradientUtil;

public class NotificationsRenderer
        implements ElementRenderer {
    private final FunctionRegistry functionRegistry;
    private float width;
    private float height;

    public NotificationsRenderer() {
        this.functionRegistry = Ellant.getInstance().getFunctionRegistry();
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();
        float screenWidth = Minecraft.getInstance().getMainWindow().getScaledWidth();
        float screenHeight = Minecraft.getInstance().getMainWindow().getScaledHeight();
        float posX = screenWidth - this.width - 5.0f;
        float posY = screenHeight - this.height - 5.0f;
        float fontSize = 6.5f;
        float padding = 5.0f;
        StringTextComponent title = (StringTextComponent) GradientUtil.white("Функции");
        Style style = Ellant.getInstance().getStyleManager().getCurrentStyle();
        DisplayUtils.drawShadow(posX, posY, this.width, this.height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
        this.drawStyledRect(posX, posY, this.width, this.height, 4.0f);
        Scissor.push();
        Scissor.setFromComponentCoordinates(posX, posY, this.width, this.height);
        Fonts.sfui.drawCenteredText(ms, title, posX + this.width / 2.0f, posY + padding + 0.5f, fontSize);
        posY += fontSize + padding * 2.0f;
        float maxWidth = Fonts.sfMedium.getWidth(title, fontSize) + padding * 2.0f;
        float localHeight = fontSize + padding * 2.0f;
        for (Function function : this.functionRegistry.getFunctions()) {
            String functionName = function.getName() + " " + (function.isState() ? "включено" : "выключено");
            float nameWidth = Fonts.sfMedium.getWidth(functionName, fontSize);
            Fonts.sfMedium.drawText(ms, functionName, posX + padding, posY, ColorUtils.rgba(210, 210, 210, 255), fontSize);
            if (nameWidth + padding * 2.0f > maxWidth) {
                maxWidth = nameWidth + padding * 2.0f;
            }
            posY += fontSize + padding;
            localHeight += fontSize + padding;
        }
        Scissor.unset();
        Scissor.pop();
        this.width = Math.max(maxWidth, 80.0f);
        this.height = localHeight + 2.5f;
    }

    private void drawStyledRect(float x, float y, float width, float height, float radius) {
        DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1.0f, height + 1.0f, radius + 0.5f, ColorUtils.getColor(0));
        DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, 255));
    }

    public NotificationsRenderer(FunctionRegistry functionRegistry) {
        this.functionRegistry = functionRegistry;
    }
}


Если вы не рукожоп и умеете менять импорты через ctrl + h то можно переходить и к 3 этапу.



Переходим по такому пути: src/im/expensive/functions/api/, так так, если вы перешли по такому пути вы должны создать класс NaksonPaster, переносим этот код в класс





Java:
Expand Collapse Copy
package fun.ellant.functions.api;



import fun.ellant.ui.NotificationManager;



public class NaksonPaster {

    public static NotificationManager NOTIFICATION_MANAGER;

}



После этого мы переходим в класс Expensive.java, который находится по такому пути: src/im/expensive/ , после строки tpsCalc = new TPSCalc(); вставляем этот код:
Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER = new NotificationManager();



Фуух, вы сделали 50% от всего этого. Теперь надо парейти в класс Function.java, который находится по пути: src/im/expensive/functions/api/, после строки



public final void toggle() {

if (Function.mc.player == null || Function.mc.world == null) {

return;

}



Вы должны написать

Java:
Expand Collapse Copy
        boolean bl = this.state = !this.state;

        if (!this.state) {

            this.onDisable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была выключена.", "", 1, NotificationManager.ImageType.FIRST_PHOTO);

        } else {

            this.onEnable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была включена.", "", 1, NotificationManager.ImageType.SECOND_PHOTO);

        }

        FunctionRegistry functionRegistry = Ellant.getInstance().getFunctionRegistry();

        ClientSounds clientSounds = functionRegistry.getClientSounds();

        if (clientSounds != null && clientSounds.isState()) {

            String fileName = clientSounds.getFileName(this.state);

            float volume = ((Float)clientSounds.volume.get()).floatValue();

            ClientUtil.playSound(fileName, volume, false);

        }

    }





После этого мы переходим в класс IngameGUI по пути: src/net/minecraft/client/gui/ и после строк: eventDisplay.setMatrixStack(matrixStack);

eventDisplay.setPartialTicks(partialTicks);



мы должны вставить это:

Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER.draw(matrixStack);
Да я пастер
Ответь в ЛС почты
 
1722492087799.png

1722492094127.png

ВОТ КАК ВЫГЛЯДИТ ПРОГРЕСС
 
Запастил с невернайгта, короче по пути: src/im/expensive/ui/ создаем класс NotificationManager, туда вставляем этот код:



Java:
Expand Collapse Copy
package fun.ellant.ui;

import com.mojang.blaze3d.matrix.MatrixStack;
import java.util.concurrent.CopyOnWriteArrayList;
import net.minecraft.util.ResourceLocation;
import fun.ellant.utils.animations.Animation;
import fun.ellant.utils.animations.Direction;
import fun.ellant.utils.animations.impl.EaseBackIn;
import fun.ellant.utils.animations.impl.EaseInOutQuad;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.font.Fonts;

public class NotificationManager {
    private final CopyOnWriteArrayList<Notification> notifications = new CopyOnWriteArrayList();
    private MathUtil AnimationMath;
    private ImageType imageType;
    boolean state;

    public void add(String text, String content, int time, ImageType imageType) {
        this.notifications.add(new Notification(text, content, time, imageType));
    }

    public void draw(MatrixStack stack) {
        int yOffset = 0;
        for (Notification notification : this.notifications) {
            if (System.currentTimeMillis() - notification.getTime() <= (long)notification.time2 * 1000L - 300L) {
                notification.yAnimation.setDirection(Direction.FORWARDS);
            }
            notification.alpha = (float)notification.animation.getOutput();
            if (System.currentTimeMillis() - notification.getTime() > (long)notification.time2 * 1000L) {
                notification.yAnimation.setDirection(Direction.BACKWARDS);
            }
            if (notification.yAnimation.finished(Direction.BACKWARDS)) {
                this.notifications.remove(notification);
                continue;
            }
            float x = (float)IMinecraft.mc.getMainWindow().scaledWidth() - (Fonts.sfMedium.getWidth(notification.getText(), 7.0f) + 8.0f) - 10.0f;
            float y = IMinecraft.mc.getMainWindow().scaledHeight() - 40;
            notification.yAnimation.setEndPoint(yOffset);
            notification.yAnimation.setDuration(500);
            notification.setX(x);
            notification.setY(MathUtil.fast(notification.getY(), y -= (float)((double)notification.draw(stack) * notification.yAnimation.getOutput() + 3.0), 15.0f));
            ++yOffset;
        }
    }

    private class Notification {
        private float x = 0.0f;
        private float y = IMinecraft.mc.getMainWindow().scaledHeight() + 24;
        private String text;
        private String content;
        private long time = System.currentTimeMillis();
        public Animation animation = new EaseInOutQuad(500, 1.0, Direction.FORWARDS);
        public Animation yAnimation = new EaseBackIn(500, 1.0, 1.0f);
        private ImageType imageType;
        float alpha;
        int time2 = 3;
        private boolean isState;
        private boolean state;

        public Notification(String text, String content, int time, ImageType imageType) {
            this.text = text;
            this.content = content;
            this.time2 = time;
            this.imageType = imageType;
        }

        public float draw(MatrixStack stack) {
            float width = Fonts.sfMedium.getWidth(this.text, 7.0f) + 8.0f;
            DisplayUtils.drawRoundedRect(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3.0f, ColorUtils.rgb(23, 22, 22));
            DisplayUtils.drawShadow(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3, ColorUtils.rgb(23, 22, 22));
            if (this.imageType == ImageType.FIRST_PHOTO) {
                ResourceLocation key = new ResourceLocation("expensive/images/hud/notify.png");
                DisplayUtils.drawImage(key, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(255, 0, 0));
            } else {
                ResourceLocation key1 = new ResourceLocation("expensive/images/hud/notify2.png");
                DisplayUtils.drawImage(key1, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(0, 255, 0));
            }
            Fonts.montserrat.drawText(stack, this.text, this.x - 407.0f + 50.0f, this.y - 22.0f, -1, 7.0f, 0.05f);
            int enabledColor = ColorUtils.rgba(0, 255, 0, 255);
            int disabledColor = ColorUtils.rgba(255, 0, 0, 255);
            int contentColor = this.state ? enabledColor : disabledColor;
            Fonts.sfMedium.drawText(stack, this.content, this.x, this.y, ColorUtils.rgb(0, 255, 0), 4.0f, 0.05f);
            return 24.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;
        }
    }

    public static enum ImageType {
        FIRST_PHOTO,
        SECOND_PHOTO;

    }
}

UPDATEEEEEEE


Забыл сказать тоже важное, то что вы должны сделать

Переходим в im/expensive/ui/display/impl и тут создаём NotificationsRenderer, сюда вставляем:


Java:
Expand Collapse Copy
/*
* Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
*/
package fun.ellant.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.StringTextComponent;
import fun.ellant.Ellant;
import fun.ellant.events.EventDisplay;
import fun.ellant.functions.api.Function;
import fun.ellant.functions.api.FunctionRegistry;
import fun.ellant.ui.display.ElementRenderer;
import fun.ellant.ui.styles.Style;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.Scissor;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.utils.text.GradientUtil;

public class NotificationsRenderer
        implements ElementRenderer {
    private final FunctionRegistry functionRegistry;
    private float width;
    private float height;

    public NotificationsRenderer() {
        this.functionRegistry = Ellant.getInstance().getFunctionRegistry();
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();
        float screenWidth = Minecraft.getInstance().getMainWindow().getScaledWidth();
        float screenHeight = Minecraft.getInstance().getMainWindow().getScaledHeight();
        float posX = screenWidth - this.width - 5.0f;
        float posY = screenHeight - this.height - 5.0f;
        float fontSize = 6.5f;
        float padding = 5.0f;
        StringTextComponent title = (StringTextComponent) GradientUtil.white("Функции");
        Style style = Ellant.getInstance().getStyleManager().getCurrentStyle();
        DisplayUtils.drawShadow(posX, posY, this.width, this.height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
        this.drawStyledRect(posX, posY, this.width, this.height, 4.0f);
        Scissor.push();
        Scissor.setFromComponentCoordinates(posX, posY, this.width, this.height);
        Fonts.sfui.drawCenteredText(ms, title, posX + this.width / 2.0f, posY + padding + 0.5f, fontSize);
        posY += fontSize + padding * 2.0f;
        float maxWidth = Fonts.sfMedium.getWidth(title, fontSize) + padding * 2.0f;
        float localHeight = fontSize + padding * 2.0f;
        for (Function function : this.functionRegistry.getFunctions()) {
            String functionName = function.getName() + " " + (function.isState() ? "включено" : "выключено");
            float nameWidth = Fonts.sfMedium.getWidth(functionName, fontSize);
            Fonts.sfMedium.drawText(ms, functionName, posX + padding, posY, ColorUtils.rgba(210, 210, 210, 255), fontSize);
            if (nameWidth + padding * 2.0f > maxWidth) {
                maxWidth = nameWidth + padding * 2.0f;
            }
            posY += fontSize + padding;
            localHeight += fontSize + padding;
        }
        Scissor.unset();
        Scissor.pop();
        this.width = Math.max(maxWidth, 80.0f);
        this.height = localHeight + 2.5f;
    }

    private void drawStyledRect(float x, float y, float width, float height, float radius) {
        DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1.0f, height + 1.0f, radius + 0.5f, ColorUtils.getColor(0));
        DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, 255));
    }

    public NotificationsRenderer(FunctionRegistry functionRegistry) {
        this.functionRegistry = functionRegistry;
    }
}


Если вы не рукожоп и умеете менять импорты через ctrl + h то можно переходить и к 3 этапу.



Переходим по такому пути: src/im/expensive/functions/api/, так так, если вы перешли по такому пути вы должны создать класс NaksonPaster, переносим этот код в класс





Java:
Expand Collapse Copy
package fun.ellant.functions.api;



import fun.ellant.ui.NotificationManager;



public class NaksonPaster {

    public static NotificationManager NOTIFICATION_MANAGER;

}



После этого мы переходим в класс Expensive.java, который находится по такому пути: src/im/expensive/ , после строки tpsCalc = new TPSCalc(); вставляем этот код:
Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER = new NotificationManager();



Фуух, вы сделали 50% от всего этого. Теперь надо парейти в класс Function.java, который находится по пути: src/im/expensive/functions/api/, после строки



public final void toggle() {

if (Function.mc.player == null || Function.mc.world == null) {

return;

}



Вы должны написать

Java:
Expand Collapse Copy
        boolean bl = this.state = !this.state;

        if (!this.state) {

            this.onDisable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была выключена.", "", 1, NotificationManager.ImageType.FIRST_PHOTO);

        } else {

            this.onEnable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была включена.", "", 1, NotificationManager.ImageType.SECOND_PHOTO);

        }

        FunctionRegistry functionRegistry = Ellant.getInstance().getFunctionRegistry();

        ClientSounds clientSounds = functionRegistry.getClientSounds();

        if (clientSounds != null && clientSounds.isState()) {

            String fileName = clientSounds.getFileName(this.state);

            float volume = ((Float)clientSounds.volume.get()).floatValue();

            ClientUtil.playSound(fileName, volume, false);

        }

    }





После этого мы переходим в класс IngameGUI по пути: src/net/minecraft/client/gui/ и после строк: eventDisplay.setMatrixStack(matrixStack);

eventDisplay.setPartialTicks(partialTicks);



мы должны вставить это:

Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER.draw(matrixStack);
Да я пастер
а
 
Последнее редактирование:
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
ну типо криво, но изи переделать, а сама функция имба, все ясно разложил +rep
можешь помочь спастить пожалуйста? ds manloxx1337
мдааа, я тебе всё тут детально обьяснил, что тебе тут не понятного?
я новичек не догоняю особенно твой ellant в котором ты все заренеймил вот и не понимаю
e
Запастил с невернайгта, короче по пути: src/im/expensive/ui/ создаем класс NotificationManager, туда вставляем этот код:



Java:
Expand Collapse Copy
package fun.ellant.ui;

import com.mojang.blaze3d.matrix.MatrixStack;
import java.util.concurrent.CopyOnWriteArrayList;
import net.minecraft.util.ResourceLocation;
import fun.ellant.utils.animations.Animation;
import fun.ellant.utils.animations.Direction;
import fun.ellant.utils.animations.impl.EaseBackIn;
import fun.ellant.utils.animations.impl.EaseInOutQuad;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.font.Fonts;

public class NotificationManager {
    private final CopyOnWriteArrayList<Notification> notifications = new CopyOnWriteArrayList();
    private MathUtil AnimationMath;
    private ImageType imageType;
    boolean state;

    public void add(String text, String content, int time, ImageType imageType) {
        this.notifications.add(new Notification(text, content, time, imageType));
    }

    public void draw(MatrixStack stack) {
        int yOffset = 0;
        for (Notification notification : this.notifications) {
            if (System.currentTimeMillis() - notification.getTime() <= (long)notification.time2 * 1000L - 300L) {
                notification.yAnimation.setDirection(Direction.FORWARDS);
            }
            notification.alpha = (float)notification.animation.getOutput();
            if (System.currentTimeMillis() - notification.getTime() > (long)notification.time2 * 1000L) {
                notification.yAnimation.setDirection(Direction.BACKWARDS);
            }
            if (notification.yAnimation.finished(Direction.BACKWARDS)) {
                this.notifications.remove(notification);
                continue;
            }
            float x = (float)IMinecraft.mc.getMainWindow().scaledWidth() - (Fonts.sfMedium.getWidth(notification.getText(), 7.0f) + 8.0f) - 10.0f;
            float y = IMinecraft.mc.getMainWindow().scaledHeight() - 40;
            notification.yAnimation.setEndPoint(yOffset);
            notification.yAnimation.setDuration(500);
            notification.setX(x);
            notification.setY(MathUtil.fast(notification.getY(), y -= (float)((double)notification.draw(stack) * notification.yAnimation.getOutput() + 3.0), 15.0f));
            ++yOffset;
        }
    }

    private class Notification {
        private float x = 0.0f;
        private float y = IMinecraft.mc.getMainWindow().scaledHeight() + 24;
        private String text;
        private String content;
        private long time = System.currentTimeMillis();
        public Animation animation = new EaseInOutQuad(500, 1.0, Direction.FORWARDS);
        public Animation yAnimation = new EaseBackIn(500, 1.0, 1.0f);
        private ImageType imageType;
        float alpha;
        int time2 = 3;
        private boolean isState;
        private boolean state;

        public Notification(String text, String content, int time, ImageType imageType) {
            this.text = text;
            this.content = content;
            this.time2 = time;
            this.imageType = imageType;
        }

        public float draw(MatrixStack stack) {
            float width = Fonts.sfMedium.getWidth(this.text, 7.0f) + 8.0f;
            DisplayUtils.drawRoundedRect(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3.0f, ColorUtils.rgb(23, 22, 22));
            DisplayUtils.drawShadow(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3, ColorUtils.rgb(23, 22, 22));
            if (this.imageType == ImageType.FIRST_PHOTO) {
                ResourceLocation key = new ResourceLocation("expensive/images/hud/notify.png");
                DisplayUtils.drawImage(key, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(255, 0, 0));
            } else {
                ResourceLocation key1 = new ResourceLocation("expensive/images/hud/notify2.png");
                DisplayUtils.drawImage(key1, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(0, 255, 0));
            }
            Fonts.montserrat.drawText(stack, this.text, this.x - 407.0f + 50.0f, this.y - 22.0f, -1, 7.0f, 0.05f);
            int enabledColor = ColorUtils.rgba(0, 255, 0, 255);
            int disabledColor = ColorUtils.rgba(255, 0, 0, 255);
            int contentColor = this.state ? enabledColor : disabledColor;
            Fonts.sfMedium.drawText(stack, this.content, this.x, this.y, ColorUtils.rgb(0, 255, 0), 4.0f, 0.05f);
            return 24.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;
        }
    }

    public static enum ImageType {
        FIRST_PHOTO,
        SECOND_PHOTO;

    }
}

UPDATEEEEEEE


Забыл сказать тоже важное, то что вы должны сделать

Переходим в im/expensive/ui/display/impl и тут создаём NotificationsRenderer, сюда вставляем:


Java:
Expand Collapse Copy
/*
* Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
*/
package fun.ellant.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.StringTextComponent;
import fun.ellant.Ellant;
import fun.ellant.events.EventDisplay;
import fun.ellant.functions.api.Function;
import fun.ellant.functions.api.FunctionRegistry;
import fun.ellant.ui.display.ElementRenderer;
import fun.ellant.ui.styles.Style;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.Scissor;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.utils.text.GradientUtil;

public class NotificationsRenderer
        implements ElementRenderer {
    private final FunctionRegistry functionRegistry;
    private float width;
    private float height;

    public NotificationsRenderer() {
        this.functionRegistry = Ellant.getInstance().getFunctionRegistry();
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();
        float screenWidth = Minecraft.getInstance().getMainWindow().getScaledWidth();
        float screenHeight = Minecraft.getInstance().getMainWindow().getScaledHeight();
        float posX = screenWidth - this.width - 5.0f;
        float posY = screenHeight - this.height - 5.0f;
        float fontSize = 6.5f;
        float padding = 5.0f;
        StringTextComponent title = (StringTextComponent) GradientUtil.white("Функции");
        Style style = Ellant.getInstance().getStyleManager().getCurrentStyle();
        DisplayUtils.drawShadow(posX, posY, this.width, this.height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
        this.drawStyledRect(posX, posY, this.width, this.height, 4.0f);
        Scissor.push();
        Scissor.setFromComponentCoordinates(posX, posY, this.width, this.height);
        Fonts.sfui.drawCenteredText(ms, title, posX + this.width / 2.0f, posY + padding + 0.5f, fontSize);
        posY += fontSize + padding * 2.0f;
        float maxWidth = Fonts.sfMedium.getWidth(title, fontSize) + padding * 2.0f;
        float localHeight = fontSize + padding * 2.0f;
        for (Function function : this.functionRegistry.getFunctions()) {
            String functionName = function.getName() + " " + (function.isState() ? "включено" : "выключено");
            float nameWidth = Fonts.sfMedium.getWidth(functionName, fontSize);
            Fonts.sfMedium.drawText(ms, functionName, posX + padding, posY, ColorUtils.rgba(210, 210, 210, 255), fontSize);
            if (nameWidth + padding * 2.0f > maxWidth) {
                maxWidth = nameWidth + padding * 2.0f;
            }
            posY += fontSize + padding;
            localHeight += fontSize + padding;
        }
        Scissor.unset();
        Scissor.pop();
        this.width = Math.max(maxWidth, 80.0f);
        this.height = localHeight + 2.5f;
    }

    private void drawStyledRect(float x, float y, float width, float height, float radius) {
        DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1.0f, height + 1.0f, radius + 0.5f, ColorUtils.getColor(0));
        DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, 255));
    }

    public NotificationsRenderer(FunctionRegistry functionRegistry) {
        this.functionRegistry = functionRegistry;
    }
}


Если вы не рукожоп и умеете менять импорты через ctrl + h то можно переходить и к 3 этапу.



Переходим по такому пути: src/im/expensive/functions/api/, так так, если вы перешли по такому пути вы должны создать класс NaksonPaster, переносим этот код в класс





Java:
Expand Collapse Copy
package fun.ellant.functions.api;



import fun.ellant.ui.NotificationManager;



public class NaksonPaster {

    public static NotificationManager NOTIFICATION_MANAGER;

}



После этого мы переходим в класс Expensive.java, который находится по такому пути: src/im/expensive/ , после строки tpsCalc = new TPSCalc(); вставляем этот код:
Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER = new NotificationManager();



Фуух, вы сделали 50% от всего этого. Теперь надо парейти в класс Function.java, который находится по пути: src/im/expensive/functions/api/, после строки



public final void toggle() {

if (Function.mc.player == null || Function.mc.world == null) {

return;

}



Вы должны написать

Java:
Expand Collapse Copy
        boolean bl = this.state = !this.state;

        if (!this.state) {

            this.onDisable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была выключена.", "", 1, NotificationManager.ImageType.FIRST_PHOTO);

        } else {

            this.onEnable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была включена.", "", 1, NotificationManager.ImageType.SECOND_PHOTO);

        }

        FunctionRegistry functionRegistry = Ellant.getInstance().getFunctionRegistry();

        ClientSounds clientSounds = functionRegistry.getClientSounds();

        if (clientSounds != null && clientSounds.isState()) {

            String fileName = clientSounds.getFileName(this.state);

            float volume = ((Float)clientSounds.volume.get()).floatValue();

            ClientUtil.playSound(fileName, volume, false);

        }

    }





После этого мы переходим в класс IngameGUI по пути: src/net/minecraft/client/gui/ и после строк: eventDisplay.setMatrixStack(matrixStack);

eventDisplay.setPartialTicks(partialTicks);



мы должны вставить это:

Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER.draw(matrixStack);
Да я пастер

у меня в Function нету
public final void toggle() {

if (Function.mc.player == null || Function.mc.world == null) {

return;

}
 
Последнее редактирование:
пасани сразу извиняюсь что мертвую тему поднял прост свой пасту чиленклиент делаю
крч чо за хуйня нотификаторы работают ток иза них терь функции не включаются тип нотиф прилетает чтофункция включена а на деле нихуя не происходит (функция пля не включаются ) я канеш могу с ноклипса спастет но лень пиздо
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
пасани сразу извиняюсь что мертвую тему поднял прост свой пасту чиленклиент делаю
крч чо за хуйня нотификаторы работают ток иза них терь функции не включаются тип нотиф прилетает чтофункция включена а на деле нихуя не происходит (функция пля не включаются ) я канеш могу с ноклипса спастет но лень пиздо
покажи в дс как ты их пастил (nakson_play)
 
Запастил с невернайгта, короче по пути: src/im/expensive/ui/ создаем класс NotificationManager, туда вставляем этот код:



Java:
Expand Collapse Copy
package fun.ellant.ui;

import com.mojang.blaze3d.matrix.MatrixStack;
import java.util.concurrent.CopyOnWriteArrayList;
import net.minecraft.util.ResourceLocation;
import fun.ellant.utils.animations.Animation;
import fun.ellant.utils.animations.Direction;
import fun.ellant.utils.animations.impl.EaseBackIn;
import fun.ellant.utils.animations.impl.EaseInOutQuad;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.font.Fonts;

public class NotificationManager {
    private final CopyOnWriteArrayList<Notification> notifications = new CopyOnWriteArrayList();
    private MathUtil AnimationMath;
    private ImageType imageType;
    boolean state;

    public void add(String text, String content, int time, ImageType imageType) {
        this.notifications.add(new Notification(text, content, time, imageType));
    }

    public void draw(MatrixStack stack) {
        int yOffset = 0;
        for (Notification notification : this.notifications) {
            if (System.currentTimeMillis() - notification.getTime() <= (long)notification.time2 * 1000L - 300L) {
                notification.yAnimation.setDirection(Direction.FORWARDS);
            }
            notification.alpha = (float)notification.animation.getOutput();
            if (System.currentTimeMillis() - notification.getTime() > (long)notification.time2 * 1000L) {
                notification.yAnimation.setDirection(Direction.BACKWARDS);
            }
            if (notification.yAnimation.finished(Direction.BACKWARDS)) {
                this.notifications.remove(notification);
                continue;
            }
            float x = (float)IMinecraft.mc.getMainWindow().scaledWidth() - (Fonts.sfMedium.getWidth(notification.getText(), 7.0f) + 8.0f) - 10.0f;
            float y = IMinecraft.mc.getMainWindow().scaledHeight() - 40;
            notification.yAnimation.setEndPoint(yOffset);
            notification.yAnimation.setDuration(500);
            notification.setX(x);
            notification.setY(MathUtil.fast(notification.getY(), y -= (float)((double)notification.draw(stack) * notification.yAnimation.getOutput() + 3.0), 15.0f));
            ++yOffset;
        }
    }

    private class Notification {
        private float x = 0.0f;
        private float y = IMinecraft.mc.getMainWindow().scaledHeight() + 24;
        private String text;
        private String content;
        private long time = System.currentTimeMillis();
        public Animation animation = new EaseInOutQuad(500, 1.0, Direction.FORWARDS);
        public Animation yAnimation = new EaseBackIn(500, 1.0, 1.0f);
        private ImageType imageType;
        float alpha;
        int time2 = 3;
        private boolean isState;
        private boolean state;

        public Notification(String text, String content, int time, ImageType imageType) {
            this.text = text;
            this.content = content;
            this.time2 = time;
            this.imageType = imageType;
        }

        public float draw(MatrixStack stack) {
            float width = Fonts.sfMedium.getWidth(this.text, 7.0f) + 8.0f;
            DisplayUtils.drawRoundedRect(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3.0f, ColorUtils.rgb(23, 22, 22));
            DisplayUtils.drawShadow(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3, ColorUtils.rgb(23, 22, 22));
            if (this.imageType == ImageType.FIRST_PHOTO) {
                ResourceLocation key = new ResourceLocation("expensive/images/hud/notify.png");
                DisplayUtils.drawImage(key, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(255, 0, 0));
            } else {
                ResourceLocation key1 = new ResourceLocation("expensive/images/hud/notify2.png");
                DisplayUtils.drawImage(key1, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(0, 255, 0));
            }
            Fonts.montserrat.drawText(stack, this.text, this.x - 407.0f + 50.0f, this.y - 22.0f, -1, 7.0f, 0.05f);
            int enabledColor = ColorUtils.rgba(0, 255, 0, 255);
            int disabledColor = ColorUtils.rgba(255, 0, 0, 255);
            int contentColor = this.state ? enabledColor : disabledColor;
            Fonts.sfMedium.drawText(stack, this.content, this.x, this.y, ColorUtils.rgb(0, 255, 0), 4.0f, 0.05f);
            return 24.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;
        }
    }

    public static enum ImageType {
        FIRST_PHOTO,
        SECOND_PHOTO;

    }
}

UPDATEEEEEEE


Забыл сказать тоже важное, то что вы должны сделать

Переходим в im/expensive/ui/display/impl и тут создаём NotificationsRenderer, сюда вставляем:


Java:
Expand Collapse Copy
/*
* Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
*/
package fun.ellant.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.StringTextComponent;
import fun.ellant.Ellant;
import fun.ellant.events.EventDisplay;
import fun.ellant.functions.api.Function;
import fun.ellant.functions.api.FunctionRegistry;
import fun.ellant.ui.display.ElementRenderer;
import fun.ellant.ui.styles.Style;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.Scissor;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.utils.text.GradientUtil;

public class NotificationsRenderer
        implements ElementRenderer {
    private final FunctionRegistry functionRegistry;
    private float width;
    private float height;

    public NotificationsRenderer() {
        this.functionRegistry = Ellant.getInstance().getFunctionRegistry();
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();
        float screenWidth = Minecraft.getInstance().getMainWindow().getScaledWidth();
        float screenHeight = Minecraft.getInstance().getMainWindow().getScaledHeight();
        float posX = screenWidth - this.width - 5.0f;
        float posY = screenHeight - this.height - 5.0f;
        float fontSize = 6.5f;
        float padding = 5.0f;
        StringTextComponent title = (StringTextComponent) GradientUtil.white("Функции");
        Style style = Ellant.getInstance().getStyleManager().getCurrentStyle();
        DisplayUtils.drawShadow(posX, posY, this.width, this.height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
        this.drawStyledRect(posX, posY, this.width, this.height, 4.0f);
        Scissor.push();
        Scissor.setFromComponentCoordinates(posX, posY, this.width, this.height);
        Fonts.sfui.drawCenteredText(ms, title, posX + this.width / 2.0f, posY + padding + 0.5f, fontSize);
        posY += fontSize + padding * 2.0f;
        float maxWidth = Fonts.sfMedium.getWidth(title, fontSize) + padding * 2.0f;
        float localHeight = fontSize + padding * 2.0f;
        for (Function function : this.functionRegistry.getFunctions()) {
            String functionName = function.getName() + " " + (function.isState() ? "включено" : "выключено");
            float nameWidth = Fonts.sfMedium.getWidth(functionName, fontSize);
            Fonts.sfMedium.drawText(ms, functionName, posX + padding, posY, ColorUtils.rgba(210, 210, 210, 255), fontSize);
            if (nameWidth + padding * 2.0f > maxWidth) {
                maxWidth = nameWidth + padding * 2.0f;
            }
            posY += fontSize + padding;
            localHeight += fontSize + padding;
        }
        Scissor.unset();
        Scissor.pop();
        this.width = Math.max(maxWidth, 80.0f);
        this.height = localHeight + 2.5f;
    }

    private void drawStyledRect(float x, float y, float width, float height, float radius) {
        DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1.0f, height + 1.0f, radius + 0.5f, ColorUtils.getColor(0));
        DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, 255));
    }

    public NotificationsRenderer(FunctionRegistry functionRegistry) {
        this.functionRegistry = functionRegistry;
    }
}


Если вы не рукожоп и умеете менять импорты через ctrl + h то можно переходить и к 3 этапу.



Переходим по такому пути: src/im/expensive/functions/api/, так так, если вы перешли по такому пути вы должны создать класс NaksonPaster, переносим этот код в класс





Java:
Expand Collapse Copy
package fun.ellant.functions.api;



import fun.ellant.ui.NotificationManager;



public class NaksonPaster {

    public static NotificationManager NOTIFICATION_MANAGER;

}



После этого мы переходим в класс Expensive.java, который находится по такому пути: src/im/expensive/ , после строки tpsCalc = new TPSCalc(); вставляем этот код:
Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER = new NotificationManager();



Фуух, вы сделали 50% от всего этого. Теперь надо парейти в класс Function.java, который находится по пути: src/im/expensive/functions/api/, после строки



public final void toggle() {

if (Function.mc.player == null || Function.mc.world == null) {

return;

}



Вы должны написать

Java:
Expand Collapse Copy
        boolean bl = this.state = !this.state;

        if (!this.state) {

            this.onDisable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была выключена.", "", 1, NotificationManager.ImageType.FIRST_PHOTO);

        } else {

            this.onEnable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была включена.", "", 1, NotificationManager.ImageType.SECOND_PHOTO);

        }

        FunctionRegistry functionRegistry = Ellant.getInstance().getFunctionRegistry();

        ClientSounds clientSounds = functionRegistry.getClientSounds();

        if (clientSounds != null && clientSounds.isState()) {

            String fileName = clientSounds.getFileName(this.state);

            float volume = ((Float)clientSounds.volume.get()).floatValue();

            ClientUtil.playSound(fileName, volume, false);

        }

    }





После этого мы переходим в класс IngameGUI по пути: src/net/minecraft/client/gui/ и после строк: eventDisplay.setMatrixStack(matrixStack);

eventDisplay.setPartialTicks(partialTicks);



мы должны вставить это:

Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER.draw(matrixStack);
Да я пастер
да как анимацию для пропадания сделать епта то ошибка то они пропадают
 
Запастил с невернайгта, короче по пути: src/im/expensive/ui/ создаем класс NotificationManager, туда вставляем этот код:



Java:
Expand Collapse Copy
package fun.ellant.ui;

import com.mojang.blaze3d.matrix.MatrixStack;
import java.util.concurrent.CopyOnWriteArrayList;
import net.minecraft.util.ResourceLocation;
import fun.ellant.utils.animations.Animation;
import fun.ellant.utils.animations.Direction;
import fun.ellant.utils.animations.impl.EaseBackIn;
import fun.ellant.utils.animations.impl.EaseInOutQuad;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.font.Fonts;

public class NotificationManager {
    private final CopyOnWriteArrayList<Notification> notifications = new CopyOnWriteArrayList();
    private MathUtil AnimationMath;
    private ImageType imageType;
    boolean state;

    public void add(String text, String content, int time, ImageType imageType) {
        this.notifications.add(new Notification(text, content, time, imageType));
    }

    public void draw(MatrixStack stack) {
        int yOffset = 0;
        for (Notification notification : this.notifications) {
            if (System.currentTimeMillis() - notification.getTime() <= (long)notification.time2 * 1000L - 300L) {
                notification.yAnimation.setDirection(Direction.FORWARDS);
            }
            notification.alpha = (float)notification.animation.getOutput();
            if (System.currentTimeMillis() - notification.getTime() > (long)notification.time2 * 1000L) {
                notification.yAnimation.setDirection(Direction.BACKWARDS);
            }
            if (notification.yAnimation.finished(Direction.BACKWARDS)) {
                this.notifications.remove(notification);
                continue;
            }
            float x = (float)IMinecraft.mc.getMainWindow().scaledWidth() - (Fonts.sfMedium.getWidth(notification.getText(), 7.0f) + 8.0f) - 10.0f;
            float y = IMinecraft.mc.getMainWindow().scaledHeight() - 40;
            notification.yAnimation.setEndPoint(yOffset);
            notification.yAnimation.setDuration(500);
            notification.setX(x);
            notification.setY(MathUtil.fast(notification.getY(), y -= (float)((double)notification.draw(stack) * notification.yAnimation.getOutput() + 3.0), 15.0f));
            ++yOffset;
        }
    }

    private class Notification {
        private float x = 0.0f;
        private float y = IMinecraft.mc.getMainWindow().scaledHeight() + 24;
        private String text;
        private String content;
        private long time = System.currentTimeMillis();
        public Animation animation = new EaseInOutQuad(500, 1.0, Direction.FORWARDS);
        public Animation yAnimation = new EaseBackIn(500, 1.0, 1.0f);
        private ImageType imageType;
        float alpha;
        int time2 = 3;
        private boolean isState;
        private boolean state;

        public Notification(String text, String content, int time, ImageType imageType) {
            this.text = text;
            this.content = content;
            this.time2 = time;
            this.imageType = imageType;
        }

        public float draw(MatrixStack stack) {
            float width = Fonts.sfMedium.getWidth(this.text, 7.0f) + 8.0f;
            DisplayUtils.drawRoundedRect(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3.0f, ColorUtils.rgb(23, 22, 22));
            DisplayUtils.drawShadow(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3, ColorUtils.rgb(23, 22, 22));
            if (this.imageType == ImageType.FIRST_PHOTO) {
                ResourceLocation key = new ResourceLocation("expensive/images/hud/notify.png");
                DisplayUtils.drawImage(key, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(255, 0, 0));
            } else {
                ResourceLocation key1 = new ResourceLocation("expensive/images/hud/notify2.png");
                DisplayUtils.drawImage(key1, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(0, 255, 0));
            }
            Fonts.montserrat.drawText(stack, this.text, this.x - 407.0f + 50.0f, this.y - 22.0f, -1, 7.0f, 0.05f);
            int enabledColor = ColorUtils.rgba(0, 255, 0, 255);
            int disabledColor = ColorUtils.rgba(255, 0, 0, 255);
            int contentColor = this.state ? enabledColor : disabledColor;
            Fonts.sfMedium.drawText(stack, this.content, this.x, this.y, ColorUtils.rgb(0, 255, 0), 4.0f, 0.05f);
            return 24.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;
        }
    }

    public static enum ImageType {
        FIRST_PHOTO,
        SECOND_PHOTO;

    }
}

UPDATEEEEEEE


Забыл сказать тоже важное, то что вы должны сделать

Переходим в im/expensive/ui/display/impl и тут создаём NotificationsRenderer, сюда вставляем:


Java:
Expand Collapse Copy
/*
* Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
*/
package fun.ellant.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.StringTextComponent;
import fun.ellant.Ellant;
import fun.ellant.events.EventDisplay;
import fun.ellant.functions.api.Function;
import fun.ellant.functions.api.FunctionRegistry;
import fun.ellant.ui.display.ElementRenderer;
import fun.ellant.ui.styles.Style;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.Scissor;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.utils.text.GradientUtil;

public class NotificationsRenderer
        implements ElementRenderer {
    private final FunctionRegistry functionRegistry;
    private float width;
    private float height;

    public NotificationsRenderer() {
        this.functionRegistry = Ellant.getInstance().getFunctionRegistry();
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();
        float screenWidth = Minecraft.getInstance().getMainWindow().getScaledWidth();
        float screenHeight = Minecraft.getInstance().getMainWindow().getScaledHeight();
        float posX = screenWidth - this.width - 5.0f;
        float posY = screenHeight - this.height - 5.0f;
        float fontSize = 6.5f;
        float padding = 5.0f;
        StringTextComponent title = (StringTextComponent) GradientUtil.white("Функции");
        Style style = Ellant.getInstance().getStyleManager().getCurrentStyle();
        DisplayUtils.drawShadow(posX, posY, this.width, this.height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
        this.drawStyledRect(posX, posY, this.width, this.height, 4.0f);
        Scissor.push();
        Scissor.setFromComponentCoordinates(posX, posY, this.width, this.height);
        Fonts.sfui.drawCenteredText(ms, title, posX + this.width / 2.0f, posY + padding + 0.5f, fontSize);
        posY += fontSize + padding * 2.0f;
        float maxWidth = Fonts.sfMedium.getWidth(title, fontSize) + padding * 2.0f;
        float localHeight = fontSize + padding * 2.0f;
        for (Function function : this.functionRegistry.getFunctions()) {
            String functionName = function.getName() + " " + (function.isState() ? "включено" : "выключено");
            float nameWidth = Fonts.sfMedium.getWidth(functionName, fontSize);
            Fonts.sfMedium.drawText(ms, functionName, posX + padding, posY, ColorUtils.rgba(210, 210, 210, 255), fontSize);
            if (nameWidth + padding * 2.0f > maxWidth) {
                maxWidth = nameWidth + padding * 2.0f;
            }
            posY += fontSize + padding;
            localHeight += fontSize + padding;
        }
        Scissor.unset();
        Scissor.pop();
        this.width = Math.max(maxWidth, 80.0f);
        this.height = localHeight + 2.5f;
    }

    private void drawStyledRect(float x, float y, float width, float height, float radius) {
        DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1.0f, height + 1.0f, radius + 0.5f, ColorUtils.getColor(0));
        DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, 255));
    }

    public NotificationsRenderer(FunctionRegistry functionRegistry) {
        this.functionRegistry = functionRegistry;
    }
}


Если вы не рукожоп и умеете менять импорты через ctrl + h то можно переходить и к 3 этапу.



Переходим по такому пути: src/im/expensive/functions/api/, так так, если вы перешли по такому пути вы должны создать класс NaksonPaster, переносим этот код в класс





Java:
Expand Collapse Copy
package fun.ellant.functions.api;



import fun.ellant.ui.NotificationManager;



public class NaksonPaster {

    public static NotificationManager NOTIFICATION_MANAGER;

}



После этого мы переходим в класс Expensive.java, который находится по такому пути: src/im/expensive/ , после строки tpsCalc = new TPSCalc(); вставляем этот код:
Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER = new NotificationManager();



Фуух, вы сделали 50% от всего этого. Теперь надо парейти в класс Function.java, который находится по пути: src/im/expensive/functions/api/, после строки



public final void toggle() {

if (Function.mc.player == null || Function.mc.world == null) {

return;

}



Вы должны написать

Java:
Expand Collapse Copy
        boolean bl = this.state = !this.state;

        if (!this.state) {

            this.onDisable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была выключена.", "", 1, NotificationManager.ImageType.FIRST_PHOTO);

        } else {

            this.onEnable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была включена.", "", 1, NotificationManager.ImageType.SECOND_PHOTO);

        }

        FunctionRegistry functionRegistry = Ellant.getInstance().getFunctionRegistry();

        ClientSounds clientSounds = functionRegistry.getClientSounds();

        if (clientSounds != null && clientSounds.isState()) {

            String fileName = clientSounds.getFileName(this.state);

            float volume = ((Float)clientSounds.volume.get()).floatValue();

            ClientUtil.playSound(fileName, volume, false);

        }

    }





После этого мы переходим в класс IngameGUI по пути: src/net/minecraft/client/gui/ и после строк: eventDisplay.setMatrixStack(matrixStack);

eventDisplay.setPartialTicks(partialTicks);



мы должны вставить это:

Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER.draw(matrixStack);
Да я пастер
Exception in thread "Thread-4" что за ошибка?
Exception in thread "Thread-4" что за ошибка?
починил
 

Вложения

дайте пнгшки пж
 
как сделать так чтобы уведомления были не черные а цвета клиента?
 
кто нибуть хелп в коде IngameGui проблема я не могу решить дс ert0516_08983
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Запастил с невернайгта, короче по пути: src/im/expensive/ui/ создаем класс NotificationManager, туда вставляем этот код:



Java:
Expand Collapse Copy
package fun.ellant.ui;

import com.mojang.blaze3d.matrix.MatrixStack;
import java.util.concurrent.CopyOnWriteArrayList;
import net.minecraft.util.ResourceLocation;
import fun.ellant.utils.animations.Animation;
import fun.ellant.utils.animations.Direction;
import fun.ellant.utils.animations.impl.EaseBackIn;
import fun.ellant.utils.animations.impl.EaseInOutQuad;
import fun.ellant.utils.client.IMinecraft;
import fun.ellant.utils.math.MathUtil;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.font.Fonts;

public class NotificationManager {
    private final CopyOnWriteArrayList<Notification> notifications = new CopyOnWriteArrayList();
    private MathUtil AnimationMath;
    private ImageType imageType;
    boolean state;

    public void add(String text, String content, int time, ImageType imageType) {
        this.notifications.add(new Notification(text, content, time, imageType));
    }

    public void draw(MatrixStack stack) {
        int yOffset = 0;
        for (Notification notification : this.notifications) {
            if (System.currentTimeMillis() - notification.getTime() <= (long)notification.time2 * 1000L - 300L) {
                notification.yAnimation.setDirection(Direction.FORWARDS);
            }
            notification.alpha = (float)notification.animation.getOutput();
            if (System.currentTimeMillis() - notification.getTime() > (long)notification.time2 * 1000L) {
                notification.yAnimation.setDirection(Direction.BACKWARDS);
            }
            if (notification.yAnimation.finished(Direction.BACKWARDS)) {
                this.notifications.remove(notification);
                continue;
            }
            float x = (float)IMinecraft.mc.getMainWindow().scaledWidth() - (Fonts.sfMedium.getWidth(notification.getText(), 7.0f) + 8.0f) - 10.0f;
            float y = IMinecraft.mc.getMainWindow().scaledHeight() - 40;
            notification.yAnimation.setEndPoint(yOffset);
            notification.yAnimation.setDuration(500);
            notification.setX(x);
            notification.setY(MathUtil.fast(notification.getY(), y -= (float)((double)notification.draw(stack) * notification.yAnimation.getOutput() + 3.0), 15.0f));
            ++yOffset;
        }
    }

    private class Notification {
        private float x = 0.0f;
        private float y = IMinecraft.mc.getMainWindow().scaledHeight() + 24;
        private String text;
        private String content;
        private long time = System.currentTimeMillis();
        public Animation animation = new EaseInOutQuad(500, 1.0, Direction.FORWARDS);
        public Animation yAnimation = new EaseBackIn(500, 1.0, 1.0f);
        private ImageType imageType;
        float alpha;
        int time2 = 3;
        private boolean isState;
        private boolean state;

        public Notification(String text, String content, int time, ImageType imageType) {
            this.text = text;
            this.content = content;
            this.time2 = time;
            this.imageType = imageType;
        }

        public float draw(MatrixStack stack) {
            float width = Fonts.sfMedium.getWidth(this.text, 7.0f) + 8.0f;
            DisplayUtils.drawRoundedRect(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3.0f, ColorUtils.rgb(23, 22, 22));
            DisplayUtils.drawShadow(this.x - 427.0f + 50.0f, this.y - 25.0f, width + 27.0f, 13.0f, 3, ColorUtils.rgb(23, 22, 22));
            if (this.imageType == ImageType.FIRST_PHOTO) {
                ResourceLocation key = new ResourceLocation("expensive/images/hud/notify.png");
                DisplayUtils.drawImage(key, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(255, 0, 0));
            } else {
                ResourceLocation key1 = new ResourceLocation("expensive/images/hud/notify2.png");
                DisplayUtils.drawImage(key1, this.x - 424.0f + 50.0f, this.y - 26.5f, 16.0f, 16.0f, ColorUtils.rgb(0, 255, 0));
            }
            Fonts.montserrat.drawText(stack, this.text, this.x - 407.0f + 50.0f, this.y - 22.0f, -1, 7.0f, 0.05f);
            int enabledColor = ColorUtils.rgba(0, 255, 0, 255);
            int disabledColor = ColorUtils.rgba(255, 0, 0, 255);
            int contentColor = this.state ? enabledColor : disabledColor;
            Fonts.sfMedium.drawText(stack, this.content, this.x, this.y, ColorUtils.rgb(0, 255, 0), 4.0f, 0.05f);
            return 24.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;
        }
    }

    public static enum ImageType {
        FIRST_PHOTO,
        SECOND_PHOTO;

    }
}

UPDATEEEEEEE


Забыл сказать тоже важное, то что вы должны сделать

Переходим в im/expensive/ui/display/impl и тут создаём NotificationsRenderer, сюда вставляем:


Java:
Expand Collapse Copy
/*
* Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
*/
package fun.ellant.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.StringTextComponent;
import fun.ellant.Ellant;
import fun.ellant.events.EventDisplay;
import fun.ellant.functions.api.Function;
import fun.ellant.functions.api.FunctionRegistry;
import fun.ellant.ui.display.ElementRenderer;
import fun.ellant.ui.styles.Style;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.Scissor;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.utils.text.GradientUtil;

public class NotificationsRenderer
        implements ElementRenderer {
    private final FunctionRegistry functionRegistry;
    private float width;
    private float height;

    public NotificationsRenderer() {
        this.functionRegistry = Ellant.getInstance().getFunctionRegistry();
    }

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();
        float screenWidth = Minecraft.getInstance().getMainWindow().getScaledWidth();
        float screenHeight = Minecraft.getInstance().getMainWindow().getScaledHeight();
        float posX = screenWidth - this.width - 5.0f;
        float posY = screenHeight - this.height - 5.0f;
        float fontSize = 6.5f;
        float padding = 5.0f;
        StringTextComponent title = (StringTextComponent) GradientUtil.white("Функции");
        Style style = Ellant.getInstance().getStyleManager().getCurrentStyle();
        DisplayUtils.drawShadow(posX, posY, this.width, this.height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
        this.drawStyledRect(posX, posY, this.width, this.height, 4.0f);
        Scissor.push();
        Scissor.setFromComponentCoordinates(posX, posY, this.width, this.height);
        Fonts.sfui.drawCenteredText(ms, title, posX + this.width / 2.0f, posY + padding + 0.5f, fontSize);
        posY += fontSize + padding * 2.0f;
        float maxWidth = Fonts.sfMedium.getWidth(title, fontSize) + padding * 2.0f;
        float localHeight = fontSize + padding * 2.0f;
        for (Function function : this.functionRegistry.getFunctions()) {
            String functionName = function.getName() + " " + (function.isState() ? "включено" : "выключено");
            float nameWidth = Fonts.sfMedium.getWidth(functionName, fontSize);
            Fonts.sfMedium.drawText(ms, functionName, posX + padding, posY, ColorUtils.rgba(210, 210, 210, 255), fontSize);
            if (nameWidth + padding * 2.0f > maxWidth) {
                maxWidth = nameWidth + padding * 2.0f;
            }
            posY += fontSize + padding;
            localHeight += fontSize + padding;
        }
        Scissor.unset();
        Scissor.pop();
        this.width = Math.max(maxWidth, 80.0f);
        this.height = localHeight + 2.5f;
    }

    private void drawStyledRect(float x, float y, float width, float height, float radius) {
        DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1.0f, height + 1.0f, radius + 0.5f, ColorUtils.getColor(0));
        DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, 255));
    }

    public NotificationsRenderer(FunctionRegistry functionRegistry) {
        this.functionRegistry = functionRegistry;
    }
}


Если вы не рукожоп и умеете менять импорты через ctrl + h то можно переходить и к 3 этапу.



Переходим по такому пути: src/im/expensive/functions/api/, так так, если вы перешли по такому пути вы должны создать класс NaksonPaster, переносим этот код в класс





Java:
Expand Collapse Copy
package fun.ellant.functions.api;



import fun.ellant.ui.NotificationManager;



public class NaksonPaster {

    public static NotificationManager NOTIFICATION_MANAGER;

}



После этого мы переходим в класс Expensive.java, который находится по такому пути: src/im/expensive/ , после строки tpsCalc = new TPSCalc(); вставляем этот код:
Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER = new NotificationManager();



Фуух, вы сделали 50% от всего этого. Теперь надо парейти в класс Function.java, который находится по пути: src/im/expensive/functions/api/, после строки



public final void toggle() {

if (Function.mc.player == null || Function.mc.world == null) {

return;

}



Вы должны написать

Java:
Expand Collapse Copy
        boolean bl = this.state = !this.state;

        if (!this.state) {

            this.onDisable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была выключена.", "", 1, NotificationManager.ImageType.FIRST_PHOTO);

        } else {

            this.onEnable();

            NaksonPaster.NOTIFICATION_MANAGER.add("Функция " + this.name + " была включена.", "", 1, NotificationManager.ImageType.SECOND_PHOTO);

        }

        FunctionRegistry functionRegistry = Ellant.getInstance().getFunctionRegistry();

        ClientSounds clientSounds = functionRegistry.getClientSounds();

        if (clientSounds != null && clientSounds.isState()) {

            String fileName = clientSounds.getFileName(this.state);

            float volume = ((Float)clientSounds.volume.get()).floatValue();

            ClientUtil.playSound(fileName, volume, false);

        }

    }





После этого мы переходим в класс IngameGUI по пути: src/net/minecraft/client/gui/ и после строк: eventDisplay.setMatrixStack(matrixStack);

eventDisplay.setPartialTicks(partialTicks);



мы должны вставить это:

Java:
Expand Collapse Copy
NaksonPaster.NOTIFICATION_MANAGER.draw(matrixStack);
Да я пастер
как изменить расположение нотификаций?
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
даже нормально не обьяснил че да как у меня не запускается куча ошибок
 
Назад
Сверху Снизу