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

Часть функционала WardenHelper | 1.21.4

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
14 Ноя 2021
Сообщения
29
Реакции
0
Выберите загрузчик игры
  1. Fabric
сливаю варден хелпер за 5 минут, работает отлично
добавлено сохранение в кэш, чтобы не было прогрузки в 2 чанка
WardenHelper:
Expand Collapse Copy
package AMNEZIADLCPRODUCTION;

import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.entity.Entity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.util.math.Vec3d;
import amezia.tech.amnezia;
import amezia.tech.base.events.impl.other.EventTick;
import amezia.tech.base.events.impl.render.EventRender2D;
import amezia.tech.base.font.Fonts;
import amezia.tech.base.theme.Theme;
import amezia.tech.client.modules.api.Category;
import amezia.tech.client.modules.api.Module;
import amezia.tech.client.modules.api.ModuleAnnotation;
import amezia.tech.client.modules.api.setting.impl.BooleanSetting;
import amezia.tech.utility.math.ProjectionUtil;
import amezia.tech.utility.render.display.base.BorderRadius;
import amezia.tech.utility.render.display.base.color.ColorRGBA;
import amezia.tech.utility.render.display.base.color.ColorUtil;
import amezia.tech.utility.render.display.shader.DrawUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@ModuleAnnotation(
        name = "WardenHelper",
        category = Category.RENDER,
        description = "Таймер сундуков Вардена"
)
public class WardenHelper extends Module {

    public static final WardenHelper INSTANCE = new WardenHelper();

    private static final Pattern TIME_PATTERN = Pattern.compile("(\\d{1,2}):(\\d{2})");
    private static final Pattern COLOR_CLEANER = Pattern.compile("§[0-9a-fk-or]");

    public final BooleanSetting hideOriginal = new BooleanSetting("Скрывать таймер", true);
    public final BooleanSetting blur = new BooleanSetting("Blur", true);

    private final List<CachedTimer> cachedTimers = new ArrayList<>();

    private WardenHelper() {
        getSettings().add(hideOriginal);
        getSettings().add(blur);
    }

    @Override
    public void onDisable() {
        cachedTimers.clear();
        super.onDisable();
    }

    @EventTarget
    public void onTick(EventTick e) {
        if (mc.world == null || mc.player == null) return;

        long currentTime = System.currentTimeMillis();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        // Сканирование сущностей
        for (Entity entity : mc.world.getEntities()) {
            if (!(entity instanceof ArmorStandEntity || entity instanceof DisplayEntity.TextDisplayEntity)) continue;

            String text = "";
            if (entity instanceof ArmorStandEntity) {
                if (entity.hasCustomName()) text = entity.getCustomName().getString();
            } else {
                DisplayEntity.TextDisplayEntity te = (DisplayEntity.TextDisplayEntity) entity;
                if (te.getText() != null) text = te.getText().getString();
            }

            if (text.isEmpty()) continue;

            // Очистка текста
            String cleanText = COLOR_CLEANER.matcher(text).replaceAll("");
            Matcher matcher = TIME_PATTERN.matcher(cleanText);

            if (matcher.find()) {
                if (hideOriginal.isEnabled()) {
                    entity.setInvisible(true);
                    if (entity instanceof ArmorStandEntity) entity.setCustomNameVisible(false);
                }

                int minutes = Integer.parseInt(matcher.group(1));
                int seconds = Integer.parseInt(matcher.group(2));
                long remainingNewSec = (minutes * 60L) + seconds;

                double offsetY = entity instanceof ArmorStandEntity ? 1.8D : 0.5D;
                Vec3d pos = new Vec3d(entity.getX(), entity.getY() + offsetY, entity.getZ());

                boolean found = false;
                for (CachedTimer timer : cachedTimers) {
                    // Проверка дистанции
                    if (timer.dimension.equals(currentDimension) && timer.pos.squaredDistanceTo(pos) < 1.0) {
                        if (timer.expirationTime > currentTime) {
                            timer.expirationTime = currentTime + (remainingNewSec * 1000L);
                        }
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    cachedTimers.add(new CachedTimer(pos, currentTime + (remainingNewSec * 1000L), currentDimension));
                }
            }
        }

        // Чистка кэша
        cachedTimers.removeIf(t -> t.expirationTime + 15000L <= currentTime);
        cachedTimers.sort(Comparator.comparingLong(t -> t.expirationTime));
    }

    @EventTarget
    public void onRender(EventRender2D e) {
        if (mc.world == null || mc.player == null || cachedTimers.isEmpty()) return;

        long currentTime = System.currentTimeMillis();
        Theme currentTheme = Vortex.getInstance().getThemeManager().getCurrentTheme();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        int renderedCount = 0;
        for (CachedTimer timer : cachedTimers) {
            if (!timer.dimension.equals(currentDimension) || renderedCount >= 5) continue;

            Vec3d proj = ProjectionUtil.worldSpaceToScreenSpace(timer.pos);
            if (proj.z <= 0.0D || proj.z >= 1.0D) continue;

            long remainingMs = timer.expirationTime - currentTime;
            boolean isExpired = remainingMs <= 0;
            long absMs = Math.abs(remainingMs);
            long totalSec = absMs / 1000L;
            long mins = totalSec / 60;
            long secs = totalSec % 60;

            // Форматирование текста
            String timeToRender = (isExpired ? "+" : "") +
                    (mins < 10 ? "0" : "") + mins + ":" +
                    (secs < 10 ? "0" : "") + secs;

            ColorRGBA finalColor = isExpired ? new ColorRGBA(255, 215, 0, 255) :
                    ColorUtil.interpolate(new ColorRGBA(255, 40, 40, 255), currentTheme.getColor(),
                            Math.min((float)remainingMs / 180000.0f, 1.0f));

            float fontSize = 8.5F;
            float textWidth = Fonts.REGULAR.getWidth(timeToRender, fontSize);
            float rectWidth = textWidth + 8.0F;
            float rectHeight = 12.0F;
            float rectX = (float) proj.x - (rectWidth / 2.0F);
            float rectY = (float) proj.y - 3.0F;

            // Рендер фона
            if (this.blur.isEnabled())
                DrawUtil.drawBlur(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight, 8.0f, BorderRadius.all(3.0f), ColorRGBA.WHITE);

            DrawUtil.drawRoundedRect(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight,
                    BorderRadius.all(3.0F), new ColorRGBA(0, 0, 0, 180));

            // Рендер текста
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F + 0.5F, rectY + 3.0F + 0.5F, new ColorRGBA(0, 0, 0, 150));
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F, rectY + 3.0F, finalColor);

            renderedCount++;
        }
    }

    private static class CachedTimer {
        Vec3d pos;
        long expirationTime;
        String dimension;

        CachedTimer(Vec3d pos, long expirationTime, String dimension) {
            this.pos = pos;
            this.expirationTime = expirationTime;
            this.dimension = dimension;
        }
    }
}
 
сливаю варден хелпер за 5 минут, работает отлично
добавлено сохранение в кэш, чтобы не было прогрузки в 2 чанка
WardenHelper:
Expand Collapse Copy
package AMNEZIADLCPRODUCTION;

import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.entity.Entity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.util.math.Vec3d;
import amezia.tech.amnezia;
import amezia.tech.base.events.impl.other.EventTick;
import amezia.tech.base.events.impl.render.EventRender2D;
import amezia.tech.base.font.Fonts;
import amezia.tech.base.theme.Theme;
import amezia.tech.client.modules.api.Category;
import amezia.tech.client.modules.api.Module;
import amezia.tech.client.modules.api.ModuleAnnotation;
import amezia.tech.client.modules.api.setting.impl.BooleanSetting;
import amezia.tech.utility.math.ProjectionUtil;
import amezia.tech.utility.render.display.base.BorderRadius;
import amezia.tech.utility.render.display.base.color.ColorRGBA;
import amezia.tech.utility.render.display.base.color.ColorUtil;
import amezia.tech.utility.render.display.shader.DrawUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@ModuleAnnotation(
        name = "WardenHelper",
        category = Category.RENDER,
        description = "Таймер сундуков Вардена"
)
public class WardenHelper extends Module {

    public static final WardenHelper INSTANCE = new WardenHelper();

    private static final Pattern TIME_PATTERN = Pattern.compile("(\\d{1,2}):(\\d{2})");
    private static final Pattern COLOR_CLEANER = Pattern.compile("§[0-9a-fk-or]");

    public final BooleanSetting hideOriginal = new BooleanSetting("Скрывать таймер", true);
    public final BooleanSetting blur = new BooleanSetting("Blur", true);

    private final List<CachedTimer> cachedTimers = new ArrayList<>();

    private WardenHelper() {
        getSettings().add(hideOriginal);
        getSettings().add(blur);
    }

    @Override
    public void onDisable() {
        cachedTimers.clear();
        super.onDisable();
    }

    @EventTarget
    public void onTick(EventTick e) {
        if (mc.world == null || mc.player == null) return;

        long currentTime = System.currentTimeMillis();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        // Сканирование сущностей
        for (Entity entity : mc.world.getEntities()) {
            if (!(entity instanceof ArmorStandEntity || entity instanceof DisplayEntity.TextDisplayEntity)) continue;

            String text = "";
            if (entity instanceof ArmorStandEntity) {
                if (entity.hasCustomName()) text = entity.getCustomName().getString();
            } else {
                DisplayEntity.TextDisplayEntity te = (DisplayEntity.TextDisplayEntity) entity;
                if (te.getText() != null) text = te.getText().getString();
            }

            if (text.isEmpty()) continue;

            // Очистка текста
            String cleanText = COLOR_CLEANER.matcher(text).replaceAll("");
            Matcher matcher = TIME_PATTERN.matcher(cleanText);

            if (matcher.find()) {
                if (hideOriginal.isEnabled()) {
                    entity.setInvisible(true);
                    if (entity instanceof ArmorStandEntity) entity.setCustomNameVisible(false);
                }

                int minutes = Integer.parseInt(matcher.group(1));
                int seconds = Integer.parseInt(matcher.group(2));
                long remainingNewSec = (minutes * 60L) + seconds;

                double offsetY = entity instanceof ArmorStandEntity ? 1.8D : 0.5D;
                Vec3d pos = new Vec3d(entity.getX(), entity.getY() + offsetY, entity.getZ());

                boolean found = false;
                for (CachedTimer timer : cachedTimers) {
                    // Проверка дистанции
                    if (timer.dimension.equals(currentDimension) && timer.pos.squaredDistanceTo(pos) < 1.0) {
                        if (timer.expirationTime > currentTime) {
                            timer.expirationTime = currentTime + (remainingNewSec * 1000L);
                        }
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    cachedTimers.add(new CachedTimer(pos, currentTime + (remainingNewSec * 1000L), currentDimension));
                }
            }
        }

        // Чистка кэша
        cachedTimers.removeIf(t -> t.expirationTime + 15000L <= currentTime);
        cachedTimers.sort(Comparator.comparingLong(t -> t.expirationTime));
    }

    @EventTarget
    public void onRender(EventRender2D e) {
        if (mc.world == null || mc.player == null || cachedTimers.isEmpty()) return;

        long currentTime = System.currentTimeMillis();
        Theme currentTheme = Vortex.getInstance().getThemeManager().getCurrentTheme();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        int renderedCount = 0;
        for (CachedTimer timer : cachedTimers) {
            if (!timer.dimension.equals(currentDimension) || renderedCount >= 5) continue;

            Vec3d proj = ProjectionUtil.worldSpaceToScreenSpace(timer.pos);
            if (proj.z <= 0.0D || proj.z >= 1.0D) continue;

            long remainingMs = timer.expirationTime - currentTime;
            boolean isExpired = remainingMs <= 0;
            long absMs = Math.abs(remainingMs);
            long totalSec = absMs / 1000L;
            long mins = totalSec / 60;
            long secs = totalSec % 60;

            // Форматирование текста
            String timeToRender = (isExpired ? "+" : "") +
                    (mins < 10 ? "0" : "") + mins + ":" +
                    (secs < 10 ? "0" : "") + secs;

            ColorRGBA finalColor = isExpired ? new ColorRGBA(255, 215, 0, 255) :
                    ColorUtil.interpolate(new ColorRGBA(255, 40, 40, 255), currentTheme.getColor(),
                            Math.min((float)remainingMs / 180000.0f, 1.0f));

            float fontSize = 8.5F;
            float textWidth = Fonts.REGULAR.getWidth(timeToRender, fontSize);
            float rectWidth = textWidth + 8.0F;
            float rectHeight = 12.0F;
            float rectX = (float) proj.x - (rectWidth / 2.0F);
            float rectY = (float) proj.y - 3.0F;

            // Рендер фона
            if (this.blur.isEnabled())
                DrawUtil.drawBlur(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight, 8.0f, BorderRadius.all(3.0f), ColorRGBA.WHITE);

            DrawUtil.drawRoundedRect(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight,
                    BorderRadius.all(3.0F), new ColorRGBA(0, 0, 0, 180));

            // Рендер текста
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F + 0.5F, rectY + 3.0F + 0.5F, new ColorRGBA(0, 0, 0, 150));
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F, rectY + 3.0F, finalColor);

            renderedCount++;
        }
    }

    private static class CachedTimer {
        Vec3d pos;
        long expirationTime;
        String dimension;

        CachedTimer(Vec3d pos, long expirationTime, String dimension) {
            this.pos = pos;
            this.expirationTime = expirationTime;
            this.dimension = dimension;
        }
    }
}
ss дай поцик
 
сливаю варден хелпер за 5 минут, работает отлично
добавлено сохранение в кэш, чтобы не было прогрузки в 2 чанка
WardenHelper:
Expand Collapse Copy
package AMNEZIADLCPRODUCTION;

import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.entity.Entity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.util.math.Vec3d;
import amezia.tech.amnezia;
import amezia.tech.base.events.impl.other.EventTick;
import amezia.tech.base.events.impl.render.EventRender2D;
import amezia.tech.base.font.Fonts;
import amezia.tech.base.theme.Theme;
import amezia.tech.client.modules.api.Category;
import amezia.tech.client.modules.api.Module;
import amezia.tech.client.modules.api.ModuleAnnotation;
import amezia.tech.client.modules.api.setting.impl.BooleanSetting;
import amezia.tech.utility.math.ProjectionUtil;
import amezia.tech.utility.render.display.base.BorderRadius;
import amezia.tech.utility.render.display.base.color.ColorRGBA;
import amezia.tech.utility.render.display.base.color.ColorUtil;
import amezia.tech.utility.render.display.shader.DrawUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@ModuleAnnotation(
        name = "WardenHelper",
        category = Category.RENDER,
        description = "Таймер сундуков Вардена"
)
public class WardenHelper extends Module {

    public static final WardenHelper INSTANCE = new WardenHelper();

    private static final Pattern TIME_PATTERN = Pattern.compile("(\\d{1,2}):(\\d{2})");
    private static final Pattern COLOR_CLEANER = Pattern.compile("§[0-9a-fk-or]");

    public final BooleanSetting hideOriginal = new BooleanSetting("Скрывать таймер", true);
    public final BooleanSetting blur = new BooleanSetting("Blur", true);

    private final List<CachedTimer> cachedTimers = new ArrayList<>();

    private WardenHelper() {
        getSettings().add(hideOriginal);
        getSettings().add(blur);
    }

    @Override
    public void onDisable() {
        cachedTimers.clear();
        super.onDisable();
    }

    @EventTarget
    public void onTick(EventTick e) {
        if (mc.world == null || mc.player == null) return;

        long currentTime = System.currentTimeMillis();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        // Сканирование сущностей
        for (Entity entity : mc.world.getEntities()) {
            if (!(entity instanceof ArmorStandEntity || entity instanceof DisplayEntity.TextDisplayEntity)) continue;

            String text = "";
            if (entity instanceof ArmorStandEntity) {
                if (entity.hasCustomName()) text = entity.getCustomName().getString();
            } else {
                DisplayEntity.TextDisplayEntity te = (DisplayEntity.TextDisplayEntity) entity;
                if (te.getText() != null) text = te.getText().getString();
            }

            if (text.isEmpty()) continue;

            // Очистка текста
            String cleanText = COLOR_CLEANER.matcher(text).replaceAll("");
            Matcher matcher = TIME_PATTERN.matcher(cleanText);

            if (matcher.find()) {
                if (hideOriginal.isEnabled()) {
                    entity.setInvisible(true);
                    if (entity instanceof ArmorStandEntity) entity.setCustomNameVisible(false);
                }

                int minutes = Integer.parseInt(matcher.group(1));
                int seconds = Integer.parseInt(matcher.group(2));
                long remainingNewSec = (minutes * 60L) + seconds;

                double offsetY = entity instanceof ArmorStandEntity ? 1.8D : 0.5D;
                Vec3d pos = new Vec3d(entity.getX(), entity.getY() + offsetY, entity.getZ());

                boolean found = false;
                for (CachedTimer timer : cachedTimers) {
                    // Проверка дистанции
                    if (timer.dimension.equals(currentDimension) && timer.pos.squaredDistanceTo(pos) < 1.0) {
                        if (timer.expirationTime > currentTime) {
                            timer.expirationTime = currentTime + (remainingNewSec * 1000L);
                        }
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    cachedTimers.add(new CachedTimer(pos, currentTime + (remainingNewSec * 1000L), currentDimension));
                }
            }
        }

        // Чистка кэша
        cachedTimers.removeIf(t -> t.expirationTime + 15000L <= currentTime);
        cachedTimers.sort(Comparator.comparingLong(t -> t.expirationTime));
    }

    @EventTarget
    public void onRender(EventRender2D e) {
        if (mc.world == null || mc.player == null || cachedTimers.isEmpty()) return;

        long currentTime = System.currentTimeMillis();
        Theme currentTheme = Vortex.getInstance().getThemeManager().getCurrentTheme();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        int renderedCount = 0;
        for (CachedTimer timer : cachedTimers) {
            if (!timer.dimension.equals(currentDimension) || renderedCount >= 5) continue;

            Vec3d proj = ProjectionUtil.worldSpaceToScreenSpace(timer.pos);
            if (proj.z <= 0.0D || proj.z >= 1.0D) continue;

            long remainingMs = timer.expirationTime - currentTime;
            boolean isExpired = remainingMs <= 0;
            long absMs = Math.abs(remainingMs);
            long totalSec = absMs / 1000L;
            long mins = totalSec / 60;
            long secs = totalSec % 60;

            // Форматирование текста
            String timeToRender = (isExpired ? "+" : "") +
                    (mins < 10 ? "0" : "") + mins + ":" +
                    (secs < 10 ? "0" : "") + secs;

            ColorRGBA finalColor = isExpired ? new ColorRGBA(255, 215, 0, 255) :
                    ColorUtil.interpolate(new ColorRGBA(255, 40, 40, 255), currentTheme.getColor(),
                            Math.min((float)remainingMs / 180000.0f, 1.0f));

            float fontSize = 8.5F;
            float textWidth = Fonts.REGULAR.getWidth(timeToRender, fontSize);
            float rectWidth = textWidth + 8.0F;
            float rectHeight = 12.0F;
            float rectX = (float) proj.x - (rectWidth / 2.0F);
            float rectY = (float) proj.y - 3.0F;

            // Рендер фона
            if (this.blur.isEnabled())
                DrawUtil.drawBlur(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight, 8.0f, BorderRadius.all(3.0f), ColorRGBA.WHITE);

            DrawUtil.drawRoundedRect(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight,
                    BorderRadius.all(3.0F), new ColorRGBA(0, 0, 0, 180));

            // Рендер текста
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F + 0.5F, rectY + 3.0F + 0.5F, new ColorRGBA(0, 0, 0, 150));
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F, rectY + 3.0F, finalColor);

            renderedCount++;
        }
    }

    private static class CachedTimer {
        Vec3d pos;
        long expirationTime;
        String dimension;

        CachedTimer(Vec3d pos, long expirationTime, String dimension) {
            this.pos = pos;
            this.expirationTime = expirationTime;
            this.dimension = dimension;
        }
    }
}
if (hideOriginal.isEnabled()) {
entity.setInvisible(true);
if (entity instanceof ArmorStandEntity) entity.setCustomNameVisible(false);
}

а это што мошна вапрос
 
if (hideOriginal.isEnabled()) {
entity.setInvisible(true);
if (entity instanceof ArmorStandEntity) entity.setCustomNameVisible(false);
}

а это што мошна вапрос
включена ли функция скрытия старого времени который висел над сундуками
на что ss давать?
там время, чем ближе тем краснее
фон обычный с блюром
показывает дополнительные 15 сек после окончания таймера золотым
 
сливаю варден хелпер за 5 минут, работает отлично
добавлено сохранение в кэш, чтобы не было прогрузки в 2 чанка
WardenHelper:
Expand Collapse Copy
package AMNEZIADLCPRODUCTION;

import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.entity.Entity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.util.math.Vec3d;
import amezia.tech.amnezia;
import amezia.tech.base.events.impl.other.EventTick;
import amezia.tech.base.events.impl.render.EventRender2D;
import amezia.tech.base.font.Fonts;
import amezia.tech.base.theme.Theme;
import amezia.tech.client.modules.api.Category;
import amezia.tech.client.modules.api.Module;
import amezia.tech.client.modules.api.ModuleAnnotation;
import amezia.tech.client.modules.api.setting.impl.BooleanSetting;
import amezia.tech.utility.math.ProjectionUtil;
import amezia.tech.utility.render.display.base.BorderRadius;
import amezia.tech.utility.render.display.base.color.ColorRGBA;
import amezia.tech.utility.render.display.base.color.ColorUtil;
import amezia.tech.utility.render.display.shader.DrawUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@ModuleAnnotation(
        name = "WardenHelper",
        category = Category.RENDER,
        description = "Таймер сундуков Вардена"
)
public class WardenHelper extends Module {

    public static final WardenHelper INSTANCE = new WardenHelper();

    private static final Pattern TIME_PATTERN = Pattern.compile("(\\d{1,2}):(\\d{2})");
    private static final Pattern COLOR_CLEANER = Pattern.compile("§[0-9a-fk-or]");

    public final BooleanSetting hideOriginal = new BooleanSetting("Скрывать таймер", true);
    public final BooleanSetting blur = new BooleanSetting("Blur", true);

    private final List<CachedTimer> cachedTimers = new ArrayList<>();

    private WardenHelper() {
        getSettings().add(hideOriginal);
        getSettings().add(blur);
    }

    @Override
    public void onDisable() {
        cachedTimers.clear();
        super.onDisable();
    }

    @EventTarget
    public void onTick(EventTick e) {
        if (mc.world == null || mc.player == null) return;

        long currentTime = System.currentTimeMillis();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        // Сканирование сущностей
        for (Entity entity : mc.world.getEntities()) {
            if (!(entity instanceof ArmorStandEntity || entity instanceof DisplayEntity.TextDisplayEntity)) continue;

            String text = "";
            if (entity instanceof ArmorStandEntity) {
                if (entity.hasCustomName()) text = entity.getCustomName().getString();
            } else {
                DisplayEntity.TextDisplayEntity te = (DisplayEntity.TextDisplayEntity) entity;
                if (te.getText() != null) text = te.getText().getString();
            }

            if (text.isEmpty()) continue;

            // Очистка текста
            String cleanText = COLOR_CLEANER.matcher(text).replaceAll("");
            Matcher matcher = TIME_PATTERN.matcher(cleanText);

            if (matcher.find()) {
                if (hideOriginal.isEnabled()) {
                    entity.setInvisible(true);
                    if (entity instanceof ArmorStandEntity) entity.setCustomNameVisible(false);
                }

                int minutes = Integer.parseInt(matcher.group(1));
                int seconds = Integer.parseInt(matcher.group(2));
                long remainingNewSec = (minutes * 60L) + seconds;

                double offsetY = entity instanceof ArmorStandEntity ? 1.8D : 0.5D;
                Vec3d pos = new Vec3d(entity.getX(), entity.getY() + offsetY, entity.getZ());

                boolean found = false;
                for (CachedTimer timer : cachedTimers) {
                    // Проверка дистанции
                    if (timer.dimension.equals(currentDimension) && timer.pos.squaredDistanceTo(pos) < 1.0) {
                        if (timer.expirationTime > currentTime) {
                            timer.expirationTime = currentTime + (remainingNewSec * 1000L);
                        }
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    cachedTimers.add(new CachedTimer(pos, currentTime + (remainingNewSec * 1000L), currentDimension));
                }
            }
        }

        // Чистка кэша
        cachedTimers.removeIf(t -> t.expirationTime + 15000L <= currentTime);
        cachedTimers.sort(Comparator.comparingLong(t -> t.expirationTime));
    }

    @EventTarget
    public void onRender(EventRender2D e) {
        if (mc.world == null || mc.player == null || cachedTimers.isEmpty()) return;

        long currentTime = System.currentTimeMillis();
        Theme currentTheme = Vortex.getInstance().getThemeManager().getCurrentTheme();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        int renderedCount = 0;
        for (CachedTimer timer : cachedTimers) {
            if (!timer.dimension.equals(currentDimension) || renderedCount >= 5) continue;

            Vec3d proj = ProjectionUtil.worldSpaceToScreenSpace(timer.pos);
            if (proj.z <= 0.0D || proj.z >= 1.0D) continue;

            long remainingMs = timer.expirationTime - currentTime;
            boolean isExpired = remainingMs <= 0;
            long absMs = Math.abs(remainingMs);
            long totalSec = absMs / 1000L;
            long mins = totalSec / 60;
            long secs = totalSec % 60;

            // Форматирование текста
            String timeToRender = (isExpired ? "+" : "") +
                    (mins < 10 ? "0" : "") + mins + ":" +
                    (secs < 10 ? "0" : "") + secs;

            ColorRGBA finalColor = isExpired ? new ColorRGBA(255, 215, 0, 255) :
                    ColorUtil.interpolate(new ColorRGBA(255, 40, 40, 255), currentTheme.getColor(),
                            Math.min((float)remainingMs / 180000.0f, 1.0f));

            float fontSize = 8.5F;
            float textWidth = Fonts.REGULAR.getWidth(timeToRender, fontSize);
            float rectWidth = textWidth + 8.0F;
            float rectHeight = 12.0F;
            float rectX = (float) proj.x - (rectWidth / 2.0F);
            float rectY = (float) proj.y - 3.0F;

            // Рендер фона
            if (this.blur.isEnabled())
                DrawUtil.drawBlur(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight, 8.0f, BorderRadius.all(3.0f), ColorRGBA.WHITE);

            DrawUtil.drawRoundedRect(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight,
                    BorderRadius.all(3.0F), new ColorRGBA(0, 0, 0, 180));

            // Рендер текста
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F + 0.5F, rectY + 3.0F + 0.5F, new ColorRGBA(0, 0, 0, 150));
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F, rectY + 3.0F, finalColor);

            renderedCount++;
        }
    }

    private static class CachedTimer {
        Vec3d pos;
        long expirationTime;
        String dimension;

        CachedTimer(Vec3d pos, long expirationTime, String dimension) {
            this.pos = pos;
            this.expirationTime = expirationTime;
            this.dimension = dimension;
        }
    }
}
/del no ss
 
сливаю варден хелпер за 5 минут, работает отлично
добавлено сохранение в кэш, чтобы не было прогрузки в 2 чанка
WardenHelper:
Expand Collapse Copy
package AMNEZIADLCPRODUCTION;

import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.entity.Entity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.util.math.Vec3d;
import amezia.tech.amnezia;
import amezia.tech.base.events.impl.other.EventTick;
import amezia.tech.base.events.impl.render.EventRender2D;
import amezia.tech.base.font.Fonts;
import amezia.tech.base.theme.Theme;
import amezia.tech.client.modules.api.Category;
import amezia.tech.client.modules.api.Module;
import amezia.tech.client.modules.api.ModuleAnnotation;
import amezia.tech.client.modules.api.setting.impl.BooleanSetting;
import amezia.tech.utility.math.ProjectionUtil;
import amezia.tech.utility.render.display.base.BorderRadius;
import amezia.tech.utility.render.display.base.color.ColorRGBA;
import amezia.tech.utility.render.display.base.color.ColorUtil;
import amezia.tech.utility.render.display.shader.DrawUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@ModuleAnnotation(
        name = "WardenHelper",
        category = Category.RENDER,
        description = "Таймер сундуков Вардена"
)
public class WardenHelper extends Module {

    public static final WardenHelper INSTANCE = new WardenHelper();

    private static final Pattern TIME_PATTERN = Pattern.compile("(\\d{1,2}):(\\d{2})");
    private static final Pattern COLOR_CLEANER = Pattern.compile("§[0-9a-fk-or]");

    public final BooleanSetting hideOriginal = new BooleanSetting("Скрывать таймер", true);
    public final BooleanSetting blur = new BooleanSetting("Blur", true);

    private final List<CachedTimer> cachedTimers = new ArrayList<>();

    private WardenHelper() {
        getSettings().add(hideOriginal);
        getSettings().add(blur);
    }

    @Override
    public void onDisable() {
        cachedTimers.clear();
        super.onDisable();
    }

    @EventTarget
    public void onTick(EventTick e) {
        if (mc.world == null || mc.player == null) return;

        long currentTime = System.currentTimeMillis();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        // Сканирование сущностей
        for (Entity entity : mc.world.getEntities()) {
            if (!(entity instanceof ArmorStandEntity || entity instanceof DisplayEntity.TextDisplayEntity)) continue;

            String text = "";
            if (entity instanceof ArmorStandEntity) {
                if (entity.hasCustomName()) text = entity.getCustomName().getString();
            } else {
                DisplayEntity.TextDisplayEntity te = (DisplayEntity.TextDisplayEntity) entity;
                if (te.getText() != null) text = te.getText().getString();
            }

            if (text.isEmpty()) continue;

            // Очистка текста
            String cleanText = COLOR_CLEANER.matcher(text).replaceAll("");
            Matcher matcher = TIME_PATTERN.matcher(cleanText);

            if (matcher.find()) {
                if (hideOriginal.isEnabled()) {
                    entity.setInvisible(true);
                    if (entity instanceof ArmorStandEntity) entity.setCustomNameVisible(false);
                }

                int minutes = Integer.parseInt(matcher.group(1));
                int seconds = Integer.parseInt(matcher.group(2));
                long remainingNewSec = (minutes * 60L) + seconds;

                double offsetY = entity instanceof ArmorStandEntity ? 1.8D : 0.5D;
                Vec3d pos = new Vec3d(entity.getX(), entity.getY() + offsetY, entity.getZ());

                boolean found = false;
                for (CachedTimer timer : cachedTimers) {
                    // Проверка дистанции
                    if (timer.dimension.equals(currentDimension) && timer.pos.squaredDistanceTo(pos) < 1.0) {
                        if (timer.expirationTime > currentTime) {
                            timer.expirationTime = currentTime + (remainingNewSec * 1000L);
                        }
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    cachedTimers.add(new CachedTimer(pos, currentTime + (remainingNewSec * 1000L), currentDimension));
                }
            }
        }

        // Чистка кэша
        cachedTimers.removeIf(t -> t.expirationTime + 15000L <= currentTime);
        cachedTimers.sort(Comparator.comparingLong(t -> t.expirationTime));
    }

    @EventTarget
    public void onRender(EventRender2D e) {
        if (mc.world == null || mc.player == null || cachedTimers.isEmpty()) return;

        long currentTime = System.currentTimeMillis();
        Theme currentTheme = Vortex.getInstance().getThemeManager().getCurrentTheme();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        int renderedCount = 0;
        for (CachedTimer timer : cachedTimers) {
            if (!timer.dimension.equals(currentDimension) || renderedCount >= 5) continue;

            Vec3d proj = ProjectionUtil.worldSpaceToScreenSpace(timer.pos);
            if (proj.z <= 0.0D || proj.z >= 1.0D) continue;

            long remainingMs = timer.expirationTime - currentTime;
            boolean isExpired = remainingMs <= 0;
            long absMs = Math.abs(remainingMs);
            long totalSec = absMs / 1000L;
            long mins = totalSec / 60;
            long secs = totalSec % 60;

            // Форматирование текста
            String timeToRender = (isExpired ? "+" : "") +
                    (mins < 10 ? "0" : "") + mins + ":" +
                    (secs < 10 ? "0" : "") + secs;

            ColorRGBA finalColor = isExpired ? new ColorRGBA(255, 215, 0, 255) :
                    ColorUtil.interpolate(new ColorRGBA(255, 40, 40, 255), currentTheme.getColor(),
                            Math.min((float)remainingMs / 180000.0f, 1.0f));

            float fontSize = 8.5F;
            float textWidth = Fonts.REGULAR.getWidth(timeToRender, fontSize);
            float rectWidth = textWidth + 8.0F;
            float rectHeight = 12.0F;
            float rectX = (float) proj.x - (rectWidth / 2.0F);
            float rectY = (float) proj.y - 3.0F;

            // Рендер фона
            if (this.blur.isEnabled())
                DrawUtil.drawBlur(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight, 8.0f, BorderRadius.all(3.0f), ColorRGBA.WHITE);

            DrawUtil.drawRoundedRect(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight,
                    BorderRadius.all(3.0F), new ColorRGBA(0, 0, 0, 180));

            // Рендер текста
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F + 0.5F, rectY + 3.0F + 0.5F, new ColorRGBA(0, 0, 0, 150));
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F, rectY + 3.0F, finalColor);

            renderedCount++;
        }
    }

    private static class CachedTimer {
        Vec3d pos;
        long expirationTime;
        String dimension;

        CachedTimer(Vec3d pos, long expirationTime, String dimension) {
            this.pos = pos;
            this.expirationTime = expirationTime;
            this.dimension = dimension;
        }
    }
}
так а нахуй я сливал давно очень
 
сливаю варден хелпер за 5 минут, работает отлично
добавлено сохранение в кэш, чтобы не было прогрузки в 2 чанка
WardenHelper:
Expand Collapse Copy
package AMNEZIADLCPRODUCTION;

import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.entity.Entity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.util.math.Vec3d;
import amezia.tech.amnezia;
import amezia.tech.base.events.impl.other.EventTick;
import amezia.tech.base.events.impl.render.EventRender2D;
import amezia.tech.base.font.Fonts;
import amezia.tech.base.theme.Theme;
import amezia.tech.client.modules.api.Category;
import amezia.tech.client.modules.api.Module;
import amezia.tech.client.modules.api.ModuleAnnotation;
import amezia.tech.client.modules.api.setting.impl.BooleanSetting;
import amezia.tech.utility.math.ProjectionUtil;
import amezia.tech.utility.render.display.base.BorderRadius;
import amezia.tech.utility.render.display.base.color.ColorRGBA;
import amezia.tech.utility.render.display.base.color.ColorUtil;
import amezia.tech.utility.render.display.shader.DrawUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@ModuleAnnotation(
        name = "WardenHelper",
        category = Category.RENDER,
        description = "Таймер сундуков Вардена"
)
public class WardenHelper extends Module {

    public static final WardenHelper INSTANCE = new WardenHelper();

    private static final Pattern TIME_PATTERN = Pattern.compile("(\\d{1,2}):(\\d{2})");
    private static final Pattern COLOR_CLEANER = Pattern.compile("§[0-9a-fk-or]");

    public final BooleanSetting hideOriginal = new BooleanSetting("Скрывать таймер", true);
    public final BooleanSetting blur = new BooleanSetting("Blur", true);

    private final List<CachedTimer> cachedTimers = new ArrayList<>();

    private WardenHelper() {
        getSettings().add(hideOriginal);
        getSettings().add(blur);
    }

    @Override
    public void onDisable() {
        cachedTimers.clear();
        super.onDisable();
    }

    @EventTarget
    public void onTick(EventTick e) {
        if (mc.world == null || mc.player == null) return;

        long currentTime = System.currentTimeMillis();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        // Сканирование сущностей
        for (Entity entity : mc.world.getEntities()) {
            if (!(entity instanceof ArmorStandEntity || entity instanceof DisplayEntity.TextDisplayEntity)) continue;

            String text = "";
            if (entity instanceof ArmorStandEntity) {
                if (entity.hasCustomName()) text = entity.getCustomName().getString();
            } else {
                DisplayEntity.TextDisplayEntity te = (DisplayEntity.TextDisplayEntity) entity;
                if (te.getText() != null) text = te.getText().getString();
            }

            if (text.isEmpty()) continue;

            // Очистка текста
            String cleanText = COLOR_CLEANER.matcher(text).replaceAll("");
            Matcher matcher = TIME_PATTERN.matcher(cleanText);

            if (matcher.find()) {
                if (hideOriginal.isEnabled()) {
                    entity.setInvisible(true);
                    if (entity instanceof ArmorStandEntity) entity.setCustomNameVisible(false);
                }

                int minutes = Integer.parseInt(matcher.group(1));
                int seconds = Integer.parseInt(matcher.group(2));
                long remainingNewSec = (minutes * 60L) + seconds;

                double offsetY = entity instanceof ArmorStandEntity ? 1.8D : 0.5D;
                Vec3d pos = new Vec3d(entity.getX(), entity.getY() + offsetY, entity.getZ());

                boolean found = false;
                for (CachedTimer timer : cachedTimers) {
                    // Проверка дистанции
                    if (timer.dimension.equals(currentDimension) && timer.pos.squaredDistanceTo(pos) < 1.0) {
                        if (timer.expirationTime > currentTime) {
                            timer.expirationTime = currentTime + (remainingNewSec * 1000L);
                        }
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    cachedTimers.add(new CachedTimer(pos, currentTime + (remainingNewSec * 1000L), currentDimension));
                }
            }
        }

        // Чистка кэша
        cachedTimers.removeIf(t -> t.expirationTime + 15000L <= currentTime);
        cachedTimers.sort(Comparator.comparingLong(t -> t.expirationTime));
    }

    @EventTarget
    public void onRender(EventRender2D e) {
        if (mc.world == null || mc.player == null || cachedTimers.isEmpty()) return;

        long currentTime = System.currentTimeMillis();
        Theme currentTheme = Vortex.getInstance().getThemeManager().getCurrentTheme();
        String currentDimension = mc.world.getRegistryKey().getValue().toString();

        int renderedCount = 0;
        for (CachedTimer timer : cachedTimers) {
            if (!timer.dimension.equals(currentDimension) || renderedCount >= 5) continue;

            Vec3d proj = ProjectionUtil.worldSpaceToScreenSpace(timer.pos);
            if (proj.z <= 0.0D || proj.z >= 1.0D) continue;

            long remainingMs = timer.expirationTime - currentTime;
            boolean isExpired = remainingMs <= 0;
            long absMs = Math.abs(remainingMs);
            long totalSec = absMs / 1000L;
            long mins = totalSec / 60;
            long secs = totalSec % 60;

            // Форматирование текста
            String timeToRender = (isExpired ? "+" : "") +
                    (mins < 10 ? "0" : "") + mins + ":" +
                    (secs < 10 ? "0" : "") + secs;

            ColorRGBA finalColor = isExpired ? new ColorRGBA(255, 215, 0, 255) :
                    ColorUtil.interpolate(new ColorRGBA(255, 40, 40, 255), currentTheme.getColor(),
                            Math.min((float)remainingMs / 180000.0f, 1.0f));

            float fontSize = 8.5F;
            float textWidth = Fonts.REGULAR.getWidth(timeToRender, fontSize);
            float rectWidth = textWidth + 8.0F;
            float rectHeight = 12.0F;
            float rectX = (float) proj.x - (rectWidth / 2.0F);
            float rectY = (float) proj.y - 3.0F;

            // Рендер фона
            if (this.blur.isEnabled())
                DrawUtil.drawBlur(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight, 8.0f, BorderRadius.all(3.0f), ColorRGBA.WHITE);

            DrawUtil.drawRoundedRect(e.getContext().getMatrices(), rectX, rectY, rectWidth, rectHeight,
                    BorderRadius.all(3.0F), new ColorRGBA(0, 0, 0, 180));

            // Рендер текста
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F + 0.5F, rectY + 3.0F + 0.5F, new ColorRGBA(0, 0, 0, 150));
            e.getContext().drawText(Fonts.REGULAR.getFont(fontSize), timeToRender, rectX + 4.0F, rectY + 3.0F, finalColor);

            renderedCount++;
        }
    }

    private static class CachedTimer {
        Vec3d pos;
        long expirationTime;
        String dimension;

        CachedTimer(Vec3d pos, long expirationTime, String dimension) {
            this.pos = pos;
            this.expirationTime = expirationTime;
            this.dimension = dimension;
        }
    }
}
в принципе достаточно хороший
 
Назад
Сверху Снизу