• Ну и что вы думаете? Мы взяли и создали свой собственный чат, с блекджеком и шлюхами, теперь все легенды в одном месте: даже те 1000 человек, которых мы забанили в старом чате 🫡 Будем публиковать там очень интересные подробности нового дизайна форума, oh yeah

    Вступай и становись легендой, пока это не стало поздно: жмякай на меня, ток не сильно(

Часть функционала ESP | Forge 1.16.5 Ready

Начинающий
Статус
Оффлайн
Регистрация
23 Дек 2024
Сообщения
71
Реакции[?]
1
Поинты[?]
1K

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

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

Спасибо!

Второй подарочек всем форж пастерам на новый год.

Надеюсь после этого поста эра
закончится.

Math методы и методы получения цвета бежим пастить с SexPensive, все написано под них.
Будут вопросы - мне похуй спрашивайте

PlayerEsp:
public class PlayerEsp extends Feature {

    /**
      * ═══════════════════════════════════════════
      * "Сто лет не пастил
      *  Бля пишу уже несколько месяцев селфкод
      *  и блевать хочется"
      *                          - shaoriy
      * ═══════════════════════════════════════════
      */

    private final HashMap<Entity, Vector4f> positions = new HashMap<>();
  
    BooleanSetting boxes = ...;
    BooleanSetting hpLine = ...;
    BooleanSetting hpTextBool = ...;
    BooleanSetting effects = ...;
    BooleanSetting enchantments = ...;
    BooleanSetting self = ...;
  
    public PlayerEsp() {
        super("PlayerEsp", Category.Visuals);
    }
  
    @SubscribeEvent
    public void onDisplay(RenderGameOverlayEvent.Pre e) {
        if (mc.level == null || e.getType() != RenderGameOverlayEvent.ElementType.ALL) {
            return;
        }

        positions.clear();

        // Ну тут немного я под спайсом был, привыкайте
        Vector4f colors = new Vector4f(getColor(0, 1), getColor(90, 1), getColor(180, 1), getColor(270, 1));
        Vector4f friendColors = new Vector4f(getColorFr(0, 1), getColorFr(90, 1), getColorFr(180, 1), getColorFr(270, 1));

        for (Entity entity : mc.level.players()) {

            if ((!isValid(entity)) ||
                    (!(entity instanceof PlayerEntity || entity instanceof ItemEntity)) ||
                    (entity == mc.player && ((mc.options.getCameraType() == PointOfView.FIRST_PERSON) || !self.getValue()))) continue;

            double x = MathUtil.interpolate(entity.getX(), entity.xOld, e.getPartialTicks());
            double y = MathUtil.interpolate(entity.getY(), entity.yOld, e.getPartialTicks());
            double z = MathUtil.interpolate(entity.getZ(), entity.zOld, e.getPartialTicks());

            Vector3d size = new Vector3d(
                    entity.getBoundingBox().maxX - entity.getBoundingBox().minX,
                    entity.getBoundingBox().maxY - entity.getBoundingBox().minY,
                    entity.getBoundingBox().maxZ - entity.getBoundingBox().minZ
            );

            AxisAlignedBB aabb = new AxisAlignedBB(
                    x - size.x / 2f,
                    y,
                    z - size.z / 2f,
                    x + size.x / 2f,
                    y + size.y,
                    z + size.z / 2f
            );

            Vector4f position = null;
            for (int i = 0; i < 8; i++) {
              
                Vector2f vector = ProjectionUtil.project(
                        i % 2 == 0 ? aabb.minX : aabb.maxX,
                        (i / 2) % 2 == 0 ? aabb.minY : aabb.maxY,
                        (i / 4) % 2 == 0 ? aabb.minZ : aabb.maxZ);
              
                if (position == null) {
                    position = new Vector4f(vector.x, vector.y, vector.x, vector.y);
                } else {
                    position.setX(Math.min(vector.x, position.x()));
                    position.setY(Math.min(vector.y, position.y()));
                    position.setZ(Math.max(vector.x, position.z()));
                    position.setW(Math.max(vector.y, position.w()));
                }
            }
            positions.put(entity, position);
        }

        RenderSystem.enableBlend();
        RenderSystem.disableTexture();
        RenderSystem.defaultBlendFunc();
        RenderSystem.shadeModel(7425);
        buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Vector4f position = entry.getValue();
            if (entry.getKey() instanceof LivingEntity) {
                LivingEntity entity = (LivingEntity) entry.getKey();
                if (boxes.getValue()) {
                    DrawHelper.drawBox(position.x() - 0.5f, position.y() - 0.5f, position.z() + 0.5f, position.w() + 0.5f, 2, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawBoxTest(position.x(), position.y(), position.z(), position.w(), 1, FriendManager.isFriend(entity.getName().getString()) ? friendColors : colors);
                }

                float hpOffset = 5f;
                float out = 0.5f;
                if (hpLine.getValue()) {
                    DrawHelper.drawRectBuilding(position.x() - hpOffset - out, position.y() - out, position.x() - hpOffset + 1 + out, position.w() + out, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawRectBuilding(position.x() - hpOffset, position.y(), position.x() - hpOffset + 1, position.w(), ColorUtil.rgba(0, 0, 0, 128));

                    float hp = entity.getHealth();
                    float maxHp = entity.getMaxHealth();

                    DrawHelper.drawMCVerticalBuilding(
                            position.x() - hpOffset,
                            position.y() + (position.w() - position.y()) * (1 - MathHelper.clamp(hp / maxHp, 0, 1)),
                            position.x() - hpOffset + 1,
                            position.w(),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.w() : colors.w()),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.x() : colors.x())
                    );
                }
            }
        }

        Tessellator.getInstance().end();
        RenderSystem.shadeModel(7424);
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Entity entity = entry.getKey();
            if (entity instanceof LivingEntity) {
                LivingEntity living = (LivingEntity) entity;

                float hp = living.getHealth();
                float maxHp = living.getMaxHealth();

                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                String hpText = (int) hp + "HP";
                float hpWidth = mc.font.width(hpText);
                float hpPercent = MathHelper.clamp(hp / maxHp, 0, 1);
                float hpPosY = position.y() + (position.w() - position.y()) * (1 - hpPercent);
                float hpOffset = 6f + (hpText.length() > 4 ? (hpText.length() - 4) * 2 : 0);

                if (hpTextBool.getValue()) {
                    GL11.glPushMatrix();
                    float textWidth = mc.font.width(hpText);
                    float rightAlignedX = position.x() - hpWidth - hpOffset + 5;

                    glCenteredScale(rightAlignedX, hpPosY - 1, textWidth, 10, 0.5f);
                    mc.font.draw(e.getMatrixStack(), hpText, rightAlignedX, hpPosY - 2, -1);
                    GL11.glPopMatrix();
                }

                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                String friendPrefix = FriendManager.isFriend(entity.getName().getString()) ? TextFormatting.GREEN + "[F] " : "";
                TextComponent name = (TextComponent) ITextComponent.nullToEmpty(friendPrefix);
                name.append(entity.getDisplayName());
                mc.font.draw(e.getMatrixStack(), name, position.x() + width / 2f - length / 2f, position.y() - 9, -1);
                GL11.glPopMatrix();

                if (effects.getValue()) {
                    float effectsX = position.x() + (position.z() - position.x()) + 3;
                    drawPotions(e.getMatrixStack(), living, effectsX, position.y() + 1);
                }

                drawItems(e.getMatrixStack(), living, (int) (position.x() + width / 2f), (int) (position.y() - 20));
            } else if (entity instanceof ItemEntity) {
                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                mc.font.draw(e.getMatrixStack(), entity.getDisplayName(), position.x() + width / 2f - length / 2f, position.y() - 12, -1);
                GL11.glPopMatrix();
            }
        }
    }

    public boolean isValid(Entity entity) {
        if (AntiBot.isBot(entity)) return false;
        if (entity == null) return false;

        ActiveRenderInfo renderInfo = mc.gameRenderer.getMainCamera();
        Vector3d cameraPos = renderInfo.getPosition();

        Vector3d entityPos = entity.getBoundingBox().getCenter();

        double dx = entityPos.x - cameraPos.x;
        double dy = entityPos.y - cameraPos.y;
        double dz = entityPos.z - cameraPos.z;
        double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);

        if (distance > 128) return false;

        if (distance < 2) return true;

        float yaw = renderInfo.getYRot();
        float pitch = renderInfo.getXRot();

        double horDist = Math.sqrt(dx * dx + dz * dz);

        float eYaw = (float) Math.toDegrees(Math.atan2(dz, dx)) - 180;
        float ePitch = (float) Math.toDegrees(Math.atan2(dy, horDist));

        float yawDiff = Math.abs(MathHelper.wrapDegrees(yaw - eYaw));
        float pitchDiff = Math.abs(MathHelper.wrapDegrees(pitch - ePitch));

        float horFOV = (float) (mc.options.fov * 1.5f);
        float vertFOV = (float) (mc.options.fov * 2.0f);

        return yawDiff <= horFOV || pitchDiff <= vertFOV;
    }

    private void drawPotions(MatrixStack matrixStack, LivingEntity entity, float posX, float posY) {

        for (EffectInstance pot : entity.getActiveEffects()) {
            int amp = pot.getAmplifier();
            String ampStr = "";
            if (amp >= 1 && amp <= 9) {
                ampStr = " " + I18n.get("enchantment.level." + (amp + 1));
            }
            String text = I18n.get(pot.getEffect().getDisplayName().getString()) + ampStr + " - " + EffectUtils.formatDuration(pot, 1);

            GL11.glPushMatrix();
            GL11.glTranslatef(posX, posY, 0);
            GL11.glScalef(0.5f, 0.5f, 1);
            GL11.glTranslatef(-posX, -posY, 0);

            mc.font.draw(matrixStack, text, posX, posY, -1);
            GL11.glPopMatrix();

            posY += mc.font.lineHeight * 0.5f;
        }
    }

    private void drawItems(MatrixStack matrixStack, LivingEntity entity, int posX, int posY) {
        int size = 8;
        int padding = 6;
        float fontHeight = mc.font.lineHeight;
        List<ItemStack> items = new ArrayList<>();
        ItemStack mainStack = entity.getItemInHand(Hand.MAIN_HAND);
        if (!mainStack.isEmpty()) {
            items.add(mainStack);
        }
        for (ItemStack itemStack : entity.getArmorSlots()) {
            if (itemStack.isEmpty()) continue;
            items.add(itemStack);
        }
        ItemStack offStack = entity.getItemInHand(Hand.OFF_HAND);
        if (!offStack.isEmpty()) {
            items.add(offStack);
        }
        posX -= (int) ((items.size() * (size + padding)) / 2f);
        for (ItemStack itemStack : items) {
            if (itemStack.isEmpty()) continue;
            GL11.glPushMatrix();
            glCenteredScale(posX, posY, size / 2f, size / 2f, 0.5f);
            mc.getItemRenderer().renderGuiItem(itemStack, posX, posY);
            mc.getItemRenderer().renderGuiItemDecorations(mc.font, itemStack, posX, posY, null);
            GL11.glPopMatrix();
            if (itemStack.isEnchanted() && enchantments.getValue()) {
                int ePosY = (int) (posY - fontHeight);
                Map<Enchantment, Integer> enchantmentsMap = EnchantmentHelper.getEnchantments(itemStack);
                for (Enchantment enchantment : enchantmentsMap.keySet()) {
                    int level = enchantmentsMap.get(enchantment);
                    if (level < 1 || !enchantment.canApplyAtEnchantingTable(itemStack)) continue;
                    IFormattableTextComponent iformattabletextcomponent = new TranslationTextComponent(enchantment.getDescriptionId());
                    String enchText = iformattabletextcomponent.getString().substring(0, 2) + level;
                    float enchWidth = mc.font.width(enchText);
                    GL11.glPushMatrix();
                    glCenteredScale(posX, ePosY, enchWidth, 10, 0.5f);
                    mc.font.draw(matrixStack, enchText, posX, ePosY, -1);
                    GL11.glPopMatrix();
                    ePosY -= (int) (fontHeight * 0.5f);
                }
            }
            posX += size + padding;
        }
    }

    public void glCenteredScale(final float x, final float y, final float w, final float h, final float f) {
        glTranslatef(x + w / 2, y + h / 2, 0);
        glScalef(f, f, 1);
        glTranslatef(-x - w / 2, -y - h / 2, 0);
    }
}
ProjectionUtil:
public class ProjectionUtil {

    public static Vector2f project(double x, double y, double z) {
        Vector3d camera_pos = mc.gameRenderer.getMainCamera().getPosition();
        Quaternion cameraRotation = mc.gameRenderer.getMainCamera().rotation().copy();
        cameraRotation.conj();

        Vector3f result3f = new Vector3f((float) (camera_pos.x - x),
                (float) (camera_pos.y - y),
                (float) (camera_pos.z - z));
        result3f.transform(cameraRotation);

        double fov = mc.options.fov;

        return calc(result3f, fov);
    }

    private static Vector2f calc(Vector3f result3f, double fov) {
        float halfHeight = mc.getWindow().getGuiScaledHeight() / 2.0F;
        float scaleFactor = halfHeight / (result3f.z() * (float)Math.tan(Math.toRadians(fov / 2.0F)));

        if (result3f.z() < 0.0F) {
            return new Vector2f(
                    -result3f.x() * scaleFactor + mc.getWindow().getGuiScaledWidth() / 2.0F,
                    mc.getWindow().getGuiScaledHeight() / 2.0F - result3f.y() * scaleFactor
            );
        }
        return new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE);
    }
}

Render methods:
public class RenderUtil {
  
    public static void drawBox(double x, double y, double width, double height, double size, int color) {
        drawRectBuilding(x + size, y, width - size, y + size, color);
        drawRectBuilding(x, y, x + size, height, color);

        drawRectBuilding(width - size, y, width, height, color);
        drawRectBuilding(x + size, height - size, width - size, height, color);
    }

    public static void drawBoxTest(double x, double y, double width, double height, double size, Vector4f colors) {
        drawMCHorizontalBuilding(x + size, y, width - size, y + size, (int) colors.x(), (int) colors.z());
        drawMCVerticalBuilding(x, y, x + size, height, (int) colors.z(), (int) colors.x());

        drawMCVerticalBuilding(width - size, y, width, height, (int) colors.x(), (int) colors.z());
        drawMCHorizontalBuilding(x + size, height - size, width - size, height, (int) colors.z(), (int) colors.x());
    }
  
    public static void drawRectBuilding(
            double left,
            double top,
            double right,
            double bottom,
            int color) {
        if (left < right) {
            double i = left;
            left = right;
            right = i;
        }

        if (top < bottom) {
            double j = top;
            top = bottom;
            bottom = j;
        }

        float f3 = (float) (color >> 24 & 255) / 255.0F;
        float f = (float) (color >> 16 & 255) / 255.0F;
        float f1 = (float) (color >> 8 & 255) / 255.0F;
        float f2 = (float) (color & 255) / 255.0F;
        BufferBuilder bufferbuilder = Tessellator.getInstance().getBuilder();
        bufferbuilder.vertex(left, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, top, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(left, top, 0.0F).color(f, f1, f2, f3).endVertex();
    }
  
    public static void drawMCHorizontalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();
        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f1, f2, f3, f).endVertex();
    }

    public static void drawMCVerticalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;


        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();

        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f5, f6, f7, f4).endVertex();
    }
}
SS:
1736362382022.png

1736362525905.png


upd:
фикс есп, если у вас есть допустим хитбоксы в чите (чтобы их не раздувало нахуй как шарик)

Java:
/**/

double x = MathUtil.interpolate(entity.getX(), entity.xOld, e.getPartialTicks());
double y = MathUtil.interpolate(entity.getY(), entity.yOld, e.getPartialTicks());
double z = MathUtil.interpolate(entity.getZ(), entity.zOld, e.getPartialTicks());

AxisAlignedBB aabb;
if (entity instanceof PlayerEntity) {
    aabb = new AxisAlignedBB(
    x - 0.3,
    y,
    z - 0.3,
    x + 0.3,
    y + entity.getBoundingBox().getYsize(),
    z + 0.3
    );
} else {
    Vector3d size = new Vector3d(
        entity.getBoundingBox().maxX - entity.getBoundingBox().minX,
        entity.getBoundingBox().maxY - entity.getBoundingBox().minY,
        entity.getBoundingBox().maxZ - entity.getBoundingBox().minZ
    );
    aabb = new AxisAlignedBB(
        x - size.x / 2f,
        y,
        z - size.z / 2f,
        x + size.x / 2f,
        y + size.y,
        z + size.z / 2f
    );
}
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
20 Июн 2024
Сообщения
457
Реакции[?]
1
Поинты[?]
2K
Х
Второй подарочек всем форж пастерам на новый год.

Надеюсь после этого поста эра закончится.

Math методы и методы получения цвета бежим пастить с SexPensive, все написано под них.
Будут вопросы - мне похуй спрашивайте

PlayerEsp:
public class PlayerEsp extends Feature {

    /**
      * ═══════════════════════════════════════════
      * "Сто лет не пастил
      *  Бля пишу уже несколько месяцев селфкод
      *  и блевать хочется"
      *                          - shaoriy
      * ═══════════════════════════════════════════
      */

    private final HashMap<Entity, Vector4f> positions = new HashMap<>();
  
    BooleanSetting boxes = ...;
    BooleanSetting hpLine = ...;
    BooleanSetting hpTextBool = ...;
    BooleanSetting effects = ...;
    BooleanSetting enchantments = ...;
    BooleanSetting self = ...;
  
    public PlayerEsp() {
        super("PlayerEsp", Category.Visuals);
    }
  
    @SubscribeEvent
    public void onDisplay(RenderGameOverlayEvent.Pre e) {
        if (mc.level == null || e.getType() != RenderGameOverlayEvent.ElementType.ALL) {
            return;
        }

        positions.clear();

        // Ну тут немного я под спайсом был, привыкайте
        Vector4f colors = new Vector4f(getColor(0, 1), getColor(90, 1), getColor(180, 1), getColor(270, 1));
        Vector4f friendColors = new Vector4f(getColorFr(0, 1), getColorFr(90, 1), getColorFr(180, 1), getColorFr(270, 1));

        for (Entity entity : mc.level.players()) {

            if ((!isValid(entity)) ||
                    (!(entity instanceof PlayerEntity || entity instanceof ItemEntity)) ||
                    (entity == mc.player && ((mc.options.getCameraType() == PointOfView.FIRST_PERSON) || !self.getValue()))) continue;

            double x = MathUtil.interpolate(entity.getX(), entity.xOld, e.getPartialTicks());
            double y = MathUtil.interpolate(entity.getY(), entity.yOld, e.getPartialTicks());
            double z = MathUtil.interpolate(entity.getZ(), entity.zOld, e.getPartialTicks());

            Vector3d size = new Vector3d(
                    entity.getBoundingBox().maxX - entity.getBoundingBox().minX,
                    entity.getBoundingBox().maxY - entity.getBoundingBox().minY,
                    entity.getBoundingBox().maxZ - entity.getBoundingBox().minZ
            );

            AxisAlignedBB aabb = new AxisAlignedBB(
                    x - size.x / 2f,
                    y,
                    z - size.z / 2f,
                    x + size.x / 2f,
                    y + size.y,
                    z + size.z / 2f
            );

            Vector4f position = null;
            for (int i = 0; i < 8; i++) {
              
                Vector2f vector = ProjectionUtil.project(
                        i % 2 == 0 ? aabb.minX : aabb.maxX,
                        (i / 2) % 2 == 0 ? aabb.minY : aabb.maxY,
                        (i / 4) % 2 == 0 ? aabb.minZ : aabb.maxZ);
              
                if (position == null) {
                    position = new Vector4f(vector.x, vector.y, vector.x, vector.y);
                } else {
                    position.setX(Math.min(vector.x, position.x()));
                    position.setY(Math.min(vector.y, position.y()));
                    position.setZ(Math.max(vector.x, position.z()));
                    position.setW(Math.max(vector.y, position.w()));
                }
            }
            positions.put(entity, position);
        }

        RenderSystem.enableBlend();
        RenderSystem.disableTexture();
        RenderSystem.defaultBlendFunc();
        RenderSystem.shadeModel(7425);
        buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Vector4f position = entry.getValue();
            if (entry.getKey() instanceof LivingEntity) {
                LivingEntity entity = (LivingEntity) entry.getKey();
                if (boxes.getValue()) {
                    DrawHelper.drawBox(position.x() - 0.5f, position.y() - 0.5f, position.z() + 0.5f, position.w() + 0.5f, 2, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawBoxTest(position.x(), position.y(), position.z(), position.w(), 1, FriendManager.isFriend(entity.getName().getString()) ? friendColors : colors);
                }

                float hpOffset = 5f;
                float out = 0.5f;
                if (hpLine.getValue()) {
                    DrawHelper.drawRectBuilding(position.x() - hpOffset - out, position.y() - out, position.x() - hpOffset + 1 + out, position.w() + out, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawRectBuilding(position.x() - hpOffset, position.y(), position.x() - hpOffset + 1, position.w(), ColorUtil.rgba(0, 0, 0, 128));

                    float hp = entity.getHealth();
                    float maxHp = entity.getMaxHealth();

                    DrawHelper.drawMCVerticalBuilding(
                            position.x() - hpOffset,
                            position.y() + (position.w() - position.y()) * (1 - MathHelper.clamp(hp / maxHp, 0, 1)),
                            position.x() - hpOffset + 1,
                            position.w(),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.w() : colors.w()),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.x() : colors.x())
                    );
                }
            }
        }

        Tessellator.getInstance().end();
        RenderSystem.shadeModel(7424);
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Entity entity = entry.getKey();
            if (entity instanceof LivingEntity) {
                LivingEntity living = (LivingEntity) entity;

                float hp = living.getHealth();
                float maxHp = living.getMaxHealth();

                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                String hpText = (int) hp + "HP";
                float hpWidth = mc.font.width(hpText);
                float hpPercent = MathHelper.clamp(hp / maxHp, 0, 1);
                float hpPosY = position.y() + (position.w() - position.y()) * (1 - hpPercent);
                float hpOffset = 6f + (hpText.length() > 4 ? (hpText.length() - 4) * 2 : 0);

                if (hpTextBool.getValue()) {
                    GL11.glPushMatrix();
                    float textWidth = mc.font.width(hpText);
                    float rightAlignedX = position.x() - hpWidth - hpOffset + 5;

                    glCenteredScale(rightAlignedX, hpPosY - 1, textWidth, 10, 0.5f);
                    mc.font.draw(e.getMatrixStack(), hpText, rightAlignedX, hpPosY - 2, -1);
                    GL11.glPopMatrix();
                }

                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                String friendPrefix = FriendManager.isFriend(entity.getName().getString()) ? TextFormatting.GREEN + "[F] " : "";
                TextComponent name = (TextComponent) ITextComponent.nullToEmpty(friendPrefix);
                name.append(entity.getDisplayName());
                mc.font.draw(e.getMatrixStack(), name, position.x() + width / 2f - length / 2f, position.y() - 9, -1);
                GL11.glPopMatrix();

                if (effects.getValue()) {
                    float effectsX = position.x() + (position.z() - position.x()) + 3;
                    drawPotions(e.getMatrixStack(), living, effectsX, position.y() + 1);
                }

                drawItems(e.getMatrixStack(), living, (int) (position.x() + width / 2f), (int) (position.y() - 20));
            } else if (entity instanceof ItemEntity) {
                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                mc.font.draw(e.getMatrixStack(), entity.getDisplayName(), position.x() + width / 2f - length / 2f, position.y() - 12, -1);
                GL11.glPopMatrix();
            }
        }
    }

    public boolean isValid(Entity entity) {
        if (AntiBot.isBot(entity)) return false;
        if (entity == null) return false;

        ActiveRenderInfo renderInfo = mc.gameRenderer.getMainCamera();
        Vector3d cameraPos = renderInfo.getPosition();

        Vector3d entityPos = entity.getBoundingBox().getCenter();

        double dx = entityPos.x - cameraPos.x;
        double dy = entityPos.y - cameraPos.y;
        double dz = entityPos.z - cameraPos.z;
        double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);

        if (distance > 128) return false;

        if (distance < 2) return true;

        float yaw = renderInfo.getYRot();
        float pitch = renderInfo.getXRot();

        double horDist = Math.sqrt(dx * dx + dz * dz);

        float eYaw = (float) Math.toDegrees(Math.atan2(dz, dx)) - 180;
        float ePitch = (float) Math.toDegrees(Math.atan2(dy, horDist));

        float yawDiff = Math.abs(MathHelper.wrapDegrees(yaw - eYaw));
        float pitchDiff = Math.abs(MathHelper.wrapDegrees(pitch - ePitch));

        float horFOV = (float) (mc.options.fov * 1.5f);
        float vertFOV = (float) (mc.options.fov * 2.0f);

        return yawDiff <= horFOV || pitchDiff <= vertFOV;
    }

    private void drawPotions(MatrixStack matrixStack, LivingEntity entity, float posX, float posY) {

        for (EffectInstance pot : entity.getActiveEffects()) {
            int amp = pot.getAmplifier();
            String ampStr = "";
            if (amp >= 1 && amp <= 9) {
                ampStr = " " + I18n.get("enchantment.level." + (amp + 1));
            }
            String text = I18n.get(pot.getEffect().getDisplayName().getString()) + ampStr + " - " + EffectUtils.formatDuration(pot, 1);

            GL11.glPushMatrix();
            GL11.glTranslatef(posX, posY, 0);
            GL11.glScalef(0.5f, 0.5f, 1);
            GL11.glTranslatef(-posX, -posY, 0);

            mc.font.draw(matrixStack, text, posX, posY, -1);
            GL11.glPopMatrix();

            posY += mc.font.lineHeight * 0.5f;
        }
    }

    private void drawItems(MatrixStack matrixStack, LivingEntity entity, int posX, int posY) {
        int size = 8;
        int padding = 6;
        float fontHeight = mc.font.lineHeight;
        List<ItemStack> items = new ArrayList<>();
        ItemStack mainStack = entity.getItemInHand(Hand.MAIN_HAND);
        if (!mainStack.isEmpty()) {
            items.add(mainStack);
        }
        for (ItemStack itemStack : entity.getArmorSlots()) {
            if (itemStack.isEmpty()) continue;
            items.add(itemStack);
        }
        ItemStack offStack = entity.getItemInHand(Hand.OFF_HAND);
        if (!offStack.isEmpty()) {
            items.add(offStack);
        }
        posX -= (int) ((items.size() * (size + padding)) / 2f);
        for (ItemStack itemStack : items) {
            if (itemStack.isEmpty()) continue;
            GL11.glPushMatrix();
            glCenteredScale(posX, posY, size / 2f, size / 2f, 0.5f);
            mc.getItemRenderer().renderGuiItem(itemStack, posX, posY);
            mc.getItemRenderer().renderGuiItemDecorations(mc.font, itemStack, posX, posY, null);
            GL11.glPopMatrix();
            if (itemStack.isEnchanted() && enchantments.getValue()) {
                int ePosY = (int) (posY - fontHeight);
                Map<Enchantment, Integer> enchantmentsMap = EnchantmentHelper.getEnchantments(itemStack);
                for (Enchantment enchantment : enchantmentsMap.keySet()) {
                    int level = enchantmentsMap.get(enchantment);
                    if (level < 1 || !enchantment.canApplyAtEnchantingTable(itemStack)) continue;
                    IFormattableTextComponent iformattabletextcomponent = new TranslationTextComponent(enchantment.getDescriptionId());
                    String enchText = iformattabletextcomponent.getString().substring(0, 2) + level;
                    float enchWidth = mc.font.width(enchText);
                    GL11.glPushMatrix();
                    glCenteredScale(posX, ePosY, enchWidth, 10, 0.5f);
                    mc.font.draw(matrixStack, enchText, posX, ePosY, -1);
                    GL11.glPopMatrix();
                    ePosY -= (int) (fontHeight * 0.5f);
                }
            }
            posX += size + padding;
        }
    }

    public void glCenteredScale(final float x, final float y, final float w, final float h, final float f) {
        glTranslatef(x + w / 2, y + h / 2, 0);
        glScalef(f, f, 1);
        glTranslatef(-x - w / 2, -y - h / 2, 0);
    }
}
ProjectionUtil:
public class ProjectionUtil {

    public static Vector2f project(double x, double y, double z) {
        Vector3d camera_pos = mc.gameRenderer.getMainCamera().getPosition();
        Quaternion cameraRotation = mc.gameRenderer.getMainCamera().rotation().copy();
        cameraRotation.conj();

        Vector3f result3f = new Vector3f((float) (camera_pos.x - x),
                (float) (camera_pos.y - y),
                (float) (camera_pos.z - z));
        result3f.transform(cameraRotation);

        double fov = mc.options.fov;

        return calc(result3f, fov);
    }

    private static Vector2f calc(Vector3f result3f, double fov) {
        float halfHeight = mc.getWindow().getGuiScaledHeight() / 2.0F;
        float scaleFactor = halfHeight / (result3f.z() * (float)Math.tan(Math.toRadians(fov / 2.0F)));

        if (result3f.z() < 0.0F) {
            return new Vector2f(
                    -result3f.x() * scaleFactor + mc.getWindow().getGuiScaledWidth() / 2.0F,
                    mc.getWindow().getGuiScaledHeight() / 2.0F - result3f.y() * scaleFactor
            );
        }
        return new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE);
    }
}

Render methods:
public class RenderUtil {
  
    public static void drawBox(double x, double y, double width, double height, double size, int color) {
        drawRectBuilding(x + size, y, width - size, y + size, color);
        drawRectBuilding(x, y, x + size, height, color);

        drawRectBuilding(width - size, y, width, height, color);
        drawRectBuilding(x + size, height - size, width - size, height, color);
    }

    public static void drawBoxTest(double x, double y, double width, double height, double size, Vector4f colors) {
        drawMCHorizontalBuilding(x + size, y, width - size, y + size, (int) colors.x(), (int) colors.z());
        drawMCVerticalBuilding(x, y, x + size, height, (int) colors.z(), (int) colors.x());

        drawMCVerticalBuilding(width - size, y, width, height, (int) colors.x(), (int) colors.z());
        drawMCHorizontalBuilding(x + size, height - size, width - size, height, (int) colors.z(), (int) colors.x());
    }
  
    public static void drawRectBuilding(
            double left,
            double top,
            double right,
            double bottom,
            int color) {
        if (left < right) {
            double i = left;
            left = right;
            right = i;
        }

        if (top < bottom) {
            double j = top;
            top = bottom;
            bottom = j;
        }

        float f3 = (float) (color >> 24 & 255) / 255.0F;
        float f = (float) (color >> 16 & 255) / 255.0F;
        float f1 = (float) (color >> 8 & 255) / 255.0F;
        float f2 = (float) (color & 255) / 255.0F;
        BufferBuilder bufferbuilder = Tessellator.getInstance().getBuilder();
        bufferbuilder.vertex(left, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, top, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(left, top, 0.0F).color(f, f1, f2, f3).endVertex();
    }
  
    public static void drawMCHorizontalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();
        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f1, f2, f3, f).endVertex();
    }

    public static void drawMCVerticalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;


        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();

        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f5, f6, f7, f4).endVertex();
    }
}
SS:
Посмотреть вложение 295253
Посмотреть вложение 295254
Хоть сами боксы и взяты с експы, топ брат
 
Забаненный
Статус
Оффлайн
Регистрация
7 Дек 2024
Сообщения
28
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Второй подарочек всем форж пастерам на новый год.

Надеюсь после этого поста эра закончится.

Math методы и методы получения цвета бежим пастить с SexPensive, все написано под них.
Будут вопросы - мне похуй спрашивайте

PlayerEsp:
public class PlayerEsp extends Feature {

    /**
      * ═══════════════════════════════════════════
      * "Сто лет не пастил
      *  Бля пишу уже несколько месяцев селфкод
      *  и блевать хочется"
      *                          - shaoriy
      * ═══════════════════════════════════════════
      */

    private final HashMap<Entity, Vector4f> positions = new HashMap<>();
 
    BooleanSetting boxes = ...;
    BooleanSetting hpLine = ...;
    BooleanSetting hpTextBool = ...;
    BooleanSetting effects = ...;
    BooleanSetting enchantments = ...;
    BooleanSetting self = ...;
 
    public PlayerEsp() {
        super("PlayerEsp", Category.Visuals);
    }
 
    @SubscribeEvent
    public void onDisplay(RenderGameOverlayEvent.Pre e) {
        if (mc.level == null || e.getType() != RenderGameOverlayEvent.ElementType.ALL) {
            return;
        }

        positions.clear();

        // Ну тут немного я под спайсом был, привыкайте
        Vector4f colors = new Vector4f(getColor(0, 1), getColor(90, 1), getColor(180, 1), getColor(270, 1));
        Vector4f friendColors = new Vector4f(getColorFr(0, 1), getColorFr(90, 1), getColorFr(180, 1), getColorFr(270, 1));

        for (Entity entity : mc.level.players()) {

            if ((!isValid(entity)) ||
                    (!(entity instanceof PlayerEntity || entity instanceof ItemEntity)) ||
                    (entity == mc.player && ((mc.options.getCameraType() == PointOfView.FIRST_PERSON) || !self.getValue()))) continue;

            double x = MathUtil.interpolate(entity.getX(), entity.xOld, e.getPartialTicks());
            double y = MathUtil.interpolate(entity.getY(), entity.yOld, e.getPartialTicks());
            double z = MathUtil.interpolate(entity.getZ(), entity.zOld, e.getPartialTicks());

            Vector3d size = new Vector3d(
                    entity.getBoundingBox().maxX - entity.getBoundingBox().minX,
                    entity.getBoundingBox().maxY - entity.getBoundingBox().minY,
                    entity.getBoundingBox().maxZ - entity.getBoundingBox().minZ
            );

            AxisAlignedBB aabb = new AxisAlignedBB(
                    x - size.x / 2f,
                    y,
                    z - size.z / 2f,
                    x + size.x / 2f,
                    y + size.y,
                    z + size.z / 2f
            );

            Vector4f position = null;
            for (int i = 0; i < 8; i++) {
             
                Vector2f vector = ProjectionUtil.project(
                        i % 2 == 0 ? aabb.minX : aabb.maxX,
                        (i / 2) % 2 == 0 ? aabb.minY : aabb.maxY,
                        (i / 4) % 2 == 0 ? aabb.minZ : aabb.maxZ);
             
                if (position == null) {
                    position = new Vector4f(vector.x, vector.y, vector.x, vector.y);
                } else {
                    position.setX(Math.min(vector.x, position.x()));
                    position.setY(Math.min(vector.y, position.y()));
                    position.setZ(Math.max(vector.x, position.z()));
                    position.setW(Math.max(vector.y, position.w()));
                }
            }
            positions.put(entity, position);
        }

        RenderSystem.enableBlend();
        RenderSystem.disableTexture();
        RenderSystem.defaultBlendFunc();
        RenderSystem.shadeModel(7425);
        buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Vector4f position = entry.getValue();
            if (entry.getKey() instanceof LivingEntity) {
                LivingEntity entity = (LivingEntity) entry.getKey();
                if (boxes.getValue()) {
                    DrawHelper.drawBox(position.x() - 0.5f, position.y() - 0.5f, position.z() + 0.5f, position.w() + 0.5f, 2, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawBoxTest(position.x(), position.y(), position.z(), position.w(), 1, FriendManager.isFriend(entity.getName().getString()) ? friendColors : colors);
                }

                float hpOffset = 5f;
                float out = 0.5f;
                if (hpLine.getValue()) {
                    DrawHelper.drawRectBuilding(position.x() - hpOffset - out, position.y() - out, position.x() - hpOffset + 1 + out, position.w() + out, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawRectBuilding(position.x() - hpOffset, position.y(), position.x() - hpOffset + 1, position.w(), ColorUtil.rgba(0, 0, 0, 128));

                    float hp = entity.getHealth();
                    float maxHp = entity.getMaxHealth();

                    DrawHelper.drawMCVerticalBuilding(
                            position.x() - hpOffset,
                            position.y() + (position.w() - position.y()) * (1 - MathHelper.clamp(hp / maxHp, 0, 1)),
                            position.x() - hpOffset + 1,
                            position.w(),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.w() : colors.w()),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.x() : colors.x())
                    );
                }
            }
        }

        Tessellator.getInstance().end();
        RenderSystem.shadeModel(7424);
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Entity entity = entry.getKey();
            if (entity instanceof LivingEntity) {
                LivingEntity living = (LivingEntity) entity;

                float hp = living.getHealth();
                float maxHp = living.getMaxHealth();

                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                String hpText = (int) hp + "HP";
                float hpWidth = mc.font.width(hpText);
                float hpPercent = MathHelper.clamp(hp / maxHp, 0, 1);
                float hpPosY = position.y() + (position.w() - position.y()) * (1 - hpPercent);
                float hpOffset = 6f + (hpText.length() > 4 ? (hpText.length() - 4) * 2 : 0);

                if (hpTextBool.getValue()) {
                    GL11.glPushMatrix();
                    float textWidth = mc.font.width(hpText);
                    float rightAlignedX = position.x() - hpWidth - hpOffset + 5;

                    glCenteredScale(rightAlignedX, hpPosY - 1, textWidth, 10, 0.5f);
                    mc.font.draw(e.getMatrixStack(), hpText, rightAlignedX, hpPosY - 2, -1);
                    GL11.glPopMatrix();
                }

                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                String friendPrefix = FriendManager.isFriend(entity.getName().getString()) ? TextFormatting.GREEN + "[F] " : "";
                TextComponent name = (TextComponent) ITextComponent.nullToEmpty(friendPrefix);
                name.append(entity.getDisplayName());
                mc.font.draw(e.getMatrixStack(), name, position.x() + width / 2f - length / 2f, position.y() - 9, -1);
                GL11.glPopMatrix();

                if (effects.getValue()) {
                    float effectsX = position.x() + (position.z() - position.x()) + 3;
                    drawPotions(e.getMatrixStack(), living, effectsX, position.y() + 1);
                }

                drawItems(e.getMatrixStack(), living, (int) (position.x() + width / 2f), (int) (position.y() - 20));
            } else if (entity instanceof ItemEntity) {
                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                mc.font.draw(e.getMatrixStack(), entity.getDisplayName(), position.x() + width / 2f - length / 2f, position.y() - 12, -1);
                GL11.glPopMatrix();
            }
        }
    }

    public boolean isValid(Entity entity) {
        if (AntiBot.isBot(entity)) return false;
        if (entity == null) return false;

        ActiveRenderInfo renderInfo = mc.gameRenderer.getMainCamera();
        Vector3d cameraPos = renderInfo.getPosition();

        Vector3d entityPos = entity.getBoundingBox().getCenter();

        double dx = entityPos.x - cameraPos.x;
        double dy = entityPos.y - cameraPos.y;
        double dz = entityPos.z - cameraPos.z;
        double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);

        if (distance > 128) return false;

        if (distance < 2) return true;

        float yaw = renderInfo.getYRot();
        float pitch = renderInfo.getXRot();

        double horDist = Math.sqrt(dx * dx + dz * dz);

        float eYaw = (float) Math.toDegrees(Math.atan2(dz, dx)) - 180;
        float ePitch = (float) Math.toDegrees(Math.atan2(dy, horDist));

        float yawDiff = Math.abs(MathHelper.wrapDegrees(yaw - eYaw));
        float pitchDiff = Math.abs(MathHelper.wrapDegrees(pitch - ePitch));

        float horFOV = (float) (mc.options.fov * 1.5f);
        float vertFOV = (float) (mc.options.fov * 2.0f);

        return yawDiff <= horFOV || pitchDiff <= vertFOV;
    }

    private void drawPotions(MatrixStack matrixStack, LivingEntity entity, float posX, float posY) {

        for (EffectInstance pot : entity.getActiveEffects()) {
            int amp = pot.getAmplifier();
            String ampStr = "";
            if (amp >= 1 && amp <= 9) {
                ampStr = " " + I18n.get("enchantment.level." + (amp + 1));
            }
            String text = I18n.get(pot.getEffect().getDisplayName().getString()) + ampStr + " - " + EffectUtils.formatDuration(pot, 1);

            GL11.glPushMatrix();
            GL11.glTranslatef(posX, posY, 0);
            GL11.glScalef(0.5f, 0.5f, 1);
            GL11.glTranslatef(-posX, -posY, 0);

            mc.font.draw(matrixStack, text, posX, posY, -1);
            GL11.glPopMatrix();

            posY += mc.font.lineHeight * 0.5f;
        }
    }

    private void drawItems(MatrixStack matrixStack, LivingEntity entity, int posX, int posY) {
        int size = 8;
        int padding = 6;
        float fontHeight = mc.font.lineHeight;
        List<ItemStack> items = new ArrayList<>();
        ItemStack mainStack = entity.getItemInHand(Hand.MAIN_HAND);
        if (!mainStack.isEmpty()) {
            items.add(mainStack);
        }
        for (ItemStack itemStack : entity.getArmorSlots()) {
            if (itemStack.isEmpty()) continue;
            items.add(itemStack);
        }
        ItemStack offStack = entity.getItemInHand(Hand.OFF_HAND);
        if (!offStack.isEmpty()) {
            items.add(offStack);
        }
        posX -= (int) ((items.size() * (size + padding)) / 2f);
        for (ItemStack itemStack : items) {
            if (itemStack.isEmpty()) continue;
            GL11.glPushMatrix();
            glCenteredScale(posX, posY, size / 2f, size / 2f, 0.5f);
            mc.getItemRenderer().renderGuiItem(itemStack, posX, posY);
            mc.getItemRenderer().renderGuiItemDecorations(mc.font, itemStack, posX, posY, null);
            GL11.glPopMatrix();
            if (itemStack.isEnchanted() && enchantments.getValue()) {
                int ePosY = (int) (posY - fontHeight);
                Map<Enchantment, Integer> enchantmentsMap = EnchantmentHelper.getEnchantments(itemStack);
                for (Enchantment enchantment : enchantmentsMap.keySet()) {
                    int level = enchantmentsMap.get(enchantment);
                    if (level < 1 || !enchantment.canApplyAtEnchantingTable(itemStack)) continue;
                    IFormattableTextComponent iformattabletextcomponent = new TranslationTextComponent(enchantment.getDescriptionId());
                    String enchText = iformattabletextcomponent.getString().substring(0, 2) + level;
                    float enchWidth = mc.font.width(enchText);
                    GL11.glPushMatrix();
                    glCenteredScale(posX, ePosY, enchWidth, 10, 0.5f);
                    mc.font.draw(matrixStack, enchText, posX, ePosY, -1);
                    GL11.glPopMatrix();
                    ePosY -= (int) (fontHeight * 0.5f);
                }
            }
            posX += size + padding;
        }
    }

    public void glCenteredScale(final float x, final float y, final float w, final float h, final float f) {
        glTranslatef(x + w / 2, y + h / 2, 0);
        glScalef(f, f, 1);
        glTranslatef(-x - w / 2, -y - h / 2, 0);
    }
}
ProjectionUtil:
public class ProjectionUtil {

    public static Vector2f project(double x, double y, double z) {
        Vector3d camera_pos = mc.gameRenderer.getMainCamera().getPosition();
        Quaternion cameraRotation = mc.gameRenderer.getMainCamera().rotation().copy();
        cameraRotation.conj();

        Vector3f result3f = new Vector3f((float) (camera_pos.x - x),
                (float) (camera_pos.y - y),
                (float) (camera_pos.z - z));
        result3f.transform(cameraRotation);

        double fov = mc.options.fov;

        return calc(result3f, fov);
    }

    private static Vector2f calc(Vector3f result3f, double fov) {
        float halfHeight = mc.getWindow().getGuiScaledHeight() / 2.0F;
        float scaleFactor = halfHeight / (result3f.z() * (float)Math.tan(Math.toRadians(fov / 2.0F)));

        if (result3f.z() < 0.0F) {
            return new Vector2f(
                    -result3f.x() * scaleFactor + mc.getWindow().getGuiScaledWidth() / 2.0F,
                    mc.getWindow().getGuiScaledHeight() / 2.0F - result3f.y() * scaleFactor
            );
        }
        return new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE);
    }
}

Render methods:
public class RenderUtil {
 
    public static void drawBox(double x, double y, double width, double height, double size, int color) {
        drawRectBuilding(x + size, y, width - size, y + size, color);
        drawRectBuilding(x, y, x + size, height, color);

        drawRectBuilding(width - size, y, width, height, color);
        drawRectBuilding(x + size, height - size, width - size, height, color);
    }

    public static void drawBoxTest(double x, double y, double width, double height, double size, Vector4f colors) {
        drawMCHorizontalBuilding(x + size, y, width - size, y + size, (int) colors.x(), (int) colors.z());
        drawMCVerticalBuilding(x, y, x + size, height, (int) colors.z(), (int) colors.x());

        drawMCVerticalBuilding(width - size, y, width, height, (int) colors.x(), (int) colors.z());
        drawMCHorizontalBuilding(x + size, height - size, width - size, height, (int) colors.z(), (int) colors.x());
    }
 
    public static void drawRectBuilding(
            double left,
            double top,
            double right,
            double bottom,
            int color) {
        if (left < right) {
            double i = left;
            left = right;
            right = i;
        }

        if (top < bottom) {
            double j = top;
            top = bottom;
            bottom = j;
        }

        float f3 = (float) (color >> 24 & 255) / 255.0F;
        float f = (float) (color >> 16 & 255) / 255.0F;
        float f1 = (float) (color >> 8 & 255) / 255.0F;
        float f2 = (float) (color & 255) / 255.0F;
        BufferBuilder bufferbuilder = Tessellator.getInstance().getBuilder();
        bufferbuilder.vertex(left, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, top, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(left, top, 0.0F).color(f, f1, f2, f3).endVertex();
    }
 
    public static void drawMCHorizontalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();
        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f1, f2, f3, f).endVertex();
    }

    public static void drawMCVerticalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;


        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();

        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f5, f6, f7, f4).endVertex();
    }
}
SS:
Посмотреть вложение 295253
Посмотреть вложение 295254
ахуенно, но выглядит фулл как у экспы
 
Начинающий
Статус
Оффлайн
Регистрация
10 Ноя 2023
Сообщения
251
Реакции[?]
0
Поинты[?]
1K
Второй подарочек всем форж пастерам на новый год.

Надеюсь после этого поста эра закончится.

Math методы и методы получения цвета бежим пастить с SexPensive, все написано под них.
Будут вопросы - мне похуй спрашивайте

PlayerEsp:
public class PlayerEsp extends Feature {

    /**
      * ═══════════════════════════════════════════
      * "Сто лет не пастил
      *  Бля пишу уже несколько месяцев селфкод
      *  и блевать хочется"
      *                          - shaoriy
      * ═══════════════════════════════════════════
      */

    private final HashMap<Entity, Vector4f> positions = new HashMap<>();
  
    BooleanSetting boxes = ...;
    BooleanSetting hpLine = ...;
    BooleanSetting hpTextBool = ...;
    BooleanSetting effects = ...;
    BooleanSetting enchantments = ...;
    BooleanSetting self = ...;
  
    public PlayerEsp() {
        super("PlayerEsp", Category.Visuals);
    }
  
    @SubscribeEvent
    public void onDisplay(RenderGameOverlayEvent.Pre e) {
        if (mc.level == null || e.getType() != RenderGameOverlayEvent.ElementType.ALL) {
            return;
        }

        positions.clear();

        // Ну тут немного я под спайсом был, привыкайте
        Vector4f colors = new Vector4f(getColor(0, 1), getColor(90, 1), getColor(180, 1), getColor(270, 1));
        Vector4f friendColors = new Vector4f(getColorFr(0, 1), getColorFr(90, 1), getColorFr(180, 1), getColorFr(270, 1));

        for (Entity entity : mc.level.players()) {

            if ((!isValid(entity)) ||
                    (!(entity instanceof PlayerEntity || entity instanceof ItemEntity)) ||
                    (entity == mc.player && ((mc.options.getCameraType() == PointOfView.FIRST_PERSON) || !self.getValue()))) continue;

            double x = MathUtil.interpolate(entity.getX(), entity.xOld, e.getPartialTicks());
            double y = MathUtil.interpolate(entity.getY(), entity.yOld, e.getPartialTicks());
            double z = MathUtil.interpolate(entity.getZ(), entity.zOld, e.getPartialTicks());

            Vector3d size = new Vector3d(
                    entity.getBoundingBox().maxX - entity.getBoundingBox().minX,
                    entity.getBoundingBox().maxY - entity.getBoundingBox().minY,
                    entity.getBoundingBox().maxZ - entity.getBoundingBox().minZ
            );

            AxisAlignedBB aabb = new AxisAlignedBB(
                    x - size.x / 2f,
                    y,
                    z - size.z / 2f,
                    x + size.x / 2f,
                    y + size.y,
                    z + size.z / 2f
            );

            Vector4f position = null;
            for (int i = 0; i < 8; i++) {
              
                Vector2f vector = ProjectionUtil.project(
                        i % 2 == 0 ? aabb.minX : aabb.maxX,
                        (i / 2) % 2 == 0 ? aabb.minY : aabb.maxY,
                        (i / 4) % 2 == 0 ? aabb.minZ : aabb.maxZ);
              
                if (position == null) {
                    position = new Vector4f(vector.x, vector.y, vector.x, vector.y);
                } else {
                    position.setX(Math.min(vector.x, position.x()));
                    position.setY(Math.min(vector.y, position.y()));
                    position.setZ(Math.max(vector.x, position.z()));
                    position.setW(Math.max(vector.y, position.w()));
                }
            }
            positions.put(entity, position);
        }

        RenderSystem.enableBlend();
        RenderSystem.disableTexture();
        RenderSystem.defaultBlendFunc();
        RenderSystem.shadeModel(7425);
        buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Vector4f position = entry.getValue();
            if (entry.getKey() instanceof LivingEntity) {
                LivingEntity entity = (LivingEntity) entry.getKey();
                if (boxes.getValue()) {
                    DrawHelper.drawBox(position.x() - 0.5f, position.y() - 0.5f, position.z() + 0.5f, position.w() + 0.5f, 2, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawBoxTest(position.x(), position.y(), position.z(), position.w(), 1, FriendManager.isFriend(entity.getName().getString()) ? friendColors : colors);
                }

                float hpOffset = 5f;
                float out = 0.5f;
                if (hpLine.getValue()) {
                    DrawHelper.drawRectBuilding(position.x() - hpOffset - out, position.y() - out, position.x() - hpOffset + 1 + out, position.w() + out, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawRectBuilding(position.x() - hpOffset, position.y(), position.x() - hpOffset + 1, position.w(), ColorUtil.rgba(0, 0, 0, 128));

                    float hp = entity.getHealth();
                    float maxHp = entity.getMaxHealth();

                    DrawHelper.drawMCVerticalBuilding(
                            position.x() - hpOffset,
                            position.y() + (position.w() - position.y()) * (1 - MathHelper.clamp(hp / maxHp, 0, 1)),
                            position.x() - hpOffset + 1,
                            position.w(),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.w() : colors.w()),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.x() : colors.x())
                    );
                }
            }
        }

        Tessellator.getInstance().end();
        RenderSystem.shadeModel(7424);
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Entity entity = entry.getKey();
            if (entity instanceof LivingEntity) {
                LivingEntity living = (LivingEntity) entity;

                float hp = living.getHealth();
                float maxHp = living.getMaxHealth();

                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                String hpText = (int) hp + "HP";
                float hpWidth = mc.font.width(hpText);
                float hpPercent = MathHelper.clamp(hp / maxHp, 0, 1);
                float hpPosY = position.y() + (position.w() - position.y()) * (1 - hpPercent);
                float hpOffset = 6f + (hpText.length() > 4 ? (hpText.length() - 4) * 2 : 0);

                if (hpTextBool.getValue()) {
                    GL11.glPushMatrix();
                    float textWidth = mc.font.width(hpText);
                    float rightAlignedX = position.x() - hpWidth - hpOffset + 5;

                    glCenteredScale(rightAlignedX, hpPosY - 1, textWidth, 10, 0.5f);
                    mc.font.draw(e.getMatrixStack(), hpText, rightAlignedX, hpPosY - 2, -1);
                    GL11.glPopMatrix();
                }

                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                String friendPrefix = FriendManager.isFriend(entity.getName().getString()) ? TextFormatting.GREEN + "[F] " : "";
                TextComponent name = (TextComponent) ITextComponent.nullToEmpty(friendPrefix);
                name.append(entity.getDisplayName());
                mc.font.draw(e.getMatrixStack(), name, position.x() + width / 2f - length / 2f, position.y() - 9, -1);
                GL11.glPopMatrix();

                if (effects.getValue()) {
                    float effectsX = position.x() + (position.z() - position.x()) + 3;
                    drawPotions(e.getMatrixStack(), living, effectsX, position.y() + 1);
                }

                drawItems(e.getMatrixStack(), living, (int) (position.x() + width / 2f), (int) (position.y() - 20));
            } else if (entity instanceof ItemEntity) {
                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                mc.font.draw(e.getMatrixStack(), entity.getDisplayName(), position.x() + width / 2f - length / 2f, position.y() - 12, -1);
                GL11.glPopMatrix();
            }
        }
    }

    public boolean isValid(Entity entity) {
        if (AntiBot.isBot(entity)) return false;
        if (entity == null) return false;

        ActiveRenderInfo renderInfo = mc.gameRenderer.getMainCamera();
        Vector3d cameraPos = renderInfo.getPosition();

        Vector3d entityPos = entity.getBoundingBox().getCenter();

        double dx = entityPos.x - cameraPos.x;
        double dy = entityPos.y - cameraPos.y;
        double dz = entityPos.z - cameraPos.z;
        double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);

        if (distance > 128) return false;

        if (distance < 2) return true;

        float yaw = renderInfo.getYRot();
        float pitch = renderInfo.getXRot();

        double horDist = Math.sqrt(dx * dx + dz * dz);

        float eYaw = (float) Math.toDegrees(Math.atan2(dz, dx)) - 180;
        float ePitch = (float) Math.toDegrees(Math.atan2(dy, horDist));

        float yawDiff = Math.abs(MathHelper.wrapDegrees(yaw - eYaw));
        float pitchDiff = Math.abs(MathHelper.wrapDegrees(pitch - ePitch));

        float horFOV = (float) (mc.options.fov * 1.5f);
        float vertFOV = (float) (mc.options.fov * 2.0f);

        return yawDiff <= horFOV || pitchDiff <= vertFOV;
    }

    private void drawPotions(MatrixStack matrixStack, LivingEntity entity, float posX, float posY) {

        for (EffectInstance pot : entity.getActiveEffects()) {
            int amp = pot.getAmplifier();
            String ampStr = "";
            if (amp >= 1 && amp <= 9) {
                ampStr = " " + I18n.get("enchantment.level." + (amp + 1));
            }
            String text = I18n.get(pot.getEffect().getDisplayName().getString()) + ampStr + " - " + EffectUtils.formatDuration(pot, 1);

            GL11.glPushMatrix();
            GL11.glTranslatef(posX, posY, 0);
            GL11.glScalef(0.5f, 0.5f, 1);
            GL11.glTranslatef(-posX, -posY, 0);

            mc.font.draw(matrixStack, text, posX, posY, -1);
            GL11.glPopMatrix();

            posY += mc.font.lineHeight * 0.5f;
        }
    }

    private void drawItems(MatrixStack matrixStack, LivingEntity entity, int posX, int posY) {
        int size = 8;
        int padding = 6;
        float fontHeight = mc.font.lineHeight;
        List<ItemStack> items = new ArrayList<>();
        ItemStack mainStack = entity.getItemInHand(Hand.MAIN_HAND);
        if (!mainStack.isEmpty()) {
            items.add(mainStack);
        }
        for (ItemStack itemStack : entity.getArmorSlots()) {
            if (itemStack.isEmpty()) continue;
            items.add(itemStack);
        }
        ItemStack offStack = entity.getItemInHand(Hand.OFF_HAND);
        if (!offStack.isEmpty()) {
            items.add(offStack);
        }
        posX -= (int) ((items.size() * (size + padding)) / 2f);
        for (ItemStack itemStack : items) {
            if (itemStack.isEmpty()) continue;
            GL11.glPushMatrix();
            glCenteredScale(posX, posY, size / 2f, size / 2f, 0.5f);
            mc.getItemRenderer().renderGuiItem(itemStack, posX, posY);
            mc.getItemRenderer().renderGuiItemDecorations(mc.font, itemStack, posX, posY, null);
            GL11.glPopMatrix();
            if (itemStack.isEnchanted() && enchantments.getValue()) {
                int ePosY = (int) (posY - fontHeight);
                Map<Enchantment, Integer> enchantmentsMap = EnchantmentHelper.getEnchantments(itemStack);
                for (Enchantment enchantment : enchantmentsMap.keySet()) {
                    int level = enchantmentsMap.get(enchantment);
                    if (level < 1 || !enchantment.canApplyAtEnchantingTable(itemStack)) continue;
                    IFormattableTextComponent iformattabletextcomponent = new TranslationTextComponent(enchantment.getDescriptionId());
                    String enchText = iformattabletextcomponent.getString().substring(0, 2) + level;
                    float enchWidth = mc.font.width(enchText);
                    GL11.glPushMatrix();
                    glCenteredScale(posX, ePosY, enchWidth, 10, 0.5f);
                    mc.font.draw(matrixStack, enchText, posX, ePosY, -1);
                    GL11.glPopMatrix();
                    ePosY -= (int) (fontHeight * 0.5f);
                }
            }
            posX += size + padding;
        }
    }

    public void glCenteredScale(final float x, final float y, final float w, final float h, final float f) {
        glTranslatef(x + w / 2, y + h / 2, 0);
        glScalef(f, f, 1);
        glTranslatef(-x - w / 2, -y - h / 2, 0);
    }
}
ProjectionUtil:
public class ProjectionUtil {

    public static Vector2f project(double x, double y, double z) {
        Vector3d camera_pos = mc.gameRenderer.getMainCamera().getPosition();
        Quaternion cameraRotation = mc.gameRenderer.getMainCamera().rotation().copy();
        cameraRotation.conj();

        Vector3f result3f = new Vector3f((float) (camera_pos.x - x),
                (float) (camera_pos.y - y),
                (float) (camera_pos.z - z));
        result3f.transform(cameraRotation);

        double fov = mc.options.fov;

        return calc(result3f, fov);
    }

    private static Vector2f calc(Vector3f result3f, double fov) {
        float halfHeight = mc.getWindow().getGuiScaledHeight() / 2.0F;
        float scaleFactor = halfHeight / (result3f.z() * (float)Math.tan(Math.toRadians(fov / 2.0F)));

        if (result3f.z() < 0.0F) {
            return new Vector2f(
                    -result3f.x() * scaleFactor + mc.getWindow().getGuiScaledWidth() / 2.0F,
                    mc.getWindow().getGuiScaledHeight() / 2.0F - result3f.y() * scaleFactor
            );
        }
        return new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE);
    }
}

Render methods:
public class RenderUtil {
  
    public static void drawBox(double x, double y, double width, double height, double size, int color) {
        drawRectBuilding(x + size, y, width - size, y + size, color);
        drawRectBuilding(x, y, x + size, height, color);

        drawRectBuilding(width - size, y, width, height, color);
        drawRectBuilding(x + size, height - size, width - size, height, color);
    }

    public static void drawBoxTest(double x, double y, double width, double height, double size, Vector4f colors) {
        drawMCHorizontalBuilding(x + size, y, width - size, y + size, (int) colors.x(), (int) colors.z());
        drawMCVerticalBuilding(x, y, x + size, height, (int) colors.z(), (int) colors.x());

        drawMCVerticalBuilding(width - size, y, width, height, (int) colors.x(), (int) colors.z());
        drawMCHorizontalBuilding(x + size, height - size, width - size, height, (int) colors.z(), (int) colors.x());
    }
  
    public static void drawRectBuilding(
            double left,
            double top,
            double right,
            double bottom,
            int color) {
        if (left < right) {
            double i = left;
            left = right;
            right = i;
        }

        if (top < bottom) {
            double j = top;
            top = bottom;
            bottom = j;
        }

        float f3 = (float) (color >> 24 & 255) / 255.0F;
        float f = (float) (color >> 16 & 255) / 255.0F;
        float f1 = (float) (color >> 8 & 255) / 255.0F;
        float f2 = (float) (color & 255) / 255.0F;
        BufferBuilder bufferbuilder = Tessellator.getInstance().getBuilder();
        bufferbuilder.vertex(left, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, top, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(left, top, 0.0F).color(f, f1, f2, f3).endVertex();
    }
  
    public static void drawMCHorizontalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();
        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f1, f2, f3, f).endVertex();
    }

    public static void drawMCVerticalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;


        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();

        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f5, f6, f7, f4).endVertex();
    }
}
SS:
Посмотреть вложение 295253
Посмотреть вложение 295254
красиво
 
Начинающий
Статус
Оффлайн
Регистрация
16 Дек 2024
Сообщения
2
Реакции[?]
0
Поинты[?]
0
а что делать если при зуме через Optifine (на С который) есп рисуются не там где надо?
 
Начинающий
Статус
Оффлайн
Регистрация
27 Дек 2024
Сообщения
95
Реакции[?]
0
Поинты[?]
0
Второй подарочек всем форж пастерам на новый год.

Надеюсь после этого поста эра закончится.

Math методы и методы получения цвета бежим пастить с SexPensive, все написано под них.
Будут вопросы - мне похуй спрашивайте

PlayerEsp:
public class PlayerEsp extends Feature {

    /**
      * ═══════════════════════════════════════════
      * "Сто лет не пастил
      *  Бля пишу уже несколько месяцев селфкод
      *  и блевать хочется"
      *                          - shaoriy
      * ═══════════════════════════════════════════
      */

    private final HashMap<Entity, Vector4f> positions = new HashMap<>();
 
    BooleanSetting boxes = ...;
    BooleanSetting hpLine = ...;
    BooleanSetting hpTextBool = ...;
    BooleanSetting effects = ...;
    BooleanSetting enchantments = ...;
    BooleanSetting self = ...;
 
    public PlayerEsp() {
        super("PlayerEsp", Category.Visuals);
    }
 
    @SubscribeEvent
    public void onDisplay(RenderGameOverlayEvent.Pre e) {
        if (mc.level == null || e.getType() != RenderGameOverlayEvent.ElementType.ALL) {
            return;
        }

        positions.clear();

        // Ну тут немного я под спайсом был, привыкайте
        Vector4f colors = new Vector4f(getColor(0, 1), getColor(90, 1), getColor(180, 1), getColor(270, 1));
        Vector4f friendColors = new Vector4f(getColorFr(0, 1), getColorFr(90, 1), getColorFr(180, 1), getColorFr(270, 1));

        for (Entity entity : mc.level.players()) {

            if ((!isValid(entity)) ||
                    (!(entity instanceof PlayerEntity || entity instanceof ItemEntity)) ||
                    (entity == mc.player && ((mc.options.getCameraType() == PointOfView.FIRST_PERSON) || !self.getValue()))) continue;

            double x = MathUtil.interpolate(entity.getX(), entity.xOld, e.getPartialTicks());
            double y = MathUtil.interpolate(entity.getY(), entity.yOld, e.getPartialTicks());
            double z = MathUtil.interpolate(entity.getZ(), entity.zOld, e.getPartialTicks());

            Vector3d size = new Vector3d(
                    entity.getBoundingBox().maxX - entity.getBoundingBox().minX,
                    entity.getBoundingBox().maxY - entity.getBoundingBox().minY,
                    entity.getBoundingBox().maxZ - entity.getBoundingBox().minZ
            );

            AxisAlignedBB aabb = new AxisAlignedBB(
                    x - size.x / 2f,
                    y,
                    z - size.z / 2f,
                    x + size.x / 2f,
                    y + size.y,
                    z + size.z / 2f
            );

            Vector4f position = null;
            for (int i = 0; i < 8; i++) {
             
                Vector2f vector = ProjectionUtil.project(
                        i % 2 == 0 ? aabb.minX : aabb.maxX,
                        (i / 2) % 2 == 0 ? aabb.minY : aabb.maxY,
                        (i / 4) % 2 == 0 ? aabb.minZ : aabb.maxZ);
             
                if (position == null) {
                    position = new Vector4f(vector.x, vector.y, vector.x, vector.y);
                } else {
                    position.setX(Math.min(vector.x, position.x()));
                    position.setY(Math.min(vector.y, position.y()));
                    position.setZ(Math.max(vector.x, position.z()));
                    position.setW(Math.max(vector.y, position.w()));
                }
            }
            positions.put(entity, position);
        }

        RenderSystem.enableBlend();
        RenderSystem.disableTexture();
        RenderSystem.defaultBlendFunc();
        RenderSystem.shadeModel(7425);
        buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Vector4f position = entry.getValue();
            if (entry.getKey() instanceof LivingEntity) {
                LivingEntity entity = (LivingEntity) entry.getKey();
                if (boxes.getValue()) {
                    DrawHelper.drawBox(position.x() - 0.5f, position.y() - 0.5f, position.z() + 0.5f, position.w() + 0.5f, 2, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawBoxTest(position.x(), position.y(), position.z(), position.w(), 1, FriendManager.isFriend(entity.getName().getString()) ? friendColors : colors);
                }

                float hpOffset = 5f;
                float out = 0.5f;
                if (hpLine.getValue()) {
                    DrawHelper.drawRectBuilding(position.x() - hpOffset - out, position.y() - out, position.x() - hpOffset + 1 + out, position.w() + out, ColorUtil.rgba(0, 0, 0, 128));
                    DrawHelper.drawRectBuilding(position.x() - hpOffset, position.y(), position.x() - hpOffset + 1, position.w(), ColorUtil.rgba(0, 0, 0, 128));

                    float hp = entity.getHealth();
                    float maxHp = entity.getMaxHealth();

                    DrawHelper.drawMCVerticalBuilding(
                            position.x() - hpOffset,
                            position.y() + (position.w() - position.y()) * (1 - MathHelper.clamp(hp / maxHp, 0, 1)),
                            position.x() - hpOffset + 1,
                            position.w(),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.w() : colors.w()),
                            (int) (FriendManager.isFriend(entity.getName().getString()) ? friendColors.x() : colors.x())
                    );
                }
            }
        }

        Tessellator.getInstance().end();
        RenderSystem.shadeModel(7424);
        RenderSystem.enableTexture();
        RenderSystem.disableBlend();

        for (Map.Entry<Entity, Vector4f> entry : positions.entrySet()) {
            Entity entity = entry.getKey();
            if (entity instanceof LivingEntity) {
                LivingEntity living = (LivingEntity) entity;

                float hp = living.getHealth();
                float maxHp = living.getMaxHealth();

                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                String hpText = (int) hp + "HP";
                float hpWidth = mc.font.width(hpText);
                float hpPercent = MathHelper.clamp(hp / maxHp, 0, 1);
                float hpPosY = position.y() + (position.w() - position.y()) * (1 - hpPercent);
                float hpOffset = 6f + (hpText.length() > 4 ? (hpText.length() - 4) * 2 : 0);

                if (hpTextBool.getValue()) {
                    GL11.glPushMatrix();
                    float textWidth = mc.font.width(hpText);
                    float rightAlignedX = position.x() - hpWidth - hpOffset + 5;

                    glCenteredScale(rightAlignedX, hpPosY - 1, textWidth, 10, 0.5f);
                    mc.font.draw(e.getMatrixStack(), hpText, rightAlignedX, hpPosY - 2, -1);
                    GL11.glPopMatrix();
                }

                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                String friendPrefix = FriendManager.isFriend(entity.getName().getString()) ? TextFormatting.GREEN + "[F] " : "";
                TextComponent name = (TextComponent) ITextComponent.nullToEmpty(friendPrefix);
                name.append(entity.getDisplayName());
                mc.font.draw(e.getMatrixStack(), name, position.x() + width / 2f - length / 2f, position.y() - 9, -1);
                GL11.glPopMatrix();

                if (effects.getValue()) {
                    float effectsX = position.x() + (position.z() - position.x()) + 3;
                    drawPotions(e.getMatrixStack(), living, effectsX, position.y() + 1);
                }

                drawItems(e.getMatrixStack(), living, (int) (position.x() + width / 2f), (int) (position.y() - 20));
            } else if (entity instanceof ItemEntity) {
                Vector4f position = entry.getValue();
                float width = position.z() - position.x();
                float length = mc.font.width(entity.getDisplayName());
                GL11.glPushMatrix();
                glCenteredScale(position.x() + width / 2f - length / 2f, position.y() - 12, length, 10, 0.5f);
                mc.font.draw(e.getMatrixStack(), entity.getDisplayName(), position.x() + width / 2f - length / 2f, position.y() - 12, -1);
                GL11.glPopMatrix();
            }
        }
    }

    public boolean isValid(Entity entity) {
        if (AntiBot.isBot(entity)) return false;
        if (entity == null) return false;

        ActiveRenderInfo renderInfo = mc.gameRenderer.getMainCamera();
        Vector3d cameraPos = renderInfo.getPosition();

        Vector3d entityPos = entity.getBoundingBox().getCenter();

        double dx = entityPos.x - cameraPos.x;
        double dy = entityPos.y - cameraPos.y;
        double dz = entityPos.z - cameraPos.z;
        double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);

        if (distance > 128) return false;

        if (distance < 2) return true;

        float yaw = renderInfo.getYRot();
        float pitch = renderInfo.getXRot();

        double horDist = Math.sqrt(dx * dx + dz * dz);

        float eYaw = (float) Math.toDegrees(Math.atan2(dz, dx)) - 180;
        float ePitch = (float) Math.toDegrees(Math.atan2(dy, horDist));

        float yawDiff = Math.abs(MathHelper.wrapDegrees(yaw - eYaw));
        float pitchDiff = Math.abs(MathHelper.wrapDegrees(pitch - ePitch));

        float horFOV = (float) (mc.options.fov * 1.5f);
        float vertFOV = (float) (mc.options.fov * 2.0f);

        return yawDiff <= horFOV || pitchDiff <= vertFOV;
    }

    private void drawPotions(MatrixStack matrixStack, LivingEntity entity, float posX, float posY) {

        for (EffectInstance pot : entity.getActiveEffects()) {
            int amp = pot.getAmplifier();
            String ampStr = "";
            if (amp >= 1 && amp <= 9) {
                ampStr = " " + I18n.get("enchantment.level." + (amp + 1));
            }
            String text = I18n.get(pot.getEffect().getDisplayName().getString()) + ampStr + " - " + EffectUtils.formatDuration(pot, 1);

            GL11.glPushMatrix();
            GL11.glTranslatef(posX, posY, 0);
            GL11.glScalef(0.5f, 0.5f, 1);
            GL11.glTranslatef(-posX, -posY, 0);

            mc.font.draw(matrixStack, text, posX, posY, -1);
            GL11.glPopMatrix();

            posY += mc.font.lineHeight * 0.5f;
        }
    }

    private void drawItems(MatrixStack matrixStack, LivingEntity entity, int posX, int posY) {
        int size = 8;
        int padding = 6;
        float fontHeight = mc.font.lineHeight;
        List<ItemStack> items = new ArrayList<>();
        ItemStack mainStack = entity.getItemInHand(Hand.MAIN_HAND);
        if (!mainStack.isEmpty()) {
            items.add(mainStack);
        }
        for (ItemStack itemStack : entity.getArmorSlots()) {
            if (itemStack.isEmpty()) continue;
            items.add(itemStack);
        }
        ItemStack offStack = entity.getItemInHand(Hand.OFF_HAND);
        if (!offStack.isEmpty()) {
            items.add(offStack);
        }
        posX -= (int) ((items.size() * (size + padding)) / 2f);
        for (ItemStack itemStack : items) {
            if (itemStack.isEmpty()) continue;
            GL11.glPushMatrix();
            glCenteredScale(posX, posY, size / 2f, size / 2f, 0.5f);
            mc.getItemRenderer().renderGuiItem(itemStack, posX, posY);
            mc.getItemRenderer().renderGuiItemDecorations(mc.font, itemStack, posX, posY, null);
            GL11.glPopMatrix();
            if (itemStack.isEnchanted() && enchantments.getValue()) {
                int ePosY = (int) (posY - fontHeight);
                Map<Enchantment, Integer> enchantmentsMap = EnchantmentHelper.getEnchantments(itemStack);
                for (Enchantment enchantment : enchantmentsMap.keySet()) {
                    int level = enchantmentsMap.get(enchantment);
                    if (level < 1 || !enchantment.canApplyAtEnchantingTable(itemStack)) continue;
                    IFormattableTextComponent iformattabletextcomponent = new TranslationTextComponent(enchantment.getDescriptionId());
                    String enchText = iformattabletextcomponent.getString().substring(0, 2) + level;
                    float enchWidth = mc.font.width(enchText);
                    GL11.glPushMatrix();
                    glCenteredScale(posX, ePosY, enchWidth, 10, 0.5f);
                    mc.font.draw(matrixStack, enchText, posX, ePosY, -1);
                    GL11.glPopMatrix();
                    ePosY -= (int) (fontHeight * 0.5f);
                }
            }
            posX += size + padding;
        }
    }

    public void glCenteredScale(final float x, final float y, final float w, final float h, final float f) {
        glTranslatef(x + w / 2, y + h / 2, 0);
        glScalef(f, f, 1);
        glTranslatef(-x - w / 2, -y - h / 2, 0);
    }
}
ProjectionUtil:
public class ProjectionUtil {

    public static Vector2f project(double x, double y, double z) {
        Vector3d camera_pos = mc.gameRenderer.getMainCamera().getPosition();
        Quaternion cameraRotation = mc.gameRenderer.getMainCamera().rotation().copy();
        cameraRotation.conj();

        Vector3f result3f = new Vector3f((float) (camera_pos.x - x),
                (float) (camera_pos.y - y),
                (float) (camera_pos.z - z));
        result3f.transform(cameraRotation);

        double fov = mc.options.fov;

        return calc(result3f, fov);
    }

    private static Vector2f calc(Vector3f result3f, double fov) {
        float halfHeight = mc.getWindow().getGuiScaledHeight() / 2.0F;
        float scaleFactor = halfHeight / (result3f.z() * (float)Math.tan(Math.toRadians(fov / 2.0F)));

        if (result3f.z() < 0.0F) {
            return new Vector2f(
                    -result3f.x() * scaleFactor + mc.getWindow().getGuiScaledWidth() / 2.0F,
                    mc.getWindow().getGuiScaledHeight() / 2.0F - result3f.y() * scaleFactor
            );
        }
        return new Vector2f(Float.MAX_VALUE, Float.MAX_VALUE);
    }
}

Render methods:
public class RenderUtil {
 
    public static void drawBox(double x, double y, double width, double height, double size, int color) {
        drawRectBuilding(x + size, y, width - size, y + size, color);
        drawRectBuilding(x, y, x + size, height, color);

        drawRectBuilding(width - size, y, width, height, color);
        drawRectBuilding(x + size, height - size, width - size, height, color);
    }

    public static void drawBoxTest(double x, double y, double width, double height, double size, Vector4f colors) {
        drawMCHorizontalBuilding(x + size, y, width - size, y + size, (int) colors.x(), (int) colors.z());
        drawMCVerticalBuilding(x, y, x + size, height, (int) colors.z(), (int) colors.x());

        drawMCVerticalBuilding(width - size, y, width, height, (int) colors.x(), (int) colors.z());
        drawMCHorizontalBuilding(x + size, height - size, width - size, height, (int) colors.z(), (int) colors.x());
    }
 
    public static void drawRectBuilding(
            double left,
            double top,
            double right,
            double bottom,
            int color) {
        if (left < right) {
            double i = left;
            left = right;
            right = i;
        }

        if (top < bottom) {
            double j = top;
            top = bottom;
            bottom = j;
        }

        float f3 = (float) (color >> 24 & 255) / 255.0F;
        float f = (float) (color >> 16 & 255) / 255.0F;
        float f1 = (float) (color >> 8 & 255) / 255.0F;
        float f2 = (float) (color & 255) / 255.0F;
        BufferBuilder bufferbuilder = Tessellator.getInstance().getBuilder();
        bufferbuilder.vertex(left, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, bottom, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(right, top, 0.0F).color(f, f1, f2, f3).endVertex();
        bufferbuilder.vertex(left, top, 0.0F).color(f, f1, f2, f3).endVertex();
    }
 
    public static void drawMCHorizontalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();
        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f1, f2, f3, f).endVertex();
    }

    public static void drawMCVerticalBuilding(double x, double y, double width, double height, int start, int end) {
        float f = (float) (start >> 24 & 255) / 255.0F;
        float f1 = (float) (start >> 16 & 255) / 255.0F;
        float f2 = (float) (start >> 8 & 255) / 255.0F;
        float f3 = (float) (start & 255) / 255.0F;
        float f4 = (float) (end >> 24 & 255) / 255.0F;
        float f5 = (float) (end >> 16 & 255) / 255.0F;
        float f6 = (float) (end >> 8 & 255) / 255.0F;
        float f7 = (float) (end & 255) / 255.0F;


        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuilder();

        bufferbuilder.vertex(x, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, height, 0f).color(f1, f2, f3, f).endVertex();
        bufferbuilder.vertex(width, y, 0f).color(f5, f6, f7, f4).endVertex();
        bufferbuilder.vertex(x, y, 0f).color(f5, f6, f7, f4).endVertex();
    }
}
SS:
Посмотреть вложение 295253
Посмотреть вложение 295254

upd:
фикс есп, если у вас есть допустим хитбоксы в чите (чтобы их не раздувало нахуй как шарик)

Java:
/**/

double x = MathUtil.interpolate(entity.getX(), entity.xOld, e.getPartialTicks());
double y = MathUtil.interpolate(entity.getY(), entity.yOld, e.getPartialTicks());
double z = MathUtil.interpolate(entity.getZ(), entity.zOld, e.getPartialTicks());

AxisAlignedBB aabb;
if (entity instanceof PlayerEntity) {
    aabb = new AxisAlignedBB(
    x - 0.3,
    y,
    z - 0.3,
    x + 0.3,
    y + entity.getBoundingBox().getYsize(),
    z + 0.3
    );
} else {
    Vector3d size = new Vector3d(
        entity.getBoundingBox().maxX - entity.getBoundingBox().minX,
        entity.getBoundingBox().maxY - entity.getBoundingBox().minY,
        entity.getBoundingBox().maxZ - entity.getBoundingBox().minZ
    );
    aabb = new AxisAlignedBB(
        x - size.x / 2f,
        y,
        z - size.z / 2f,
        x + size.x / 2f,
        y + size.y,
        z + size.z / 2f
    );
}
рап.png
 
Похожие темы
Сверху Снизу