Визуальная часть MineViewer 3.1/Eva

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
14 Янв 2025
Сообщения
236
Реакции
0
Выберите загрузчик игры
  1. Прочие моды

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

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

Спасибо!

Увидел это в этой теме и решил улучшить *тык* (noad)

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



MineViewer:
Expand Collapse Copy
package alpha.night.modules.impl.player;

import alpha.night.events.EventDisplay;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.utils.render.color.ColorUtils;
import alpha.night.utils.render.rect.RenderUtility;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

import java.util.regex.Pattern;

@ModuleRegister(name = "MineViewer", category = Category.Player, desc = "Показывает информацию о шахте")
public class MineViewer extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    private static final Pattern TIME_FORMAT_PATTERN = Pattern.compile("^\\d{2}:\\d+.*$");
    private String lastFoundText = "";
    private String lastFoundLevelText = "";
    private String displayTimeText = "";
    private String displayLevelText = "";

    private float animationProgress = 0.0f;
    private boolean hasData = false;
    private long lastUpdateTime = System.currentTimeMillis();

    [USER=1474073]@Subscribe[/USER]
    public void onEvent(EventDisplay e) {
        if (e.getMatrixStack() == null || mc.getMainWindow() == null) {
            return;
        }

        String timeText = "";
        String levelText = "";
        boolean foundData = false;

        if (mc.world != null && mc.player != null) {
            Entity[] entities = findNearestEntities();
            if (entities[0] != null) {
                timeText = entities[0].getCustomName().getString();
                foundData = true;
            }
            if (entities[1] != null) {
                levelText = entities[1].getCustomName().getString();
                foundData = true;
            }
        }

        boolean newHasData = foundData && (!timeText.isEmpty() || !levelText.isEmpty());

        if (newHasData) {
            displayTimeText = timeText;
            displayLevelText = levelText;
        }

        hasData = newHasData;
        updateAnimation();

        if (animationProgress > 0.0f) {
            drawAutoMineInfo(e, displayTimeText, displayLevelText);
        }

        lastFoundText = timeText;
        lastFoundLevelText = levelText;
    }

    private void updateAnimation() {
        long currentTime = System.currentTimeMillis();
        float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
        lastUpdateTime = currentTime;

        float animationSpeed = hasData ? 3.0f : 1.5f;

        if (hasData) {
            animationProgress = Math.min(1.0f, animationProgress + deltaTime * animationSpeed);
        } else {
            animationProgress = Math.max(0.0f, animationProgress - deltaTime * animationSpeed);
        }
    }

    private float easeOutCubic(float t) {
        return 1 - (float) Math.pow(1 - t, 3);
    }

    private Entity[] findNearestEntities() {
        Entity nearestTimeEntity = null;
        Entity nearestLevelEntity = null;
        double minTimeDistance = Double.MAX_VALUE;
        double minLevelDistance = Double.MAX_VALUE;

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof ArmorStandEntity) || !entity.hasCustomName()) {
                continue;
            }

            ITextComponent customNameComponent = entity.getCustomName();
            if (customNameComponent == null) {
                continue;
            }

            String customName = customNameComponent.getString().toLowerCase();
            double distance = entity.getDistanceSq(
                    mc.player.getPosX(),
                    mc.player.getPosY(),
                    mc.player.getPosZ()
            );

            if (isValidTimeText(customName) && distance < minTimeDistance) {
                minTimeDistance = distance;
                nearestTimeEntity = entity;
            } else if (isValidLevelText(customName) && distance < minLevelDistance) {
                minLevelDistance = distance;
                nearestLevelEntity = entity;
            }
        }

        return new Entity[]{nearestTimeEntity, nearestLevelEntity};
    }

    private boolean isValidTimeText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        if (!TIME_FORMAT_PATTERN.matcher(text).matches()) {
            return false;
        }

        for (char c : text.toCharArray()) {
            if (c != ':' && Character.isLetter(c)) {
                return false;
            }
        }

        return true;
    }

    private boolean isValidLevelText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        return text.contains("обычный") || text.contains("мифический") || text.contains("легендарный") ||
                text.contains("обыч") || text.contains("миф") || text.contains("лег");
    }

    private void drawAutoMineInfo(EventDisplay e, String timeText, String levelText) {
        float easedProgress = easeOutCubic(animationProgress);

        float baseX = mc.getMainWindow().getScaledWidth() / 2.0f - 50;
        float baseYTime = mc.getMainWindow().getScaledHeight() - 62.0f;
        float baseYLevel = mc.getMainWindow().getScaledHeight() - 48.0f;

        float yOffset;
        if (hasData) {
            yOffset = (1.0f - easedProgress) * -40.0f;
        } else {
            yOffset = (1.0f - easedProgress) * -40.0f;
        }

        float fixedX = baseX;
        float yTime = baseYTime + yOffset;
        float yLevel = baseYLevel + yOffset;

        int alpha = (int) (255 * easedProgress);

        ResourceLocation pickaxeIcon = new ResourceLocation("minecraft", "textures/item/diamond_pickaxe.png");
        try {
            RenderUtility.drawImage(pickaxeIcon, fixedX + 37, yTime - 440, 40, 40, ColorUtils.rgba(255, 255, 255, alpha));
        } catch (Exception ex) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Icon error", fixedX, yTime - 10, ColorUtils.rgba(255, 0, 0, alpha));
        }

        if (!timeText.isEmpty()) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Авто Шахта: " + timeText, fixedX + 10, yTime - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
        if (!levelText.isEmpty()) {
            float levelXOffset = 1;
            String lowerLevelText = levelText.toLowerCase();
            if (lowerLevelText.contains("мифический") || lowerLevelText.contains("миф") ||
                    lowerLevelText.contains("легендарный") || lowerLevelText.contains("лег")) {
                levelXOffset = -7;
            } else if (lowerLevelText.contains("обычный") || lowerLevelText.contains("обыч")) {
                levelXOffset = 3;
            }
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "" + levelText, fixedX + levelXOffset, yLevel - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
    }
}
 
ох бля, щас кодер худаса будет плясать и перенеймить
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
а мою тему когда одобрят
ухх спс сс на ютубе ебаном 👍👍👍
 
Увидел это в этой теме и решил улучшить *тык* (noad)

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



MineViewer:
Expand Collapse Copy
package alpha.night.modules.impl.player;

import alpha.night.events.EventDisplay;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.utils.render.color.ColorUtils;
import alpha.night.utils.render.rect.RenderUtility;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

import java.util.regex.Pattern;

@ModuleRegister(name = "MineViewer", category = Category.Player, desc = "Показывает информацию о шахте")
public class MineViewer extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    private static final Pattern TIME_FORMAT_PATTERN = Pattern.compile("^\\d{2}:\\d+.*$");
    private String lastFoundText = "";
    private String lastFoundLevelText = "";
    private String displayTimeText = "";
    private String displayLevelText = "";

    private float animationProgress = 0.0f;
    private boolean hasData = false;
    private long lastUpdateTime = System.currentTimeMillis();

    [USER=1474073]@Subscribe[/USER]
    public void onEvent(EventDisplay e) {
        if (e.getMatrixStack() == null || mc.getMainWindow() == null) {
            return;
        }

        String timeText = "";
        String levelText = "";
        boolean foundData = false;

        if (mc.world != null && mc.player != null) {
            Entity[] entities = findNearestEntities();
            if (entities[0] != null) {
                timeText = entities[0].getCustomName().getString();
                foundData = true;
            }
            if (entities[1] != null) {
                levelText = entities[1].getCustomName().getString();
                foundData = true;
            }
        }

        boolean newHasData = foundData && (!timeText.isEmpty() || !levelText.isEmpty());

        if (newHasData) {
            displayTimeText = timeText;
            displayLevelText = levelText;
        }

        hasData = newHasData;
        updateAnimation();

        if (animationProgress > 0.0f) {
            drawAutoMineInfo(e, displayTimeText, displayLevelText);
        }

        lastFoundText = timeText;
        lastFoundLevelText = levelText;
    }

    private void updateAnimation() {
        long currentTime = System.currentTimeMillis();
        float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
        lastUpdateTime = currentTime;

        float animationSpeed = hasData ? 3.0f : 1.5f;

        if (hasData) {
            animationProgress = Math.min(1.0f, animationProgress + deltaTime * animationSpeed);
        } else {
            animationProgress = Math.max(0.0f, animationProgress - deltaTime * animationSpeed);
        }
    }

    private float easeOutCubic(float t) {
        return 1 - (float) Math.pow(1 - t, 3);
    }

    private Entity[] findNearestEntities() {
        Entity nearestTimeEntity = null;
        Entity nearestLevelEntity = null;
        double minTimeDistance = Double.MAX_VALUE;
        double minLevelDistance = Double.MAX_VALUE;

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof ArmorStandEntity) || !entity.hasCustomName()) {
                continue;
            }

            ITextComponent customNameComponent = entity.getCustomName();
            if (customNameComponent == null) {
                continue;
            }

            String customName = customNameComponent.getString().toLowerCase();
            double distance = entity.getDistanceSq(
                    mc.player.getPosX(),
                    mc.player.getPosY(),
                    mc.player.getPosZ()
            );

            if (isValidTimeText(customName) && distance < minTimeDistance) {
                minTimeDistance = distance;
                nearestTimeEntity = entity;
            } else if (isValidLevelText(customName) && distance < minLevelDistance) {
                minLevelDistance = distance;
                nearestLevelEntity = entity;
            }
        }

        return new Entity[]{nearestTimeEntity, nearestLevelEntity};
    }

    private boolean isValidTimeText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        if (!TIME_FORMAT_PATTERN.matcher(text).matches()) {
            return false;
        }

        for (char c : text.toCharArray()) {
            if (c != ':' && Character.isLetter(c)) {
                return false;
            }
        }

        return true;
    }

    private boolean isValidLevelText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        return text.contains("обычный") || text.contains("мифический") || text.contains("легендарный") ||
                text.contains("обыч") || text.contains("миф") || text.contains("лег");
    }

    private void drawAutoMineInfo(EventDisplay e, String timeText, String levelText) {
        float easedProgress = easeOutCubic(animationProgress);

        float baseX = mc.getMainWindow().getScaledWidth() / 2.0f - 50;
        float baseYTime = mc.getMainWindow().getScaledHeight() - 62.0f;
        float baseYLevel = mc.getMainWindow().getScaledHeight() - 48.0f;

        float yOffset;
        if (hasData) {
            yOffset = (1.0f - easedProgress) * -40.0f;
        } else {
            yOffset = (1.0f - easedProgress) * -40.0f;
        }

        float fixedX = baseX;
        float yTime = baseYTime + yOffset;
        float yLevel = baseYLevel + yOffset;

        int alpha = (int) (255 * easedProgress);

        ResourceLocation pickaxeIcon = new ResourceLocation("minecraft", "textures/item/diamond_pickaxe.png");
        try {
            RenderUtility.drawImage(pickaxeIcon, fixedX + 37, yTime - 440, 40, 40, ColorUtils.rgba(255, 255, 255, alpha));
        } catch (Exception ex) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Icon error", fixedX, yTime - 10, ColorUtils.rgba(255, 0, 0, alpha));
        }

        if (!timeText.isEmpty()) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Авто Шахта: " + timeText, fixedX + 10, yTime - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
        if (!levelText.isEmpty()) {
            float levelXOffset = 1;
            String lowerLevelText = levelText.toLowerCase();
            if (lowerLevelText.contains("мифический") || lowerLevelText.contains("миф") ||
                    lowerLevelText.contains("легендарный") || lowerLevelText.contains("лег")) {
                levelXOffset = -7;
            } else if (lowerLevelText.contains("обычный") || lowerLevelText.contains("обыч")) {
                levelXOffset = 3;
            }
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "" + levelText, fixedX + levelXOffset, yLevel - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
    }
}
+rep рил круто выглядит
 
+rep пределал вы нотофики как вы нурике
 
Увидел это в этой теме и решил улучшить *тык* (noad)

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



MineViewer:
Expand Collapse Copy
package alpha.night.modules.impl.player;

import alpha.night.events.EventDisplay;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.utils.render.color.ColorUtils;
import alpha.night.utils.render.rect.RenderUtility;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

import java.util.regex.Pattern;

@ModuleRegister(name = "MineViewer", category = Category.Player, desc = "Показывает информацию о шахте")
public class MineViewer extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    private static final Pattern TIME_FORMAT_PATTERN = Pattern.compile("^\\d{2}:\\d+.*$");
    private String lastFoundText = "";
    private String lastFoundLevelText = "";
    private String displayTimeText = "";
    private String displayLevelText = "";

    private float animationProgress = 0.0f;
    private boolean hasData = false;
    private long lastUpdateTime = System.currentTimeMillis();

    [USER=1474073]@Subscribe[/USER]
    public void onEvent(EventDisplay e) {
        if (e.getMatrixStack() == null || mc.getMainWindow() == null) {
            return;
        }

        String timeText = "";
        String levelText = "";
        boolean foundData = false;

        if (mc.world != null && mc.player != null) {
            Entity[] entities = findNearestEntities();
            if (entities[0] != null) {
                timeText = entities[0].getCustomName().getString();
                foundData = true;
            }
            if (entities[1] != null) {
                levelText = entities[1].getCustomName().getString();
                foundData = true;
            }
        }

        boolean newHasData = foundData && (!timeText.isEmpty() || !levelText.isEmpty());

        if (newHasData) {
            displayTimeText = timeText;
            displayLevelText = levelText;
        }

        hasData = newHasData;
        updateAnimation();

        if (animationProgress > 0.0f) {
            drawAutoMineInfo(e, displayTimeText, displayLevelText);
        }

        lastFoundText = timeText;
        lastFoundLevelText = levelText;
    }

    private void updateAnimation() {
        long currentTime = System.currentTimeMillis();
        float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
        lastUpdateTime = currentTime;

        float animationSpeed = hasData ? 3.0f : 1.5f;

        if (hasData) {
            animationProgress = Math.min(1.0f, animationProgress + deltaTime * animationSpeed);
        } else {
            animationProgress = Math.max(0.0f, animationProgress - deltaTime * animationSpeed);
        }
    }

    private float easeOutCubic(float t) {
        return 1 - (float) Math.pow(1 - t, 3);
    }

    private Entity[] findNearestEntities() {
        Entity nearestTimeEntity = null;
        Entity nearestLevelEntity = null;
        double minTimeDistance = Double.MAX_VALUE;
        double minLevelDistance = Double.MAX_VALUE;

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof ArmorStandEntity) || !entity.hasCustomName()) {
                continue;
            }

            ITextComponent customNameComponent = entity.getCustomName();
            if (customNameComponent == null) {
                continue;
            }

            String customName = customNameComponent.getString().toLowerCase();
            double distance = entity.getDistanceSq(
                    mc.player.getPosX(),
                    mc.player.getPosY(),
                    mc.player.getPosZ()
            );

            if (isValidTimeText(customName) && distance < minTimeDistance) {
                minTimeDistance = distance;
                nearestTimeEntity = entity;
            } else if (isValidLevelText(customName) && distance < minLevelDistance) {
                minLevelDistance = distance;
                nearestLevelEntity = entity;
            }
        }

        return new Entity[]{nearestTimeEntity, nearestLevelEntity};
    }

    private boolean isValidTimeText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        if (!TIME_FORMAT_PATTERN.matcher(text).matches()) {
            return false;
        }

        for (char c : text.toCharArray()) {
            if (c != ':' && Character.isLetter(c)) {
                return false;
            }
        }

        return true;
    }

    private boolean isValidLevelText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        return text.contains("обычный") || text.contains("мифический") || text.contains("легендарный") ||
                text.contains("обыч") || text.contains("миф") || text.contains("лег");
    }

    private void drawAutoMineInfo(EventDisplay e, String timeText, String levelText) {
        float easedProgress = easeOutCubic(animationProgress);

        float baseX = mc.getMainWindow().getScaledWidth() / 2.0f - 50;
        float baseYTime = mc.getMainWindow().getScaledHeight() - 62.0f;
        float baseYLevel = mc.getMainWindow().getScaledHeight() - 48.0f;

        float yOffset;
        if (hasData) {
            yOffset = (1.0f - easedProgress) * -40.0f;
        } else {
            yOffset = (1.0f - easedProgress) * -40.0f;
        }

        float fixedX = baseX;
        float yTime = baseYTime + yOffset;
        float yLevel = baseYLevel + yOffset;

        int alpha = (int) (255 * easedProgress);

        ResourceLocation pickaxeIcon = new ResourceLocation("minecraft", "textures/item/diamond_pickaxe.png");
        try {
            RenderUtility.drawImage(pickaxeIcon, fixedX + 37, yTime - 440, 40, 40, ColorUtils.rgba(255, 255, 255, alpha));
        } catch (Exception ex) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Icon error", fixedX, yTime - 10, ColorUtils.rgba(255, 0, 0, alpha));
        }

        if (!timeText.isEmpty()) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Авто Шахта: " + timeText, fixedX + 10, yTime - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
        if (!levelText.isEmpty()) {
            float levelXOffset = 1;
            String lowerLevelText = levelText.toLowerCase();
            if (lowerLevelText.contains("мифический") || lowerLevelText.contains("миф") ||
                    lowerLevelText.contains("легендарный") || lowerLevelText.contains("лег")) {
                levelXOffset = -7;
            } else if (lowerLevelText.contains("обычный") || lowerLevelText.contains("обыч")) {
                levelXOffset = 3;
            }
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "" + levelText, fixedX + levelXOffset, yLevel - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
    }
}
+rep ахуенно выглядит + не мозолит глаза
 
Увидел это в этой теме и решил улучшить *тык* (noad)

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



MineViewer:
Expand Collapse Copy
package alpha.night.modules.impl.player;

import alpha.night.events.EventDisplay;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.utils.render.color.ColorUtils;
import alpha.night.utils.render.rect.RenderUtility;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

import java.util.regex.Pattern;

@ModuleRegister(name = "MineViewer", category = Category.Player, desc = "Показывает информацию о шахте")
public class MineViewer extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    private static final Pattern TIME_FORMAT_PATTERN = Pattern.compile("^\\d{2}:\\d+.*$");
    private String lastFoundText = "";
    private String lastFoundLevelText = "";
    private String displayTimeText = "";
    private String displayLevelText = "";

    private float animationProgress = 0.0f;
    private boolean hasData = false;
    private long lastUpdateTime = System.currentTimeMillis();

    [USER=1474073]@Subscribe[/USER]
    public void onEvent(EventDisplay e) {
        if (e.getMatrixStack() == null || mc.getMainWindow() == null) {
            return;
        }

        String timeText = "";
        String levelText = "";
        boolean foundData = false;

        if (mc.world != null && mc.player != null) {
            Entity[] entities = findNearestEntities();
            if (entities[0] != null) {
                timeText = entities[0].getCustomName().getString();
                foundData = true;
            }
            if (entities[1] != null) {
                levelText = entities[1].getCustomName().getString();
                foundData = true;
            }
        }

        boolean newHasData = foundData && (!timeText.isEmpty() || !levelText.isEmpty());

        if (newHasData) {
            displayTimeText = timeText;
            displayLevelText = levelText;
        }

        hasData = newHasData;
        updateAnimation();

        if (animationProgress > 0.0f) {
            drawAutoMineInfo(e, displayTimeText, displayLevelText);
        }

        lastFoundText = timeText;
        lastFoundLevelText = levelText;
    }

    private void updateAnimation() {
        long currentTime = System.currentTimeMillis();
        float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
        lastUpdateTime = currentTime;

        float animationSpeed = hasData ? 3.0f : 1.5f;

        if (hasData) {
            animationProgress = Math.min(1.0f, animationProgress + deltaTime * animationSpeed);
        } else {
            animationProgress = Math.max(0.0f, animationProgress - deltaTime * animationSpeed);
        }
    }

    private float easeOutCubic(float t) {
        return 1 - (float) Math.pow(1 - t, 3);
    }

    private Entity[] findNearestEntities() {
        Entity nearestTimeEntity = null;
        Entity nearestLevelEntity = null;
        double minTimeDistance = Double.MAX_VALUE;
        double minLevelDistance = Double.MAX_VALUE;

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof ArmorStandEntity) || !entity.hasCustomName()) {
                continue;
            }

            ITextComponent customNameComponent = entity.getCustomName();
            if (customNameComponent == null) {
                continue;
            }

            String customName = customNameComponent.getString().toLowerCase();
            double distance = entity.getDistanceSq(
                    mc.player.getPosX(),
                    mc.player.getPosY(),
                    mc.player.getPosZ()
            );

            if (isValidTimeText(customName) && distance < minTimeDistance) {
                minTimeDistance = distance;
                nearestTimeEntity = entity;
            } else if (isValidLevelText(customName) && distance < minLevelDistance) {
                minLevelDistance = distance;
                nearestLevelEntity = entity;
            }
        }

        return new Entity[]{nearestTimeEntity, nearestLevelEntity};
    }

    private boolean isValidTimeText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        if (!TIME_FORMAT_PATTERN.matcher(text).matches()) {
            return false;
        }

        for (char c : text.toCharArray()) {
            if (c != ':' && Character.isLetter(c)) {
                return false;
            }
        }

        return true;
    }

    private boolean isValidLevelText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        return text.contains("обычный") || text.contains("мифический") || text.contains("легендарный") ||
                text.contains("обыч") || text.contains("миф") || text.contains("лег");
    }

    private void drawAutoMineInfo(EventDisplay e, String timeText, String levelText) {
        float easedProgress = easeOutCubic(animationProgress);

        float baseX = mc.getMainWindow().getScaledWidth() / 2.0f - 50;
        float baseYTime = mc.getMainWindow().getScaledHeight() - 62.0f;
        float baseYLevel = mc.getMainWindow().getScaledHeight() - 48.0f;

        float yOffset;
        if (hasData) {
            yOffset = (1.0f - easedProgress) * -40.0f;
        } else {
            yOffset = (1.0f - easedProgress) * -40.0f;
        }

        float fixedX = baseX;
        float yTime = baseYTime + yOffset;
        float yLevel = baseYLevel + yOffset;

        int alpha = (int) (255 * easedProgress);

        ResourceLocation pickaxeIcon = new ResourceLocation("minecraft", "textures/item/diamond_pickaxe.png");
        try {
            RenderUtility.drawImage(pickaxeIcon, fixedX + 37, yTime - 440, 40, 40, ColorUtils.rgba(255, 255, 255, alpha));
        } catch (Exception ex) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Icon error", fixedX, yTime - 10, ColorUtils.rgba(255, 0, 0, alpha));
        }

        if (!timeText.isEmpty()) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Авто Шахта: " + timeText, fixedX + 10, yTime - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
        if (!levelText.isEmpty()) {
            float levelXOffset = 1;
            String lowerLevelText = levelText.toLowerCase();
            if (lowerLevelText.contains("мифический") || lowerLevelText.contains("миф") ||
                    lowerLevelText.contains("легендарный") || lowerLevelText.contains("лег")) {
                levelXOffset = -7;
            } else if (lowerLevelText.contains("обычный") || lowerLevelText.contains("обыч")) {
                levelXOffset = 3;
            }
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "" + levelText, fixedX + levelXOffset, yLevel - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
    }
}
бля ты даже анимки добавил, имба
 
Увидел это в этой теме и решил улучшить *тык* (noad)

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



MineViewer:
Expand Collapse Copy
package alpha.night.modules.impl.player;

import alpha.night.events.EventDisplay;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.utils.render.color.ColorUtils;
import alpha.night.utils.render.rect.RenderUtility;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

import java.util.regex.Pattern;

@ModuleRegister(name = "MineViewer", category = Category.Player, desc = "Показывает информацию о шахте")
public class MineViewer extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    private static final Pattern TIME_FORMAT_PATTERN = Pattern.compile("^\\d{2}:\\d+.*$");
    private String lastFoundText = "";
    private String lastFoundLevelText = "";
    private String displayTimeText = "";
    private String displayLevelText = "";

    private float animationProgress = 0.0f;
    private boolean hasData = false;
    private long lastUpdateTime = System.currentTimeMillis();

    [USER=1474073]@Subscribe[/USER]
    public void onEvent(EventDisplay e) {
        if (e.getMatrixStack() == null || mc.getMainWindow() == null) {
            return;
        }

        String timeText = "";
        String levelText = "";
        boolean foundData = false;

        if (mc.world != null && mc.player != null) {
            Entity[] entities = findNearestEntities();
            if (entities[0] != null) {
                timeText = entities[0].getCustomName().getString();
                foundData = true;
            }
            if (entities[1] != null) {
                levelText = entities[1].getCustomName().getString();
                foundData = true;
            }
        }

        boolean newHasData = foundData && (!timeText.isEmpty() || !levelText.isEmpty());

        if (newHasData) {
            displayTimeText = timeText;
            displayLevelText = levelText;
        }

        hasData = newHasData;
        updateAnimation();

        if (animationProgress > 0.0f) {
            drawAutoMineInfo(e, displayTimeText, displayLevelText);
        }

        lastFoundText = timeText;
        lastFoundLevelText = levelText;
    }

    private void updateAnimation() {
        long currentTime = System.currentTimeMillis();
        float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
        lastUpdateTime = currentTime;

        float animationSpeed = hasData ? 3.0f : 1.5f;

        if (hasData) {
            animationProgress = Math.min(1.0f, animationProgress + deltaTime * animationSpeed);
        } else {
            animationProgress = Math.max(0.0f, animationProgress - deltaTime * animationSpeed);
        }
    }

    private float easeOutCubic(float t) {
        return 1 - (float) Math.pow(1 - t, 3);
    }

    private Entity[] findNearestEntities() {
        Entity nearestTimeEntity = null;
        Entity nearestLevelEntity = null;
        double minTimeDistance = Double.MAX_VALUE;
        double minLevelDistance = Double.MAX_VALUE;

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof ArmorStandEntity) || !entity.hasCustomName()) {
                continue;
            }

            ITextComponent customNameComponent = entity.getCustomName();
            if (customNameComponent == null) {
                continue;
            }

            String customName = customNameComponent.getString().toLowerCase();
            double distance = entity.getDistanceSq(
                    mc.player.getPosX(),
                    mc.player.getPosY(),
                    mc.player.getPosZ()
            );

            if (isValidTimeText(customName) && distance < minTimeDistance) {
                minTimeDistance = distance;
                nearestTimeEntity = entity;
            } else if (isValidLevelText(customName) && distance < minLevelDistance) {
                minLevelDistance = distance;
                nearestLevelEntity = entity;
            }
        }

        return new Entity[]{nearestTimeEntity, nearestLevelEntity};
    }

    private boolean isValidTimeText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        if (!TIME_FORMAT_PATTERN.matcher(text).matches()) {
            return false;
        }

        for (char c : text.toCharArray()) {
            if (c != ':' && Character.isLetter(c)) {
                return false;
            }
        }

        return true;
    }

    private boolean isValidLevelText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        return text.contains("обычный") || text.contains("мифический") || text.contains("легендарный") ||
                text.contains("обыч") || text.contains("миф") || text.contains("лег");
    }

    private void drawAutoMineInfo(EventDisplay e, String timeText, String levelText) {
        float easedProgress = easeOutCubic(animationProgress);

        float baseX = mc.getMainWindow().getScaledWidth() / 2.0f - 50;
        float baseYTime = mc.getMainWindow().getScaledHeight() - 62.0f;
        float baseYLevel = mc.getMainWindow().getScaledHeight() - 48.0f;

        float yOffset;
        if (hasData) {
            yOffset = (1.0f - easedProgress) * -40.0f;
        } else {
            yOffset = (1.0f - easedProgress) * -40.0f;
        }

        float fixedX = baseX;
        float yTime = baseYTime + yOffset;
        float yLevel = baseYLevel + yOffset;

        int alpha = (int) (255 * easedProgress);

        ResourceLocation pickaxeIcon = new ResourceLocation("minecraft", "textures/item/diamond_pickaxe.png");
        try {
            RenderUtility.drawImage(pickaxeIcon, fixedX + 37, yTime - 440, 40, 40, ColorUtils.rgba(255, 255, 255, alpha));
        } catch (Exception ex) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Icon error", fixedX, yTime - 10, ColorUtils.rgba(255, 0, 0, alpha));
        }

        if (!timeText.isEmpty()) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Авто Шахта: " + timeText, fixedX + 10, yTime - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
        if (!levelText.isEmpty()) {
            float levelXOffset = 1;
            String lowerLevelText = levelText.toLowerCase();
            if (lowerLevelText.contains("мифический") || lowerLevelText.contains("миф") ||
                    lowerLevelText.contains("легендарный") || lowerLevelText.contains("лег")) {
                levelXOffset = -7;
            } else if (lowerLevelText.contains("обычный") || lowerLevelText.contains("обыч")) {
                levelXOffset = 3;
            }
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "" + levelText, fixedX + levelXOffset, yLevel - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
    }
}
идея - топ
реализация - хуйня
как по мне тебе стоит нормальным фонт рендерером рендерить текст и сделать обычную альфа анимку
 
идея - топ
реализация - хуйня
как по мне тебе стоит нормальным фонт рендерером рендерить текст и сделать обычную альфа анимку
это ты написал не так обидно спасибо что указал на ошибки
 
Увидел это в этой теме и решил улучшить *тык* (noad)

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



MineViewer:
Expand Collapse Copy
package alpha.night.modules.impl.player;

import alpha.night.events.EventDisplay;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.utils.render.color.ColorUtils;
import alpha.night.utils.render.rect.RenderUtility;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

import java.util.regex.Pattern;

@ModuleRegister(name = "MineViewer", category = Category.Player, desc = "Показывает информацию о шахте")
public class MineViewer extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    private static final Pattern TIME_FORMAT_PATTERN = Pattern.compile("^\\d{2}:\\d+.*$");
    private String lastFoundText = "";
    private String lastFoundLevelText = "";
    private String displayTimeText = "";
    private String displayLevelText = "";

    private float animationProgress = 0.0f;
    private boolean hasData = false;
    private long lastUpdateTime = System.currentTimeMillis();

    [USER=1474073]@Subscribe[/USER]
    public void onEvent(EventDisplay e) {
        if (e.getMatrixStack() == null || mc.getMainWindow() == null) {
            return;
        }

        String timeText = "";
        String levelText = "";
        boolean foundData = false;

        if (mc.world != null && mc.player != null) {
            Entity[] entities = findNearestEntities();
            if (entities[0] != null) {
                timeText = entities[0].getCustomName().getString();
                foundData = true;
            }
            if (entities[1] != null) {
                levelText = entities[1].getCustomName().getString();
                foundData = true;
            }
        }

        boolean newHasData = foundData && (!timeText.isEmpty() || !levelText.isEmpty());

        if (newHasData) {
            displayTimeText = timeText;
            displayLevelText = levelText;
        }

        hasData = newHasData;
        updateAnimation();

        if (animationProgress > 0.0f) {
            drawAutoMineInfo(e, displayTimeText, displayLevelText);
        }

        lastFoundText = timeText;
        lastFoundLevelText = levelText;
    }

    private void updateAnimation() {
        long currentTime = System.currentTimeMillis();
        float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
        lastUpdateTime = currentTime;

        float animationSpeed = hasData ? 3.0f : 1.5f;

        if (hasData) {
            animationProgress = Math.min(1.0f, animationProgress + deltaTime * animationSpeed);
        } else {
            animationProgress = Math.max(0.0f, animationProgress - deltaTime * animationSpeed);
        }
    }

    private float easeOutCubic(float t) {
        return 1 - (float) Math.pow(1 - t, 3);
    }

    private Entity[] findNearestEntities() {
        Entity nearestTimeEntity = null;
        Entity nearestLevelEntity = null;
        double minTimeDistance = Double.MAX_VALUE;
        double minLevelDistance = Double.MAX_VALUE;

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof ArmorStandEntity) || !entity.hasCustomName()) {
                continue;
            }

            ITextComponent customNameComponent = entity.getCustomName();
            if (customNameComponent == null) {
                continue;
            }

            String customName = customNameComponent.getString().toLowerCase();
            double distance = entity.getDistanceSq(
                    mc.player.getPosX(),
                    mc.player.getPosY(),
                    mc.player.getPosZ()
            );

            if (isValidTimeText(customName) && distance < minTimeDistance) {
                minTimeDistance = distance;
                nearestTimeEntity = entity;
            } else if (isValidLevelText(customName) && distance < minLevelDistance) {
                minLevelDistance = distance;
                nearestLevelEntity = entity;
            }
        }

        return new Entity[]{nearestTimeEntity, nearestLevelEntity};
    }

    private boolean isValidTimeText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        if (!TIME_FORMAT_PATTERN.matcher(text).matches()) {
            return false;
        }

        for (char c : text.toCharArray()) {
            if (c != ':' && Character.isLetter(c)) {
                return false;
            }
        }

        return true;
    }

    private boolean isValidLevelText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        return text.contains("обычный") || text.contains("мифический") || text.contains("легендарный") ||
                text.contains("обыч") || text.contains("миф") || text.contains("лег");
    }

    private void drawAutoMineInfo(EventDisplay e, String timeText, String levelText) {
        float easedProgress = easeOutCubic(animationProgress);

        float baseX = mc.getMainWindow().getScaledWidth() / 2.0f - 50;
        float baseYTime = mc.getMainWindow().getScaledHeight() - 62.0f;
        float baseYLevel = mc.getMainWindow().getScaledHeight() - 48.0f;

        float yOffset;
        if (hasData) {
            yOffset = (1.0f - easedProgress) * -40.0f;
        } else {
            yOffset = (1.0f - easedProgress) * -40.0f;
        }

        float fixedX = baseX;
        float yTime = baseYTime + yOffset;
        float yLevel = baseYLevel + yOffset;

        int alpha = (int) (255 * easedProgress);

        ResourceLocation pickaxeIcon = new ResourceLocation("minecraft", "textures/item/diamond_pickaxe.png");
        try {
            RenderUtility.drawImage(pickaxeIcon, fixedX + 37, yTime - 440, 40, 40, ColorUtils.rgba(255, 255, 255, alpha));
        } catch (Exception ex) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Icon error", fixedX, yTime - 10, ColorUtils.rgba(255, 0, 0, alpha));
        }

        if (!timeText.isEmpty()) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Авто Шахта: " + timeText, fixedX + 10, yTime - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
        if (!levelText.isEmpty()) {
            float levelXOffset = 1;
            String lowerLevelText = levelText.toLowerCase();
            if (lowerLevelText.contains("мифический") || lowerLevelText.contains("миф") ||
                    lowerLevelText.contains("легендарный") || lowerLevelText.contains("лег")) {
                levelXOffset = -7;
            } else if (lowerLevelText.contains("обычный") || lowerLevelText.contains("обыч")) {
                levelXOffset = 3;
            }
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "" + levelText, fixedX + levelXOffset, yLevel - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
    }
}
паста найта
 
Увидел это в этой теме и решил улучшить *тык* (noad)

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



MineViewer:
Expand Collapse Copy
package alpha.night.modules.impl.player;

import alpha.night.events.EventDisplay;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.utils.render.color.ColorUtils;
import alpha.night.utils.render.rect.RenderUtility;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

import java.util.regex.Pattern;

@ModuleRegister(name = "MineViewer", category = Category.Player, desc = "Показывает информацию о шахте")
public class MineViewer extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    private static final Pattern TIME_FORMAT_PATTERN = Pattern.compile("^\\d{2}:\\d+.*$");
    private String lastFoundText = "";
    private String lastFoundLevelText = "";
    private String displayTimeText = "";
    private String displayLevelText = "";

    private float animationProgress = 0.0f;
    private boolean hasData = false;
    private long lastUpdateTime = System.currentTimeMillis();

    [USER=1474073]@Subscribe[/USER]
    public void onEvent(EventDisplay e) {
        if (e.getMatrixStack() == null || mc.getMainWindow() == null) {
            return;
        }

        String timeText = "";
        String levelText = "";
        boolean foundData = false;

        if (mc.world != null && mc.player != null) {
            Entity[] entities = findNearestEntities();
            if (entities[0] != null) {
                timeText = entities[0].getCustomName().getString();
                foundData = true;
            }
            if (entities[1] != null) {
                levelText = entities[1].getCustomName().getString();
                foundData = true;
            }
        }

        boolean newHasData = foundData && (!timeText.isEmpty() || !levelText.isEmpty());

        if (newHasData) {
            displayTimeText = timeText;
            displayLevelText = levelText;
        }

        hasData = newHasData;
        updateAnimation();

        if (animationProgress > 0.0f) {
            drawAutoMineInfo(e, displayTimeText, displayLevelText);
        }

        lastFoundText = timeText;
        lastFoundLevelText = levelText;
    }

    private void updateAnimation() {
        long currentTime = System.currentTimeMillis();
        float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
        lastUpdateTime = currentTime;

        float animationSpeed = hasData ? 3.0f : 1.5f;

        if (hasData) {
            animationProgress = Math.min(1.0f, animationProgress + deltaTime * animationSpeed);
        } else {
            animationProgress = Math.max(0.0f, animationProgress - deltaTime * animationSpeed);
        }
    }

    private float easeOutCubic(float t) {
        return 1 - (float) Math.pow(1 - t, 3);
    }

    private Entity[] findNearestEntities() {
        Entity nearestTimeEntity = null;
        Entity nearestLevelEntity = null;
        double minTimeDistance = Double.MAX_VALUE;
        double minLevelDistance = Double.MAX_VALUE;

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof ArmorStandEntity) || !entity.hasCustomName()) {
                continue;
            }

            ITextComponent customNameComponent = entity.getCustomName();
            if (customNameComponent == null) {
                continue;
            }

            String customName = customNameComponent.getString().toLowerCase();
            double distance = entity.getDistanceSq(
                    mc.player.getPosX(),
                    mc.player.getPosY(),
                    mc.player.getPosZ()
            );

            if (isValidTimeText(customName) && distance < minTimeDistance) {
                minTimeDistance = distance;
                nearestTimeEntity = entity;
            } else if (isValidLevelText(customName) && distance < minLevelDistance) {
                minLevelDistance = distance;
                nearestLevelEntity = entity;
            }
        }

        return new Entity[]{nearestTimeEntity, nearestLevelEntity};
    }

    private boolean isValidTimeText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        if (!TIME_FORMAT_PATTERN.matcher(text).matches()) {
            return false;
        }

        for (char c : text.toCharArray()) {
            if (c != ':' && Character.isLetter(c)) {
                return false;
            }
        }

        return true;
    }

    private boolean isValidLevelText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        return text.contains("обычный") || text.contains("мифический") || text.contains("легендарный") ||
                text.contains("обыч") || text.contains("миф") || text.contains("лег");
    }

    private void drawAutoMineInfo(EventDisplay e, String timeText, String levelText) {
        float easedProgress = easeOutCubic(animationProgress);

        float baseX = mc.getMainWindow().getScaledWidth() / 2.0f - 50;
        float baseYTime = mc.getMainWindow().getScaledHeight() - 62.0f;
        float baseYLevel = mc.getMainWindow().getScaledHeight() - 48.0f;

        float yOffset;
        if (hasData) {
            yOffset = (1.0f - easedProgress) * -40.0f;
        } else {
            yOffset = (1.0f - easedProgress) * -40.0f;
        }

        float fixedX = baseX;
        float yTime = baseYTime + yOffset;
        float yLevel = baseYLevel + yOffset;

        int alpha = (int) (255 * easedProgress);

        ResourceLocation pickaxeIcon = new ResourceLocation("minecraft", "textures/item/diamond_pickaxe.png");
        try {
            RenderUtility.drawImage(pickaxeIcon, fixedX + 37, yTime - 440, 40, 40, ColorUtils.rgba(255, 255, 255, alpha));
        } catch (Exception ex) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Icon error", fixedX, yTime - 10, ColorUtils.rgba(255, 0, 0, alpha));
        }

        if (!timeText.isEmpty()) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Авто Шахта: " + timeText, fixedX + 10, yTime - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
        if (!levelText.isEmpty()) {
            float levelXOffset = 1;
            String lowerLevelText = levelText.toLowerCase();
            if (lowerLevelText.contains("мифический") || lowerLevelText.contains("миф") ||
                    lowerLevelText.contains("легендарный") || lowerLevelText.contains("лег")) {
                levelXOffset = -7;
            } else if (lowerLevelText.contains("обычный") || lowerLevelText.contains("обыч")) {
                levelXOffset = 3;
            }
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "" + levelText, fixedX + levelXOffset, yLevel - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
    }
}
+rep выглядит ахуенно
 
Увидел это в этой теме и решил улучшить *тык* (noad)

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



MineViewer:
Expand Collapse Copy
package alpha.night.modules.impl.player;

import alpha.night.events.EventDisplay;
import alpha.night.modules.api.Category;
import alpha.night.modules.api.Module;
import alpha.night.modules.api.ModuleRegister;
import alpha.night.utils.render.color.ColorUtils;
import alpha.night.utils.render.rect.RenderUtility;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

import java.util.regex.Pattern;

@ModuleRegister(name = "MineViewer", category = Category.Player, desc = "Показывает информацию о шахте")
public class MineViewer extends Module {
    private final Minecraft mc = Minecraft.getInstance();
    private static final Pattern TIME_FORMAT_PATTERN = Pattern.compile("^\\d{2}:\\d+.*$");
    private String lastFoundText = "";
    private String lastFoundLevelText = "";
    private String displayTimeText = "";
    private String displayLevelText = "";

    private float animationProgress = 0.0f;
    private boolean hasData = false;
    private long lastUpdateTime = System.currentTimeMillis();

    [USER=1474073]@Subscribe[/USER]
    public void onEvent(EventDisplay e) {
        if (e.getMatrixStack() == null || mc.getMainWindow() == null) {
            return;
        }

        String timeText = "";
        String levelText = "";
        boolean foundData = false;

        if (mc.world != null && mc.player != null) {
            Entity[] entities = findNearestEntities();
            if (entities[0] != null) {
                timeText = entities[0].getCustomName().getString();
                foundData = true;
            }
            if (entities[1] != null) {
                levelText = entities[1].getCustomName().getString();
                foundData = true;
            }
        }

        boolean newHasData = foundData && (!timeText.isEmpty() || !levelText.isEmpty());

        if (newHasData) {
            displayTimeText = timeText;
            displayLevelText = levelText;
        }

        hasData = newHasData;
        updateAnimation();

        if (animationProgress > 0.0f) {
            drawAutoMineInfo(e, displayTimeText, displayLevelText);
        }

        lastFoundText = timeText;
        lastFoundLevelText = levelText;
    }

    private void updateAnimation() {
        long currentTime = System.currentTimeMillis();
        float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
        lastUpdateTime = currentTime;

        float animationSpeed = hasData ? 3.0f : 1.5f;

        if (hasData) {
            animationProgress = Math.min(1.0f, animationProgress + deltaTime * animationSpeed);
        } else {
            animationProgress = Math.max(0.0f, animationProgress - deltaTime * animationSpeed);
        }
    }

    private float easeOutCubic(float t) {
        return 1 - (float) Math.pow(1 - t, 3);
    }

    private Entity[] findNearestEntities() {
        Entity nearestTimeEntity = null;
        Entity nearestLevelEntity = null;
        double minTimeDistance = Double.MAX_VALUE;
        double minLevelDistance = Double.MAX_VALUE;

        for (Entity entity : mc.world.getAllEntities()) {
            if (!(entity instanceof ArmorStandEntity) || !entity.hasCustomName()) {
                continue;
            }

            ITextComponent customNameComponent = entity.getCustomName();
            if (customNameComponent == null) {
                continue;
            }

            String customName = customNameComponent.getString().toLowerCase();
            double distance = entity.getDistanceSq(
                    mc.player.getPosX(),
                    mc.player.getPosY(),
                    mc.player.getPosZ()
            );

            if (isValidTimeText(customName) && distance < minTimeDistance) {
                minTimeDistance = distance;
                nearestTimeEntity = entity;
            } else if (isValidLevelText(customName) && distance < minLevelDistance) {
                minLevelDistance = distance;
                nearestLevelEntity = entity;
            }
        }

        return new Entity[]{nearestTimeEntity, nearestLevelEntity};
    }

    private boolean isValidTimeText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        if (!TIME_FORMAT_PATTERN.matcher(text).matches()) {
            return false;
        }

        for (char c : text.toCharArray()) {
            if (c != ':' && Character.isLetter(c)) {
                return false;
            }
        }

        return true;
    }

    private boolean isValidLevelText(String text) {
        if (text == null || text.isEmpty()) {
            return false;
        }

        return text.contains("обычный") || text.contains("мифический") || text.contains("легендарный") ||
                text.contains("обыч") || text.contains("миф") || text.contains("лег");
    }

    private void drawAutoMineInfo(EventDisplay e, String timeText, String levelText) {
        float easedProgress = easeOutCubic(animationProgress);

        float baseX = mc.getMainWindow().getScaledWidth() / 2.0f - 50;
        float baseYTime = mc.getMainWindow().getScaledHeight() - 62.0f;
        float baseYLevel = mc.getMainWindow().getScaledHeight() - 48.0f;

        float yOffset;
        if (hasData) {
            yOffset = (1.0f - easedProgress) * -40.0f;
        } else {
            yOffset = (1.0f - easedProgress) * -40.0f;
        }

        float fixedX = baseX;
        float yTime = baseYTime + yOffset;
        float yLevel = baseYLevel + yOffset;

        int alpha = (int) (255 * easedProgress);

        ResourceLocation pickaxeIcon = new ResourceLocation("minecraft", "textures/item/diamond_pickaxe.png");
        try {
            RenderUtility.drawImage(pickaxeIcon, fixedX + 37, yTime - 440, 40, 40, ColorUtils.rgba(255, 255, 255, alpha));
        } catch (Exception ex) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Icon error", fixedX, yTime - 10, ColorUtils.rgba(255, 0, 0, alpha));
        }

        if (!timeText.isEmpty()) {
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "Авто Шахта: " + timeText, fixedX + 10, yTime - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
        if (!levelText.isEmpty()) {
            float levelXOffset = 1;
            String lowerLevelText = levelText.toLowerCase();
            if (lowerLevelText.contains("мифический") || lowerLevelText.contains("миф") ||
                    lowerLevelText.contains("легендарный") || lowerLevelText.contains("лег")) {
                levelXOffset = -7;
            } else if (lowerLevelText.contains("обычный") || lowerLevelText.contains("обыч")) {
                levelXOffset = 3;
            }
            mc.fontRenderer.drawStringWithShadow(e.getMatrixStack(), "" + levelText, fixedX + levelXOffset, yLevel - 395, ColorUtils.rgba(255, 255, 255, alpha));
        }
    }
}
прикольно выглядит но в свой софт я обратно это не буду пастить
 
Назад
Сверху Снизу