Визуальная часть BlockHighlater 2 exp 3.1

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
7 Фев 2024
Сообщения
31
Реакции
0
Выберите загрузчик игры
  1. OptiFine
Решил доработать этот BlockHighlater

Код:
Expand Collapse Copy
package ru.vorkis.functions.impl.player;

import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;
import ru.vorkis.events.WorldEvent;
import ru.vorkis.functions.api.Category;
import ru.vorkis.functions.api.Function;
import ru.vorkis.functions.api.FunctionRegister;

@FunctionRegister(name = "BlockHighlighter", type = Category.RENDER)
public class BlockRecast extends Function {
    private final Minecraft mc = Minecraft.getInstance();
    @Subscribe
    private void onRender(WorldEvent event) {
        if (mc.objectMouseOver == null || mc.objectMouseOver.getType() != RayTraceResult.Type.BLOCK) {
            return;
        }
        BlockRayTraceResult blockHit = (BlockRayTraceResult) mc.objectMouseOver;
        BlockPos blockPos = blockHit.getPos();
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.getBuffer();
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(false);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
        GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        Vector3d cam = mc.getRenderManager().info.getProjectedView();
        double x = blockPos.getX() - cam.x;
        double y = blockPos.getY() - cam.y;
        double z = blockPos.getZ() - cam.z;
        float hue = (System.currentTimeMillis() % 5000L) / 5000.0F;
        int rgb = java.awt.Color.HSBtoRGB(hue, 1.0f, 1.0f);
        int fillColor = (rgb & 0xFFFFFF) | (100 << 24);
        int outlineColor = (rgb & 0xFFFFFF) | (255 << 24);
        float fillR = ((fillColor >> 16) & 0xFF) / 255.0F;
        float fillG = ((fillColor >> 8) & 0xFF) / 255.0F;
        float fillB = (fillColor & 0xFF) / 255.0F;
        float outlineR = ((outlineColor >> 16) & 0xFF) / 255.0F;
        float outlineG = ((outlineColor >> 8) & 0xFF) / 255.0F;
        float outlineB = (outlineColor & 0xFF) / 255.0F;
        GL11.glColor4f(fillR, fillG, fillB, 0.25f);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
        double expand = 0.002;
        drawBox(buffer, x, y, z, 1.0 + expand, 1.0 + expand, expand);
        tessellator.draw();
        GL11.glLineWidth(3.0F); // Толще линия для glow эффекта
        GL11.glColor4f(outlineR, outlineG, outlineB, 0.8f);
        drawBoxOutline(tessellator, buffer, x, y, z, 1.002, 1.002, 0.002);
        GL11.glLineWidth(6.0F);
        GL11.glColor4f(outlineR, outlineG, outlineB, 0.25f);
        drawBoxOutline(tessellator, buffer, x, y, z, 1.004, 1.004, 0.004);
        GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glPopMatrix();
    }

    private void drawBox(BufferBuilder buffer, double x, double y, double z, double w, double h, double offset) {
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
    }

    private void drawBoxOutline(Tessellator tess, BufferBuilder buffer, double x, double y, double z, double w, double h, double o) {
        buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        tess.draw();
    }
}
 

Вложения

  • Снимок экрана 2025-10-05 125302.png
    Снимок экрана 2025-10-05 125302.png
    127.4 KB · Просмотры: 84
чем ты его доработал? убрал альфу и сделал красный цвет? интересно
 
Решил доработать этот BlockHighlater

Код:
Expand Collapse Copy
package ru.vorkis.functions.impl.player;

import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;
import ru.vorkis.events.WorldEvent;
import ru.vorkis.functions.api.Category;
import ru.vorkis.functions.api.Function;
import ru.vorkis.functions.api.FunctionRegister;

@FunctionRegister(name = "BlockHighlighter", type = Category.RENDER)
public class BlockRecast extends Function {
    private final Minecraft mc = Minecraft.getInstance();
    @Subscribe
    private void onRender(WorldEvent event) {
        if (mc.objectMouseOver == null || mc.objectMouseOver.getType() != RayTraceResult.Type.BLOCK) {
            return;
        }
        BlockRayTraceResult blockHit = (BlockRayTraceResult) mc.objectMouseOver;
        BlockPos blockPos = blockHit.getPos();
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.getBuffer();
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(false);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
        GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        Vector3d cam = mc.getRenderManager().info.getProjectedView();
        double x = blockPos.getX() - cam.x;
        double y = blockPos.getY() - cam.y;
        double z = blockPos.getZ() - cam.z;
        float hue = (System.currentTimeMillis() % 5000L) / 5000.0F;
        int rgb = java.awt.Color.HSBtoRGB(hue, 1.0f, 1.0f);
        int fillColor = (rgb & 0xFFFFFF) | (100 << 24);
        int outlineColor = (rgb & 0xFFFFFF) | (255 << 24);
        float fillR = ((fillColor >> 16) & 0xFF) / 255.0F;
        float fillG = ((fillColor >> 8) & 0xFF) / 255.0F;
        float fillB = (fillColor & 0xFF) / 255.0F;
        float outlineR = ((outlineColor >> 16) & 0xFF) / 255.0F;
        float outlineG = ((outlineColor >> 8) & 0xFF) / 255.0F;
        float outlineB = (outlineColor & 0xFF) / 255.0F;
        GL11.glColor4f(fillR, fillG, fillB, 0.25f);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
        double expand = 0.002;
        drawBox(buffer, x, y, z, 1.0 + expand, 1.0 + expand, expand);
        tessellator.draw();
        GL11.glLineWidth(3.0F); // Толще линия для glow эффекта
        GL11.glColor4f(outlineR, outlineG, outlineB, 0.8f);
        drawBoxOutline(tessellator, buffer, x, y, z, 1.002, 1.002, 0.002);
        GL11.glLineWidth(6.0F);
        GL11.glColor4f(outlineR, outlineG, outlineB, 0.25f);
        drawBoxOutline(tessellator, buffer, x, y, z, 1.004, 1.004, 0.004);
        GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glPopMatrix();
    }

    private void drawBox(BufferBuilder buffer, double x, double y, double z, double w, double h, double offset) {
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
    }

    private void drawBoxOutline(Tessellator tess, BufferBuilder buffer, double x, double y, double z, double w, double h, double o) {
        buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        tess.draw();
    }
}
какое же дерьмо позорное) мало того что ты в гпт закинул так ты еще и блум не смог сделать и сделал какую то парашу
 
Почему это выглядит так убого
 
Решил доработать этот BlockHighlater

Код:
Expand Collapse Copy
package ru.vorkis.functions.impl.player;

import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;
import ru.vorkis.events.WorldEvent;
import ru.vorkis.functions.api.Category;
import ru.vorkis.functions.api.Function;
import ru.vorkis.functions.api.FunctionRegister;

@FunctionRegister(name = "BlockHighlighter", type = Category.RENDER)
public class BlockRecast extends Function {
    private final Minecraft mc = Minecraft.getInstance();
    @Subscribe
    private void onRender(WorldEvent event) {
        if (mc.objectMouseOver == null || mc.objectMouseOver.getType() != RayTraceResult.Type.BLOCK) {
            return;
        }
        BlockRayTraceResult blockHit = (BlockRayTraceResult) mc.objectMouseOver;
        BlockPos blockPos = blockHit.getPos();
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.getBuffer();
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(false);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
        GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
        GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        Vector3d cam = mc.getRenderManager().info.getProjectedView();
        double x = blockPos.getX() - cam.x;
        double y = blockPos.getY() - cam.y;
        double z = blockPos.getZ() - cam.z;
        float hue = (System.currentTimeMillis() % 5000L) / 5000.0F;
        int rgb = java.awt.Color.HSBtoRGB(hue, 1.0f, 1.0f);
        int fillColor = (rgb & 0xFFFFFF) | (100 << 24);
        int outlineColor = (rgb & 0xFFFFFF) | (255 << 24);
        float fillR = ((fillColor >> 16) & 0xFF) / 255.0F;
        float fillG = ((fillColor >> 8) & 0xFF) / 255.0F;
        float fillB = (fillColor & 0xFF) / 255.0F;
        float outlineR = ((outlineColor >> 16) & 0xFF) / 255.0F;
        float outlineG = ((outlineColor >> 8) & 0xFF) / 255.0F;
        float outlineB = (outlineColor & 0xFF) / 255.0F;
        GL11.glColor4f(fillR, fillG, fillB, 0.25f);
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
        double expand = 0.002;
        drawBox(buffer, x, y, z, 1.0 + expand, 1.0 + expand, expand);
        tessellator.draw();
        GL11.glLineWidth(3.0F); // Толще линия для glow эффекта
        GL11.glColor4f(outlineR, outlineG, outlineB, 0.8f);
        drawBoxOutline(tessellator, buffer, x, y, z, 1.002, 1.002, 0.002);
        GL11.glLineWidth(6.0F);
        GL11.glColor4f(outlineR, outlineG, outlineB, 0.25f);
        drawBoxOutline(tessellator, buffer, x, y, z, 1.004, 1.004, 0.004);
        GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glPopMatrix();
    }

    private void drawBox(BufferBuilder buffer, double x, double y, double z, double w, double h, double offset) {
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
    }

    private void drawBoxOutline(Tessellator tess, BufferBuilder buffer, double x, double y, double z, double w, double h, double o) {
        buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x, y, z).endVertex();
        buffer.pos(x, y + h, z).endVertex();
        buffer.pos(x + w, y, z).endVertex();
        buffer.pos(x + w, y + h, z).endVertex();
        buffer.pos(x + w, y, z + w).endVertex();
        buffer.pos(x + w, y + h, z + w).endVertex();
        buffer.pos(x, y, z + w).endVertex();
        buffer.pos(x, y + h, z + w).endVertex();
        tess.draw();
    }
}
у меня и то лучше было
 
Назад
Сверху Снизу