<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Incompréhension du système de rendu]]></title><description><![CDATA[<p dir="auto"><strong>Bonjour</strong>,<br />
J’ai tenté de passer mon TileEntityRenderer de Forge 1.12.2 a Forge 1.15.2. J’ai donc tout adapté (et presque tout transformé) Mais je suis dans l’incompréhension du nouveau système.<br />
Objectivement, je tente de faire le rendu du liquide contenu dans une TileEntity.<br />
J’ai crée mon propre RenderType :</p>
<pre><code>public static RenderType getPedestalRenderType(ResourceLocation resourceLocation) {
        RenderType.State state = RenderType.State.getBuilder()
                .texture(new TextureState(resourceLocation, true, false))
                .cull(CULL_DISABLED)
                .lightmap(LIGHTMAP_DISABLED)
                .transparency(TRANSLUCENT_TRANSPARENCY)
                .build(true);

        return RenderType.makeType(SkillsStones.MOD_ID + ":pedestal_fluid", DefaultVertexFormats.POSITION_COLOR_TEX, GL11.GL_QUADS, 256, true, false, state);
}
</code></pre>
<p dir="auto">Et voila comment je fais le rendu :</p>
<pre><code>private static final float MIN_HEIGHT = 0.5625f;
    private static final float MAX_HEIGHT = 0.78125f;

    @Override
    public void render(TileEntityNaturalTotemPedestal tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
        Minecraft.getInstance().getProfiler().startSection("pedestalFluidRenderer");

        float level = ((float) tileEntityIn.getFluidTank().getFluidAmount()) / (float) tileEntityIn.getFluidTank().getCapacity();
        if(!(level &gt; 0)) return;

        Fluid fluid = tileEntityIn.getFluidTank().getFluid().getFluid();

        ResourceLocation resourceLocation;
        int color;
        if(fluid.getAttributes().getStillTexture() != null) {
            resourceLocation = fluid.getAttributes().getStillTexture();
            color = getFluidColor(tileEntityIn.getWorld(), tileEntityIn.getPos(), fluid);
        } else if(fluid.getAttributes().getFlowingTexture() != null) {  // In case that Still Texture don't exist
            resourceLocation = fluid.getAttributes().getFlowingTexture();
            color = getFluidColor(tileEntityIn.getWorld(), tileEntityIn.getPos(), fluid);
        } else { // In case that no texture exist
            resourceLocation = Fluids.WATER.getAttributes().getStillTexture();
            color = getFluidColor(tileEntityIn.getWorld(), tileEntityIn.getPos(), Fluids.WATER);
        }

        TextureAtlasSprite textureAtlasSprite = Minecraft.getInstance().getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply(resourceLocation);

        float uMin = textureAtlasSprite.getMinU();
        float uMax = textureAtlasSprite.getMaxU();
        float vMin = textureAtlasSprite.getMinV();
        float vMax = textureAtlasSprite.getMaxV();

        float a = 1.0F;
        float r = (color &gt;&gt; 16 &amp; 0xFF) / 255.0F;
        float g = (color &gt;&gt; 8 &amp; 0xFF) / 255.0F;
        float b = (color &amp; 0xFF) / 255.0F;

        Matrix4f matrix4f = matrixStackIn.getLast().getMatrix();

        float y = MIN_HEIGHT + (level) * (MAX_HEIGHT - MIN_HEIGHT);

        matrixStackIn.translate(0, y, 0);

        IVertexBuilder buffer = bufferIn.getBuffer(SSRenderType.getPedestalRenderType(resourceLocation));

        buffer.pos(matrix4f, 0, 0, 0).color(r, g, b, a).tex(uMin, vMin).endVertex();
        buffer.pos(matrix4f, 0, 0, 1).color(r, g, b, a).tex(uMin, vMax).endVertex();
        buffer.pos(matrix4f, 1, 0, 1).color(r, g, b, a).tex(uMax, vMax).endVertex();
        buffer.pos(matrix4f, 1, 0, 0).color(r, g, b, a).tex(uMax, vMin).endVertex();

        Minecraft.getInstance().getProfiler().endSection();
    }

    private static int getFluidColor(World world, BlockPos pos, Fluid fluid) {
        if(fluid.isEquivalentTo(Fluids.WATER)) {
            return BiomeColors.getWaterColor(world, pos);
        }

        return fluid.getAttributes().getColor();
}
</code></pre>
<p dir="auto">Avec ce code, la texture ne s’affiche pas et j’ai une erreur comme quoi la texture n’existe pas .</p>
<pre><code>Failed to load texture: minecraft:block/water_still
java.io.FileNotFoundException: minecraft:block/water_still
</code></pre>
<p dir="auto">Par contre, la couleur marche.<br />
Néanmoins en hardcodant la texture avec la ResourceLocation suivante :</p>
<pre><code>new ResourceLocation("minecraft:textures/block/water_still.png");
</code></pre>
<p dir="auto">C’est fonctionnel mais la texture buggé (voir photo 1) (j’ai désactivé la transparence pour mieux voir)</p>
<p dir="auto"><img src="https://image.noelshack.com/fichiers/2020/28/6/1594462642-2020-07-11-12-16-33.png" alt="" class=" img-fluid img-markdown" /><br />
(De plus j’ai l’impression d’avoir un effet bizarre de smooth)</p>
<p dir="auto">C’est très étrange, je sais pas si je suis sur une fausse piste ou j’ai fais une erreur.<br />
Merci.</p>
<p dir="auto">Bonne journée.</p>
]]></description><link>https://www.minecraftforgefrance.fr/topic/6291/incompréhension-du-système-de-rendu</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 20:51:55 GMT</lastBuildDate><atom:link href="https://www.minecraftforgefrance.fr/topic/6291.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 11 Jul 2020 10:18:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Incompréhension du système de rendu on Sun, 12 Jul 2020 06:47:09 GMT]]></title><description><![CDATA[<p dir="auto">Bonjour,<br />
Je te remercie pour ces précisions, je vais essayer ça !</p>
<p dir="auto"><strong>EDIT :</strong></p>
<p dir="auto">Ca fonctionne !</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/71982</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/71982</guid><dc:creator><![CDATA[Zeide]]></dc:creator><pubDate>Sun, 12 Jul 2020 06:47:09 GMT</pubDate></item><item><title><![CDATA[Reply to Incompréhension du système de rendu on Sun, 12 Jul 2020 00:21:04 GMT]]></title><description><![CDATA[<p dir="auto">Bonjour, j’admets que depuis la refonte du système de rendu les choses sont devenues légèrement plus compliqués.<br />
Premièrement il n’est pas nécessaire de créer un nouveau RenderType pour faire ce type de rendu, tu peux simplement utiliser: <em>RenderType.getSolid</em>. Pour ce qui est des vertex ceux-ci s’adaptent en fonction du format utilisé par le RenderType,  pour celui que je viens de t’énoncer il aura besoin d’une position, d’une couleur, d’un uv de texture, d’une lightmap et enfin de normals.<br />
Si la texture n’est pas correctement rendue c’est soit que le problème vient du sprite, soit qu’il vient de l’UV utilisé, par souci de compréhension je vais t’indiquer la marche à suivre, déjà si tu veux récupérer les sprites d’un Fluid la méthode <em>ForgeHooksClient.getFluidSprites</em> est très efficace et bien plus simple, tu pourras ensuite choisir lequel utiliser, ensuite ta façon de décoder la couleur et de récupérer les UV sont étranges à mon goût, voici une solution à ces deux problèmes:</p>
<pre><code class="java">//Pour les UV
float minU = sprite.getMinU();
float maxU = Math.min(minU+(sprite.getMaxU()-minU)*longueur, sprite.getMaxU());
float minV = sprite.getMinV();
float maxV = Math.min(minV+(sprite.getMaxV()-minV)*largeur, sprite.getMaxV());

//Pour les couleurs
float r = (color &gt;&gt; 16 &amp; 255) / 255.0F;
float g = (color &gt;&gt; 8 &amp; 255) / 255.0F;
float b = (color &amp; 255) / 255.0F;
</code></pre>
<p dir="auto">Dis moi si tu as besoin de quelques précisions en plus.</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/71981</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/71981</guid><dc:creator><![CDATA[Twiguinou]]></dc:creator><pubDate>Sun, 12 Jul 2020 00:21:04 GMT</pubDate></item></channel></rss>