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

Вопрос Рендер головы игрока 1.21.8

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
5 Окт 2025
Сообщения
33
Реакции
0
Не получается отрендерить голову игрока И иконки брони на 1.21.8 фабрик

java:
Expand Collapse Copy
 if (target instanceof PlayerEntity player) {
            SkinTextures skin = mc.getSkinProvider().getSkinTextures(player.getGameProfile());


            PlayerSkinDrawer.draw(
                    context,
                    skin.texture(),
                    (int)(b.x() + 6),
                    (int)(b.y() + 6),
                    32,
                    true,
                    false,
                    0xFFFFFFFF
            );
        }

java:
Expand Collapse Copy
if (target instanceof PlayerEntity player) {

            ItemStack[] armor = new ItemStack[] {
                    player.getEquippedStack(EquipmentSlot.HEAD),
                    player.getEquippedStack(EquipmentSlot.CHEST),
                    player.getEquippedStack(EquipmentSlot.LEGS),
                    player.getEquippedStack(EquipmentSlot.FEET)
            };

            for (int i = 0; i < armor.length; i++) {
                ItemStack stack = armor[i];

                if (!stack.isEmpty()) {
                    int x = (int)(b.x() + 6 + 41 + i * 16);
                    int y = (int)(b.y() + b.height() - 18);

                    context.drawItem(stack, x, y);
                    context.drawStackOverlay(mc.textRenderer, stack, x, y);
                }
            }
        }
 
Рисуй через свою рендер систему просто


Пример на 1.21.11:
Expand Collapse Copy
SkinTextures skin = mc.player.getSkin();
Identifier identifier = skin.comp_1626().comp_3627();
AbstractTexture abstractTexture = mc.getTextureManager().getTexture(identifier);

// abstractTexture.getGlTextureView() abstractTexture.getSampler()
 
Рендер:
Expand Collapse Copy
 public static void imageRounded(String resourcePath, float x, float y, float width, float height, float radius, ColorRGBA tint) {
        ensureInit();
        Texture2D texture = texture(resourcePath);
        imageRounded(texture, x, y, width, height, radius, tint);
    }

    private static void imageRounded(Texture2D texture, float x, float y, float width, float height, float radius, ColorRGBA tint) {
        imageRoundedProgram.use();
        imageRoundedProgram.uniform2f("uResolution", resolutionX, resolutionY);
        imageRoundedProgram.uniform4f("uRect", x, y, width, height);
        imageRoundedProgram.uniform1f("uRadius", radius);
        imageRoundedProgram.uniform4f("uColor", tint.r(), tint.g(), tint.b(), tint.a());
        imageRoundedProgram.uniform4f("uUvRect", 0f, 0f, 1f, 1f);
        imageRoundedProgram.uniform1i("uTexture", 0);

        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.id());
        quad.bind();
        quad.draw();
        quad.unbind();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

        ShaderProgram.stop();
    }

    private static Texture2D texture(String resourcePath) {
        Texture2D cached = textureCache.get(resourcePath);
        if (cached != null) {
            return cached;
        }
        Texture2D created = Texture2D.fromPngResource(resourcePath);
        textureCache.put(resourcePath, created);
        return created;
    }

мне нужно путь передавать + твой код не работает на 1.21.8
1774773056869.png
 
Назад
Сверху Снизу