• Я зарабатываю 100 000 RUB / месяц на этом сайте!

    А знаешь как? Я всего-лишь публикую (создаю темы), а админ мне платит. Трачу деньги на мороженое, робуксы и сервера в Minecraft. А ещё на паль из Китая. 

    Хочешь так же? Пиши и узнавай условия: https://t.me/alex_redact
    Реклама: https://t.me/yougame_official

Вопрос Что я не так делаю с рендером в 1.21.8 fabric?

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
30 Май 2025
Сообщения
2
Реакции
0
вот мой рендер -
Код:
Expand Collapse Copy
package ru.refacus.heart.api.util.render;

import com.mojang.blaze3d.pipeline.BlendFunction;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.platform.DepthTestFunction;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.client.gl.UniformType;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.util.Identifier;

public class RenderUtil {
    private final RenderPipeline.Snippet TRANSFORMS_AND_PROJECTION = RenderPipeline.builder()
            .withUniform("DynamicTransforms", UniformType.UNIFORM_BUFFER)
            .withUniform("Projection", UniformType.UNIFORM_BUFFER)
            .buildSnippet();

    private final RenderPipeline.Snippet REFACUS_GUI_SNIPPET = RenderPipeline.builder(TRANSFORMS_AND_PROJECTION)
            .withVertexShader(Identifier.of("refacus", "core/refacus_gui"))
            .withFragmentShader(Identifier.of("refacus", "core/refacus_gui"))
            .withBlend(BlendFunction.TRANSLUCENT)
            .withCull(true)
            .withDepthWrite(true)
            .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
            .withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS)
            .buildSnippet();

    public final RenderPipeline pipeline = RenderPipeline.builder(REFACUS_GUI_SNIPPET)
            .withLocation(Identifier.of("refacus", "pipeline/gui"))
            .build();
            
    public void drawQuad(DrawContext drawContext, int x, int y, int width, int height, int color) {
        drawContext.fill(pipeline, x, y, x + width, y + height, color);
    }
}

вот где я его вызываю -
Код:
Expand Collapse Copy
package ru.refacus.heart.mixins;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.TitleScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import ru.refacus.heart.api.util.render.RenderUtil;

@Mixin(TitleScreen.class)
public class TitleScreenMixin {

    @Inject(method = "render", at = @At("TAIL"))
    private void onRender(DrawContext ctx, int mouseX, int mouseY, float delta, CallbackInfo ci) {
        new RenderUtil().drawQuad(ctx, 10, 10, 100, 100, 0xFFFFFFFF);
    }
}

квадрат просто не рендерится, в логах всё норм, помогите
 
Последнее редактирование модератором:
вот мой рендер -
Код:
Expand Collapse Copy
package ru.refacus.heart.api.util.render;

import com.mojang.blaze3d.pipeline.BlendFunction;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.platform.DepthTestFunction;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.client.gl.UniformType;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.util.Identifier;

public class RenderUtil {
    private final RenderPipeline.Snippet TRANSFORMS_AND_PROJECTION = RenderPipeline.builder()
            .withUniform("DynamicTransforms", UniformType.UNIFORM_BUFFER)
            .withUniform("Projection", UniformType.UNIFORM_BUFFER)
            .buildSnippet();

    private final RenderPipeline.Snippet REFACUS_GUI_SNIPPET = RenderPipeline.builder(TRANSFORMS_AND_PROJECTION)
            .withVertexShader(Identifier.of("refacus", "core/refacus_gui"))
            .withFragmentShader(Identifier.of("refacus", "core/refacus_gui"))
            .withBlend(BlendFunction.TRANSLUCENT)
            .withCull(true)
            .withDepthWrite(true)
            .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
            .withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS)
            .buildSnippet();

    public final RenderPipeline pipeline = RenderPipeline.builder(REFACUS_GUI_SNIPPET)
            .withLocation(Identifier.of("refacus", "pipeline/gui"))
            .build();
           
    public void drawQuad(DrawContext drawContext, int x, int y, int width, int height, int color) {
        drawContext.fill(pipeline, x, y, x + width, y + height, color);
    }
}

вот где я его вызываю -
Код:
Expand Collapse Copy
package ru.refacus.heart.mixins;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.TitleScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import ru.refacus.heart.api.util.render.RenderUtil;

@Mixin(TitleScreen.class)
public class TitleScreenMixin {

    @Inject(method = "render", at = @At("TAIL"))
    private void onRender(DrawContext ctx, int mouseX, int mouseY, float delta, CallbackInfo ci) {
        new RenderUtil().drawQuad(ctx, 10, 10, 100, 100, 0xFFFFFFFF);
    }
}

квадрат просто не рендерится, в логах всё норм, помогите
Братик смотри в методе context.fill()
Убери pipeline
И всё оке будет
 
Назад
Сверху Снизу