Исходник Spotify render exp 3.1

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
5 Ноя 2022
Сообщения
109
Реакции
0
Выберите загрузчик игры
  1. Vanilla

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

ss:
Снимок экрана 2025-02-17 135510.png

1741274921016.png


library:
Пожалуйста, авторизуйтесь для просмотра ссылки.

util:

Java:
Expand Collapse Copy
package im.quantum.utils.spotify;

import de.labystudio.spotifyapi.SpotifyAPI;
import de.labystudio.spotifyapi.SpotifyAPIFactory;
import de.labystudio.spotifyapi.SpotifyListener;
import de.labystudio.spotifyapi.model.Track;
import lombok.Getter;

import java.time.Duration;
import quantumprotect.annotations.Native;
@Native
public class SpotifyUtil {
    private static final SpotifyAPI api = SpotifyAPIFactory.create();
    @Getter
    private static Track currentTrack;
    private static boolean isPlaying;
    @Getter
    private static int currentPosition;

    static {
        api.registerListener(new SpotifyListener() {
            @Override
            public void onConnect() {
//                System.out.println("Connected to Spotify!");
            }

            @Override
            public void onTrackChanged(Track track) {
                currentTrack = track;
//                System.out.printf("Track changed: %s (%s)\n", track.getArtist() + " - " + track.getName(), formatDuration(Duration.ofMillis(track.getLength())));
            }

            @Override
            public void onPositionChanged(int position) {
                if (!api.hasTrack()) {
                    return;
                }

                int length = api.getTrack().getLength();
                float percentage = 100.0F / length * position;

//                System.out.printf(
//                        "Position changed: %s of %s (%d%%)\n",
//                        formatDuration(Duration.ofSeconds(position)),
//                        formatDuration(Duration.ofSeconds(length)),
//                        (int) percentage
//                );
            }

            @Override
            public void onPlayBackChanged(boolean playing) {
                isPlaying = playing;
                System.out.println(playing ? "Song started playing" : "Song stopped playing");
            }

            @Override
            public void onSync() {}

            @Override
            public void onDisconnect(Exception exception) {
                System.out.println("Disconnected: " + exception.getMessage());
            }
        });

        api.initialize();
    }

    public static String getCurrentTrackInfo() {
        if (currentTrack == null) return "Трек не найден";
        return currentTrack.getArtist() + " - " + currentTrack.getName();
    }

    public static String getCurrentListeningTime() {
        return formatDuration(Duration.ofMillis(currentPosition));
    }

    public static boolean isPlaying() {
        return isPlaying;
    }

    public static String getCurrentTrackDuration() {
        if (currentTrack == null) return "Длительность: неизвестно";
        return formatDuration(Duration.ofMillis(currentTrack.getLength()));
    }

    public static String formatDuration(Duration duration) {
        long seconds = duration.getSeconds();
        long minutes = seconds / 60;
        seconds %= 60;
        return String.format("%02d:%02d", minutes, seconds);
    }
}

render:

Java:
Expand Collapse Copy
package im.quantum.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.quantum.events.EventDisplay;
import im.quantum.functions.impl.Interface.HUD;
import im.quantum.ui.display.ElementRenderer;
import im.quantum.utils.animations.impl.DecelerateAnimation;
import im.quantum.utils.drag.Dragging;
import im.quantum.utils.render.DisplayUtils;
import im.quantum.utils.render.font.Fonts;
import im.quantum.utils.spotify.SpotifyUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.util.math.vector.Vector4f;
import ru.hogoshi.Animation;
import quantumprotect.annotations.Native;
@Native
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class SpotifyRenderer implements ElementRenderer {

    final Dragging dragging;

    float width;
    float height;

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();

        float posX = dragging.getX();
        float posY = dragging.getY();

        String duration = "Длительность: " + /*SpotifyUtil.getCurrentPosition() + " : " + */SpotifyUtil.getCurrentTrackDuration();
        String dNotFound = "Длительность: неизвестно";
        String notFound = "Трек не найден";
        float nameWidth = Fonts.sSB.getWidth(SpotifyUtil.getCurrentTrackInfo(), 8.5f);
        float nameNotFound = Fonts.sSB.getWidth("Трек не найден", 8.5f);
        float nameHeight = Fonts.sSB.getHeight(8.5f);
        float padding = 5;


        float durationWidth = Fonts.sSB.getWidth(duration, 8.5f);
        float durationNotFound = Fonts.sSB.getWidth("Длительность: неизвестно", 8.5f);

        DisplayUtils.newrect(posX, posY, width, height, new Vector4f(5, 5, 5, 5), 190);
        DisplayUtils.drawRoundedOutline(posX - 0.25f, posY, width, height, 5, 1, HUD.getColor(90, 1.5f));
        if(SpotifyUtil.isPlaying()) {
            if(nameWidth>durationWidth){
                width = padding*2 + nameWidth;
            }
            else{
                width = padding*2 + durationWidth;
            }
            height = padding*2 + nameHeight*2 + padding;
            Fonts.sSB.drawText(ms, SpotifyUtil.getCurrentTrackInfo(), posX + width/2 - nameWidth/2, posY + padding, -1, 8.5f);
            Fonts.sSB.drawText(ms, duration, posX + width/2 - durationWidth/2, posY + padding + nameHeight + padding, -1, 8.5f);
        }
        else {
            width = padding*2 + nameNotFound;
            height = padding*2 + nameHeight;
            Fonts.sSB.drawText(ms, notFound, posX + padding, posY + padding, -1, 8.5f);
        }
        dragging.setWidth(width);
        dragging.setHeight(height);
    }
}
модеры одобрите тему пжпжпжп
 
ss:
Посмотреть вложение 300484
Посмотреть вложение 300485

library:
Пожалуйста, авторизуйтесь для просмотра ссылки.

util:

Java:
Expand Collapse Copy
package im.quantum.utils.spotify;

import de.labystudio.spotifyapi.SpotifyAPI;
import de.labystudio.spotifyapi.SpotifyAPIFactory;
import de.labystudio.spotifyapi.SpotifyListener;
import de.labystudio.spotifyapi.model.Track;
import lombok.Getter;

import java.time.Duration;
import quantumprotect.annotations.Native;
@Native
public class SpotifyUtil {
    private static final SpotifyAPI api = SpotifyAPIFactory.create();
    @Getter
    private static Track currentTrack;
    private static boolean isPlaying;
    @Getter
    private static int currentPosition;

    static {
        api.registerListener(new SpotifyListener() {
            @Override
            public void onConnect() {
//                System.out.println("Connected to Spotify!");
            }

            @Override
            public void onTrackChanged(Track track) {
                currentTrack = track;
//                System.out.printf("Track changed: %s (%s)\n", track.getArtist() + " - " + track.getName(), formatDuration(Duration.ofMillis(track.getLength())));
            }

            @Override
            public void onPositionChanged(int position) {
                if (!api.hasTrack()) {
                    return;
                }

                int length = api.getTrack().getLength();
                float percentage = 100.0F / length * position;

//                System.out.printf(
//                        "Position changed: %s of %s (%d%%)\n",
//                        formatDuration(Duration.ofSeconds(position)),
//                        formatDuration(Duration.ofSeconds(length)),
//                        (int) percentage
//                );
            }

            @Override
            public void onPlayBackChanged(boolean playing) {
                isPlaying = playing;
                System.out.println(playing ? "Song started playing" : "Song stopped playing");
            }

            @Override
            public void onSync() {}

            @Override
            public void onDisconnect(Exception exception) {
                System.out.println("Disconnected: " + exception.getMessage());
            }
        });

        api.initialize();
    }

    public static String getCurrentTrackInfo() {
        if (currentTrack == null) return "Трек не найден";
        return currentTrack.getArtist() + " - " + currentTrack.getName();
    }

    public static String getCurrentListeningTime() {
        return formatDuration(Duration.ofMillis(currentPosition));
    }

    public static boolean isPlaying() {
        return isPlaying;
    }

    public static String getCurrentTrackDuration() {
        if (currentTrack == null) return "Длительность: неизвестно";
        return formatDuration(Duration.ofMillis(currentTrack.getLength()));
    }

    public static String formatDuration(Duration duration) {
        long seconds = duration.getSeconds();
        long minutes = seconds / 60;
        seconds %= 60;
        return String.format("%02d:%02d", minutes, seconds);
    }
}

render:

Java:
Expand Collapse Copy
package im.quantum.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.quantum.events.EventDisplay;
import im.quantum.functions.impl.Interface.HUD;
import im.quantum.ui.display.ElementRenderer;
import im.quantum.utils.animations.impl.DecelerateAnimation;
import im.quantum.utils.drag.Dragging;
import im.quantum.utils.render.DisplayUtils;
import im.quantum.utils.render.font.Fonts;
import im.quantum.utils.spotify.SpotifyUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.util.math.vector.Vector4f;
import ru.hogoshi.Animation;
import quantumprotect.annotations.Native;
@Native
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class SpotifyRenderer implements ElementRenderer {

    final Dragging dragging;

    float width;
    float height;

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();

        float posX = dragging.getX();
        float posY = dragging.getY();

        String duration = "Длительность: " + /*SpotifyUtil.getCurrentPosition() + " : " + */SpotifyUtil.getCurrentTrackDuration();
        String dNotFound = "Длительность: неизвестно";
        String notFound = "Трек не найден";
        float nameWidth = Fonts.sSB.getWidth(SpotifyUtil.getCurrentTrackInfo(), 8.5f);
        float nameNotFound = Fonts.sSB.getWidth("Трек не найден", 8.5f);
        float nameHeight = Fonts.sSB.getHeight(8.5f);
        float padding = 5;


        float durationWidth = Fonts.sSB.getWidth(duration, 8.5f);
        float durationNotFound = Fonts.sSB.getWidth("Длительность: неизвестно", 8.5f);

        DisplayUtils.newrect(posX, posY, width, height, new Vector4f(5, 5, 5, 5), 190);
        DisplayUtils.drawRoundedOutline(posX - 0.25f, posY, width, height, 5, 1, HUD.getColor(90, 1.5f));
        if(SpotifyUtil.isPlaying()) {
            if(nameWidth>durationWidth){
                width = padding*2 + nameWidth;
            }
            else{
                width = padding*2 + durationWidth;
            }
            height = padding*2 + nameHeight*2 + padding;
            Fonts.sSB.drawText(ms, SpotifyUtil.getCurrentTrackInfo(), posX + width/2 - nameWidth/2, posY + padding, -1, 8.5f);
            Fonts.sSB.drawText(ms, duration, posX + width/2 - durationWidth/2, posY + padding + nameHeight + padding, -1, 8.5f);
        }
        else {
            width = padding*2 + nameNotFound;
            height = padding*2 + nameHeight;
            Fonts.sSB.drawText(ms, notFound, posX + padding, posY + padding, -1, 8.5f);
        }
        dragging.setWidth(width);
        dragging.setHeight(height);
    }
}
модеры одобрите тему пжпжпжп
пастим, рил нужная вещь да и вроде расписал норм
 
ss:
Посмотреть вложение 300484
Посмотреть вложение 300485

library:
Пожалуйста, авторизуйтесь для просмотра ссылки.

util:

Java:
Expand Collapse Copy
package im.quantum.utils.spotify;

import de.labystudio.spotifyapi.SpotifyAPI;
import de.labystudio.spotifyapi.SpotifyAPIFactory;
import de.labystudio.spotifyapi.SpotifyListener;
import de.labystudio.spotifyapi.model.Track;
import lombok.Getter;

import java.time.Duration;
import quantumprotect.annotations.Native;
@Native
public class SpotifyUtil {
    private static final SpotifyAPI api = SpotifyAPIFactory.create();
    @Getter
    private static Track currentTrack;
    private static boolean isPlaying;
    @Getter
    private static int currentPosition;

    static {
        api.registerListener(new SpotifyListener() {
            @Override
            public void onConnect() {
//                System.out.println("Connected to Spotify!");
            }

            @Override
            public void onTrackChanged(Track track) {
                currentTrack = track;
//                System.out.printf("Track changed: %s (%s)\n", track.getArtist() + " - " + track.getName(), formatDuration(Duration.ofMillis(track.getLength())));
            }

            @Override
            public void onPositionChanged(int position) {
                if (!api.hasTrack()) {
                    return;
                }

                int length = api.getTrack().getLength();
                float percentage = 100.0F / length * position;

//                System.out.printf(
//                        "Position changed: %s of %s (%d%%)\n",
//                        formatDuration(Duration.ofSeconds(position)),
//                        formatDuration(Duration.ofSeconds(length)),
//                        (int) percentage
//                );
            }

            @Override
            public void onPlayBackChanged(boolean playing) {
                isPlaying = playing;
                System.out.println(playing ? "Song started playing" : "Song stopped playing");
            }

            @Override
            public void onSync() {}

            @Override
            public void onDisconnect(Exception exception) {
                System.out.println("Disconnected: " + exception.getMessage());
            }
        });

        api.initialize();
    }

    public static String getCurrentTrackInfo() {
        if (currentTrack == null) return "Трек не найден";
        return currentTrack.getArtist() + " - " + currentTrack.getName();
    }

    public static String getCurrentListeningTime() {
        return formatDuration(Duration.ofMillis(currentPosition));
    }

    public static boolean isPlaying() {
        return isPlaying;
    }

    public static String getCurrentTrackDuration() {
        if (currentTrack == null) return "Длительность: неизвестно";
        return formatDuration(Duration.ofMillis(currentTrack.getLength()));
    }

    public static String formatDuration(Duration duration) {
        long seconds = duration.getSeconds();
        long minutes = seconds / 60;
        seconds %= 60;
        return String.format("%02d:%02d", minutes, seconds);
    }
}

render:

Java:
Expand Collapse Copy
package im.quantum.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.quantum.events.EventDisplay;
import im.quantum.functions.impl.Interface.HUD;
import im.quantum.ui.display.ElementRenderer;
import im.quantum.utils.animations.impl.DecelerateAnimation;
import im.quantum.utils.drag.Dragging;
import im.quantum.utils.render.DisplayUtils;
import im.quantum.utils.render.font.Fonts;
import im.quantum.utils.spotify.SpotifyUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.util.math.vector.Vector4f;
import ru.hogoshi.Animation;
import quantumprotect.annotations.Native;
@Native
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class SpotifyRenderer implements ElementRenderer {

    final Dragging dragging;

    float width;
    float height;

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();

        float posX = dragging.getX();
        float posY = dragging.getY();

        String duration = "Длительность: " + /*SpotifyUtil.getCurrentPosition() + " : " + */SpotifyUtil.getCurrentTrackDuration();
        String dNotFound = "Длительность: неизвестно";
        String notFound = "Трек не найден";
        float nameWidth = Fonts.sSB.getWidth(SpotifyUtil.getCurrentTrackInfo(), 8.5f);
        float nameNotFound = Fonts.sSB.getWidth("Трек не найден", 8.5f);
        float nameHeight = Fonts.sSB.getHeight(8.5f);
        float padding = 5;


        float durationWidth = Fonts.sSB.getWidth(duration, 8.5f);
        float durationNotFound = Fonts.sSB.getWidth("Длительность: неизвестно", 8.5f);

        DisplayUtils.newrect(posX, posY, width, height, new Vector4f(5, 5, 5, 5), 190);
        DisplayUtils.drawRoundedOutline(posX - 0.25f, posY, width, height, 5, 1, HUD.getColor(90, 1.5f));
        if(SpotifyUtil.isPlaying()) {
            if(nameWidth>durationWidth){
                width = padding*2 + nameWidth;
            }
            else{
                width = padding*2 + durationWidth;
            }
            height = padding*2 + nameHeight*2 + padding;
            Fonts.sSB.drawText(ms, SpotifyUtil.getCurrentTrackInfo(), posX + width/2 - nameWidth/2, posY + padding, -1, 8.5f);
            Fonts.sSB.drawText(ms, duration, posX + width/2 - durationWidth/2, posY + padding + nameHeight + padding, -1, 8.5f);
        }
        else {
            width = padding*2 + nameNotFound;
            height = padding*2 + nameHeight;
            Fonts.sSB.drawText(ms, notFound, posX + padding, posY + padding, -1, 8.5f);
        }
        dragging.setWidth(width);
        dragging.setHeight(height);
    }
}
модеры одобрите тему пжпжпжп
имба
 
1. в твоем коде 0 функционала
2. говно код
3. работает только для спотифая

итог: говнище
 
ss:
Посмотреть вложение 300484
Посмотреть вложение 300485

library:
Пожалуйста, авторизуйтесь для просмотра ссылки.

util:

Java:
Expand Collapse Copy
package im.quantum.utils.spotify;

import de.labystudio.spotifyapi.SpotifyAPI;
import de.labystudio.spotifyapi.SpotifyAPIFactory;
import de.labystudio.spotifyapi.SpotifyListener;
import de.labystudio.spotifyapi.model.Track;
import lombok.Getter;

import java.time.Duration;
import quantumprotect.annotations.Native;
@Native
public class SpotifyUtil {
    private static final SpotifyAPI api = SpotifyAPIFactory.create();
    @Getter
    private static Track currentTrack;
    private static boolean isPlaying;
    @Getter
    private static int currentPosition;

    static {
        api.registerListener(new SpotifyListener() {
            @Override
            public void onConnect() {
//                System.out.println("Connected to Spotify!");
            }

            @Override
            public void onTrackChanged(Track track) {
                currentTrack = track;
//                System.out.printf("Track changed: %s (%s)\n", track.getArtist() + " - " + track.getName(), formatDuration(Duration.ofMillis(track.getLength())));
            }

            @Override
            public void onPositionChanged(int position) {
                if (!api.hasTrack()) {
                    return;
                }

                int length = api.getTrack().getLength();
                float percentage = 100.0F / length * position;

//                System.out.printf(
//                        "Position changed: %s of %s (%d%%)\n",
//                        formatDuration(Duration.ofSeconds(position)),
//                        formatDuration(Duration.ofSeconds(length)),
//                        (int) percentage
//                );
            }

            @Override
            public void onPlayBackChanged(boolean playing) {
                isPlaying = playing;
                System.out.println(playing ? "Song started playing" : "Song stopped playing");
            }

            @Override
            public void onSync() {}

            @Override
            public void onDisconnect(Exception exception) {
                System.out.println("Disconnected: " + exception.getMessage());
            }
        });

        api.initialize();
    }

    public static String getCurrentTrackInfo() {
        if (currentTrack == null) return "Трек не найден";
        return currentTrack.getArtist() + " - " + currentTrack.getName();
    }

    public static String getCurrentListeningTime() {
        return formatDuration(Duration.ofMillis(currentPosition));
    }

    public static boolean isPlaying() {
        return isPlaying;
    }

    public static String getCurrentTrackDuration() {
        if (currentTrack == null) return "Длительность: неизвестно";
        return formatDuration(Duration.ofMillis(currentTrack.getLength()));
    }

    public static String formatDuration(Duration duration) {
        long seconds = duration.getSeconds();
        long minutes = seconds / 60;
        seconds %= 60;
        return String.format("%02d:%02d", minutes, seconds);
    }
}

render:

Java:
Expand Collapse Copy
package im.quantum.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.quantum.events.EventDisplay;
import im.quantum.functions.impl.Interface.HUD;
import im.quantum.ui.display.ElementRenderer;
import im.quantum.utils.animations.impl.DecelerateAnimation;
import im.quantum.utils.drag.Dragging;
import im.quantum.utils.render.DisplayUtils;
import im.quantum.utils.render.font.Fonts;
import im.quantum.utils.spotify.SpotifyUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.util.math.vector.Vector4f;
import ru.hogoshi.Animation;
import quantumprotect.annotations.Native;
@Native
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class SpotifyRenderer implements ElementRenderer {

    final Dragging dragging;

    float width;
    float height;

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();

        float posX = dragging.getX();
        float posY = dragging.getY();

        String duration = "Длительность: " + /*SpotifyUtil.getCurrentPosition() + " : " + */SpotifyUtil.getCurrentTrackDuration();
        String dNotFound = "Длительность: неизвестно";
        String notFound = "Трек не найден";
        float nameWidth = Fonts.sSB.getWidth(SpotifyUtil.getCurrentTrackInfo(), 8.5f);
        float nameNotFound = Fonts.sSB.getWidth("Трек не найден", 8.5f);
        float nameHeight = Fonts.sSB.getHeight(8.5f);
        float padding = 5;


        float durationWidth = Fonts.sSB.getWidth(duration, 8.5f);
        float durationNotFound = Fonts.sSB.getWidth("Длительность: неизвестно", 8.5f);

        DisplayUtils.newrect(posX, posY, width, height, new Vector4f(5, 5, 5, 5), 190);
        DisplayUtils.drawRoundedOutline(posX - 0.25f, posY, width, height, 5, 1, HUD.getColor(90, 1.5f));
        if(SpotifyUtil.isPlaying()) {
            if(nameWidth>durationWidth){
                width = padding*2 + nameWidth;
            }
            else{
                width = padding*2 + durationWidth;
            }
            height = padding*2 + nameHeight*2 + padding;
            Fonts.sSB.drawText(ms, SpotifyUtil.getCurrentTrackInfo(), posX + width/2 - nameWidth/2, posY + padding, -1, 8.5f);
            Fonts.sSB.drawText(ms, duration, posX + width/2 - durationWidth/2, posY + padding + nameHeight + padding, -1, 8.5f);
        }
        else {
            width = padding*2 + nameNotFound;
            height = padding*2 + nameHeight;
            Fonts.sSB.drawText(ms, notFound, posX + padding, posY + padding, -1, 8.5f);
        }
        dragging.setWidth(width);
        dragging.setHeight(height);
    }
}
модеры одобрите тему пжпжпжп
имба иду пастить в свой клиент
 
1741368991063.png
кинь метод, желательно еще шрифт "sSB"
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
ss:
Посмотреть вложение 300484
Посмотреть вложение 300485

library:
Пожалуйста, авторизуйтесь для просмотра ссылки.

util:

Java:
Expand Collapse Copy
package im.quantum.utils.spotify;

import de.labystudio.spotifyapi.SpotifyAPI;
import de.labystudio.spotifyapi.SpotifyAPIFactory;
import de.labystudio.spotifyapi.SpotifyListener;
import de.labystudio.spotifyapi.model.Track;
import lombok.Getter;

import java.time.Duration;
import quantumprotect.annotations.Native;
@Native
public class SpotifyUtil {
    private static final SpotifyAPI api = SpotifyAPIFactory.create();
    @Getter
    private static Track currentTrack;
    private static boolean isPlaying;
    @Getter
    private static int currentPosition;

    static {
        api.registerListener(new SpotifyListener() {
            @Override
            public void onConnect() {
//                System.out.println("Connected to Spotify!");
            }

            @Override
            public void onTrackChanged(Track track) {
                currentTrack = track;
//                System.out.printf("Track changed: %s (%s)\n", track.getArtist() + " - " + track.getName(), formatDuration(Duration.ofMillis(track.getLength())));
            }

            @Override
            public void onPositionChanged(int position) {
                if (!api.hasTrack()) {
                    return;
                }

                int length = api.getTrack().getLength();
                float percentage = 100.0F / length * position;

//                System.out.printf(
//                        "Position changed: %s of %s (%d%%)\n",
//                        formatDuration(Duration.ofSeconds(position)),
//                        formatDuration(Duration.ofSeconds(length)),
//                        (int) percentage
//                );
            }

            @Override
            public void onPlayBackChanged(boolean playing) {
                isPlaying = playing;
                System.out.println(playing ? "Song started playing" : "Song stopped playing");
            }

            @Override
            public void onSync() {}

            @Override
            public void onDisconnect(Exception exception) {
                System.out.println("Disconnected: " + exception.getMessage());
            }
        });

        api.initialize();
    }

    public static String getCurrentTrackInfo() {
        if (currentTrack == null) return "Трек не найден";
        return currentTrack.getArtist() + " - " + currentTrack.getName();
    }

    public static String getCurrentListeningTime() {
        return formatDuration(Duration.ofMillis(currentPosition));
    }

    public static boolean isPlaying() {
        return isPlaying;
    }

    public static String getCurrentTrackDuration() {
        if (currentTrack == null) return "Длительность: неизвестно";
        return formatDuration(Duration.ofMillis(currentTrack.getLength()));
    }

    public static String formatDuration(Duration duration) {
        long seconds = duration.getSeconds();
        long minutes = seconds / 60;
        seconds %= 60;
        return String.format("%02d:%02d", minutes, seconds);
    }
}

render:

Java:
Expand Collapse Copy
package im.quantum.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.quantum.events.EventDisplay;
import im.quantum.functions.impl.Interface.HUD;
import im.quantum.ui.display.ElementRenderer;
import im.quantum.utils.animations.impl.DecelerateAnimation;
import im.quantum.utils.drag.Dragging;
import im.quantum.utils.render.DisplayUtils;
import im.quantum.utils.render.font.Fonts;
import im.quantum.utils.spotify.SpotifyUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.util.math.vector.Vector4f;
import ru.hogoshi.Animation;
import quantumprotect.annotations.Native;
@Native
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class SpotifyRenderer implements ElementRenderer {

    final Dragging dragging;

    float width;
    float height;

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();

        float posX = dragging.getX();
        float posY = dragging.getY();

        String duration = "Длительность: " + /*SpotifyUtil.getCurrentPosition() + " : " + */SpotifyUtil.getCurrentTrackDuration();
        String dNotFound = "Длительность: неизвестно";
        String notFound = "Трек не найден";
        float nameWidth = Fonts.sSB.getWidth(SpotifyUtil.getCurrentTrackInfo(), 8.5f);
        float nameNotFound = Fonts.sSB.getWidth("Трек не найден", 8.5f);
        float nameHeight = Fonts.sSB.getHeight(8.5f);
        float padding = 5;


        float durationWidth = Fonts.sSB.getWidth(duration, 8.5f);
        float durationNotFound = Fonts.sSB.getWidth("Длительность: неизвестно", 8.5f);

        DisplayUtils.newrect(posX, posY, width, height, new Vector4f(5, 5, 5, 5), 190);
        DisplayUtils.drawRoundedOutline(posX - 0.25f, posY, width, height, 5, 1, HUD.getColor(90, 1.5f));
        if(SpotifyUtil.isPlaying()) {
            if(nameWidth>durationWidth){
                width = padding*2 + nameWidth;
            }
            else{
                width = padding*2 + durationWidth;
            }
            height = padding*2 + nameHeight*2 + padding;
            Fonts.sSB.drawText(ms, SpotifyUtil.getCurrentTrackInfo(), posX + width/2 - nameWidth/2, posY + padding, -1, 8.5f);
            Fonts.sSB.drawText(ms, duration, posX + width/2 - durationWidth/2, posY + padding + nameHeight + padding, -1, 8.5f);
        }
        else {
            width = padding*2 + nameNotFound;
            height = padding*2 + nameHeight;
            Fonts.sSB.drawText(ms, notFound, posX + padding, posY + padding, -1, 8.5f);
        }
        dragging.setWidth(width);
        dragging.setHeight(height);
    }
}
модеры одобрите тему пжпжпжп
смысл от этого если это онли визуал
 
Newrect это просто тот же рект только там блюр сразу идет
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
довести рект до ума и будет годно
 
На ям/вм больше смысла было бы
 
пастим, рил нужная вещь да и вроде расписал норм
ss:
Посмотреть вложение 300484
Посмотреть вложение 300485

library:
Пожалуйста, авторизуйтесь для просмотра ссылки.

util:

Java:
Expand Collapse Copy
package im.quantum.utils.spotify;

import de.labystudio.spotifyapi.SpotifyAPI;
import de.labystudio.spotifyapi.SpotifyAPIFactory;
import de.labystudio.spotifyapi.SpotifyListener;
import de.labystudio.spotifyapi.model.Track;
import lombok.Getter;

import java.time.Duration;
import quantumprotect.annotations.Native;
@Native
public class SpotifyUtil {
    private static final SpotifyAPI api = SpotifyAPIFactory.create();
    @Getter
    private static Track currentTrack;
    private static boolean isPlaying;
    @Getter
    private static int currentPosition;

    static {
        api.registerListener(new SpotifyListener() {
            @Override
            public void onConnect() {
//                System.out.println("Connected to Spotify!");
            }

            @Override
            public void onTrackChanged(Track track) {
                currentTrack = track;
//                System.out.printf("Track changed: %s (%s)\n", track.getArtist() + " - " + track.getName(), formatDuration(Duration.ofMillis(track.getLength())));
            }

            @Override
            public void onPositionChanged(int position) {
                if (!api.hasTrack()) {
                    return;
                }

                int length = api.getTrack().getLength();
                float percentage = 100.0F / length * position;

//                System.out.printf(
//                        "Position changed: %s of %s (%d%%)\n",
//                        formatDuration(Duration.ofSeconds(position)),
//                        formatDuration(Duration.ofSeconds(length)),
//                        (int) percentage
//                );
            }

            @Override
            public void onPlayBackChanged(boolean playing) {
                isPlaying = playing;
                System.out.println(playing ? "Song started playing" : "Song stopped playing");
            }

            @Override
            public void onSync() {}

            @Override
            public void onDisconnect(Exception exception) {
                System.out.println("Disconnected: " + exception.getMessage());
            }
        });

        api.initialize();
    }

    public static String getCurrentTrackInfo() {
        if (currentTrack == null) return "Трек не найден";
        return currentTrack.getArtist() + " - " + currentTrack.getName();
    }

    public static String getCurrentListeningTime() {
        return formatDuration(Duration.ofMillis(currentPosition));
    }

    public static boolean isPlaying() {
        return isPlaying;
    }

    public static String getCurrentTrackDuration() {
        if (currentTrack == null) return "Длительность: неизвестно";
        return formatDuration(Duration.ofMillis(currentTrack.getLength()));
    }

    public static String formatDuration(Duration duration) {
        long seconds = duration.getSeconds();
        long minutes = seconds / 60;
        seconds %= 60;
        return String.format("%02d:%02d", minutes, seconds);
    }
}

render:

Java:
Expand Collapse Copy
package im.quantum.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.quantum.events.EventDisplay;
import im.quantum.functions.impl.Interface.HUD;
import im.quantum.ui.display.ElementRenderer;
import im.quantum.utils.animations.impl.DecelerateAnimation;
import im.quantum.utils.drag.Dragging;
import im.quantum.utils.render.DisplayUtils;
import im.quantum.utils.render.font.Fonts;
import im.quantum.utils.spotify.SpotifyUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.util.math.vector.Vector4f;
import ru.hogoshi.Animation;
import quantumprotect.annotations.Native;
@Native
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class SpotifyRenderer implements ElementRenderer {

    final Dragging dragging;

    float width;
    float height;

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();

        float posX = dragging.getX();
        float posY = dragging.getY();

        String duration = "Длительность: " + /*SpotifyUtil.getCurrentPosition() + " : " + */SpotifyUtil.getCurrentTrackDuration();
        String dNotFound = "Длительность: неизвестно";
        String notFound = "Трек не найден";
        float nameWidth = Fonts.sSB.getWidth(SpotifyUtil.getCurrentTrackInfo(), 8.5f);
        float nameNotFound = Fonts.sSB.getWidth("Трек не найден", 8.5f);
        float nameHeight = Fonts.sSB.getHeight(8.5f);
        float padding = 5;


        float durationWidth = Fonts.sSB.getWidth(duration, 8.5f);
        float durationNotFound = Fonts.sSB.getWidth("Длительность: неизвестно", 8.5f);

        DisplayUtils.newrect(posX, posY, width, height, new Vector4f(5, 5, 5, 5), 190);
        DisplayUtils.drawRoundedOutline(posX - 0.25f, posY, width, height, 5, 1, HUD.getColor(90, 1.5f));
        if(SpotifyUtil.isPlaying()) {
            if(nameWidth>durationWidth){
                width = padding*2 + nameWidth;
            }
            else{
                width = padding*2 + durationWidth;
            }
            height = padding*2 + nameHeight*2 + padding;
            Fonts.sSB.drawText(ms, SpotifyUtil.getCurrentTrackInfo(), posX + width/2 - nameWidth/2, posY + padding, -1, 8.5f);
            Fonts.sSB.drawText(ms, duration, posX + width/2 - durationWidth/2, posY + padding + nameHeight + padding, -1, 8.5f);
        }
        else {
            width = padding*2 + nameNotFound;
            height = padding*2 + nameHeight;
            Fonts.sSB.drawText(ms, notFound, posX + padding, posY + padding, -1, 8.5f);
        }
        dragging.setWidth(width);
        dragging.setHeight(height);
    }
}
модеры одобрите тему пжпжпжп
хуйня, у мойтена топ
 
есть у кого утлка вк или яндекс музыка?
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
так а зачем в чите нужен худ это же онли визуалы
Так а смысл от спотифай рендера если он в пвп никак не поможет
зачем в чите нужен худ
Чтобы отображать какую-ту инфу. Ну те же самые кей-бинды, без них ты бы не знал например включена у тебя киллка или нет
 
хуйня, у мойтена топ
Пасиба бро
ss:
Посмотреть вложение 300484
Посмотреть вложение 300485

library:
Пожалуйста, авторизуйтесь для просмотра ссылки.

util:

Java:
Expand Collapse Copy
package im.quantum.utils.spotify;

import de.labystudio.spotifyapi.SpotifyAPI;
import de.labystudio.spotifyapi.SpotifyAPIFactory;
import de.labystudio.spotifyapi.SpotifyListener;
import de.labystudio.spotifyapi.model.Track;
import lombok.Getter;

import java.time.Duration;
import quantumprotect.annotations.Native;
@Native
public class SpotifyUtil {
    private static final SpotifyAPI api = SpotifyAPIFactory.create();
    @Getter
    private static Track currentTrack;
    private static boolean isPlaying;
    @Getter
    private static int currentPosition;

    static {
        api.registerListener(new SpotifyListener() {
            @Override
            public void onConnect() {
//                System.out.println("Connected to Spotify!");
            }

            @Override
            public void onTrackChanged(Track track) {
                currentTrack = track;
//                System.out.printf("Track changed: %s (%s)\n", track.getArtist() + " - " + track.getName(), formatDuration(Duration.ofMillis(track.getLength())));
            }

            @Override
            public void onPositionChanged(int position) {
                if (!api.hasTrack()) {
                    return;
                }

                int length = api.getTrack().getLength();
                float percentage = 100.0F / length * position;

//                System.out.printf(
//                        "Position changed: %s of %s (%d%%)\n",
//                        formatDuration(Duration.ofSeconds(position)),
//                        formatDuration(Duration.ofSeconds(length)),
//                        (int) percentage
//                );
            }

            @Override
            public void onPlayBackChanged(boolean playing) {
                isPlaying = playing;
                System.out.println(playing ? "Song started playing" : "Song stopped playing");
            }

            @Override
            public void onSync() {}

            @Override
            public void onDisconnect(Exception exception) {
                System.out.println("Disconnected: " + exception.getMessage());
            }
        });

        api.initialize();
    }

    public static String getCurrentTrackInfo() {
        if (currentTrack == null) return "Трек не найден";
        return currentTrack.getArtist() + " - " + currentTrack.getName();
    }

    public static String getCurrentListeningTime() {
        return formatDuration(Duration.ofMillis(currentPosition));
    }

    public static boolean isPlaying() {
        return isPlaying;
    }

    public static String getCurrentTrackDuration() {
        if (currentTrack == null) return "Длительность: неизвестно";
        return formatDuration(Duration.ofMillis(currentTrack.getLength()));
    }

    public static String formatDuration(Duration duration) {
        long seconds = duration.getSeconds();
        long minutes = seconds / 60;
        seconds %= 60;
        return String.format("%02d:%02d", minutes, seconds);
    }
}

render:

Java:
Expand Collapse Copy
package im.quantum.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.quantum.events.EventDisplay;
import im.quantum.functions.impl.Interface.HUD;
import im.quantum.ui.display.ElementRenderer;
import im.quantum.utils.animations.impl.DecelerateAnimation;
import im.quantum.utils.drag.Dragging;
import im.quantum.utils.render.DisplayUtils;
import im.quantum.utils.render.font.Fonts;
import im.quantum.utils.spotify.SpotifyUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.util.math.vector.Vector4f;
import ru.hogoshi.Animation;
import quantumprotect.annotations.Native;
@Native
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class SpotifyRenderer implements ElementRenderer {

    final Dragging dragging;

    float width;
    float height;

    @Override
    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();

        float posX = dragging.getX();
        float posY = dragging.getY();

        String duration = "Длительность: " + /*SpotifyUtil.getCurrentPosition() + " : " + */SpotifyUtil.getCurrentTrackDuration();
        String dNotFound = "Длительность: неизвестно";
        String notFound = "Трек не найден";
        float nameWidth = Fonts.sSB.getWidth(SpotifyUtil.getCurrentTrackInfo(), 8.5f);
        float nameNotFound = Fonts.sSB.getWidth("Трек не найден", 8.5f);
        float nameHeight = Fonts.sSB.getHeight(8.5f);
        float padding = 5;


        float durationWidth = Fonts.sSB.getWidth(duration, 8.5f);
        float durationNotFound = Fonts.sSB.getWidth("Длительность: неизвестно", 8.5f);

        DisplayUtils.newrect(posX, posY, width, height, new Vector4f(5, 5, 5, 5), 190);
        DisplayUtils.drawRoundedOutline(posX - 0.25f, posY, width, height, 5, 1, HUD.getColor(90, 1.5f));
        if(SpotifyUtil.isPlaying()) {
            if(nameWidth>durationWidth){
                width = padding*2 + nameWidth;
            }
            else{
                width = padding*2 + durationWidth;
            }
            height = padding*2 + nameHeight*2 + padding;
            Fonts.sSB.drawText(ms, SpotifyUtil.getCurrentTrackInfo(), posX + width/2 - nameWidth/2, posY + padding, -1, 8.5f);
            Fonts.sSB.drawText(ms, duration, posX + width/2 - durationWidth/2, posY + padding + nameHeight + padding, -1, 8.5f);
        }
        else {
            width = padding*2 + nameNotFound;
            height = padding*2 + nameHeight;
            Fonts.sSB.drawText(ms, notFound, posX + padding, posY + padding, -1, 8.5f);
        }
        dragging.setWidth(width);
        dragging.setHeight(height);
    }
}
модеры одобрите тему пжпжпжп
Хуйня ибо только на спотифай
Рендер дрист полный, думаю тут итак понятно
Нет рендера хотя бы статичной картинки "иконки" музыки
Исполнитель и название песни в одной строке
В длительности пишется сколько длится песня (можно заменить на текущее время/макс время или отрисовать полосочку
 
Назад
Сверху Снизу