Визуальная часть ArrayList | Exp 3.1

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

не бейте пж да

Код:
Expand Collapse Copy
package fun.netreex.ui.display.impl;

import com.mojang.blaze3d.matrix.MatrixStack;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;

import fun.netreex.events.EventDisplay;
import fun.netreex.events.EventUpdate;
import fun.netreex.functions.api.Function;
import fun.netreex.functions.api.Category;
import fun.netreex.Netreex;
import fun.netreex.ui.display.ElementRenderer;
import fun.netreex.ui.display.ElementUpdater;
import fun.netreex.utils.drag.Dragging;
import fun.netreex.utils.math.StopWatch;
import fun.netreex.utils.render.ColorUtils;
import fun.netreex.utils.render.DisplayUtils;
import fun.netreex.utils.render.font.Fonts;
import net.minecraft.client.Minecraft;
import ru.hogoshi.Animation;

public class ArrayListRenderer3 implements ElementRenderer, ElementUpdater {
    private int lastIndex;
    List<Function> list;
    StopWatch stopWatch = new StopWatch();

    public ArrayListRenderer3(Dragging arrayListDrag) {
    }

    public void update(EventUpdate e) {
        if (this.stopWatch.isReached(1000L)) {
            this.list = Netreex.getInstance().getFunctionRegistry().getSorted(Fonts.sfui, 7.5F).stream()
                    .filter(f -> f.getCategory() == Category.Combat || f.getCategory() == Category.Player)
                    .collect(Collectors.toList());
            this.stopWatch.reset();
        }
    }

    public void render(EventDisplay eventDisplay) {
        MatrixStack ms = eventDisplay.getMatrixStack();
        float rounding = 6.0F;
        float padding = 3.5F;
        Minecraft mc = Minecraft.getInstance();
        int screenWidth = mc.getMainWindow().getScaledWidth();
        float posY = 0.0F;
        int index = 0;
        if (this.list != null) {
            Iterator var9 = this.list.iterator();

            Function f;
            float fontSize;
            Animation anim;
            float value;
            String text;
            while(var9.hasNext()) {
                f = (Function)var9.next();
                fontSize = 6.5F;
                anim = f.getAnimation();
                value = (float)anim.getValue();
                text = f.getName();
                Fonts.sfui.getWidth(text, fontSize);
                if (value != 0.0F) {
                    posY += (fontSize + padding * 2.0F) * value;
                    ++index;
                }
            }

            index = 0;
            posY = 5.0F;
            var9 = this.list.iterator();

            while(var9.hasNext()) {
                f = (Function)var9.next();
                fontSize = 6.5F;
                anim = f.getAnimation();
                anim.update();
                value = (float)anim.getValue();
                text = f.getName();
                float textWidth = Fonts.sfui.getWidth(text, fontSize);
                if (value != 0.0F) {
                    float localFontSize = fontSize * value;
                    float localTextWidth = textWidth * value;
                    float posX = (float)screenWidth - localTextWidth - padding * 2.0F - 4.0F;
                    boolean isFirst = index == 0;
                    boolean isLast = index == this.lastIndex;
                    float topLeftRadius = isFirst ? rounding : 0.0F;
                    float bottomLeftRadius = isLast ? rounding : 0.0F;
                    DisplayUtils.drawRoundedRect(posX, posY, localTextWidth + padding * 2.0F, localFontSize + padding * 2.0F, value, ColorUtils.rgba(25, 25, 25, 250));
                    // Убрана строка с отрисовкой тени
                    Fonts.sfui.drawText(ms, f.getName(), posX + padding, posY + padding, ColorUtils.getColor(0), localFontSize);
                    posY += (fontSize + padding * 2.0F - 1.0F) * value;
                    ++index;
                }
            }

            this.lastIndex = index - 1;
        }
    }
}
какой arraylistrenderer3 блять
 

Похожие темы

Назад
Сверху Снизу