Jump to content

[1.12.2][SOLVED] IBakedModel no getQuads for Cobblestone Wall


Recommended Posts

Posted (edited)

Hello.

 

I am working on a half transparent model renderer for my mod and for some reason a few blocks are not able to render.

The "getQuads" method of the IBackedModel returns 0 quads for the cobblestone_wall. At the same time, stairs, fences and redstone are not displayed correctly based on their IBlockState.

Only the pure redstone dot and the fence middle post are rendered.

 

Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(state); is what I use to get the model. I also tried to get the model from the ModelManager with the same result.

 

private void renderModel(IBlockState state, IBakedModel model, int color)
    {
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder bufferbuilder = tessellator.getBuffer();
        bufferbuilder.begin(7, DefaultVertexFormats.ITEM);

        for (EnumFacing enumfacing : EnumFacing.values())
        {
            this.renderQuads(bufferbuilder, model.getQuads(state, enumfacing, 0L), color);
        }

        this.renderQuads(bufferbuilder, model.getQuads(state, (EnumFacing)null, 0L), color);
        tessellator.draw();
    }
	
	private void renderQuads(BufferBuilder renderer, List<BakedQuad> quads, int color)
    {
        int i = 0;

      	// cobblestone_wall has 0 quads here.
        for (int j = quads.size(); i < j; ++i)
        {
            BakedQuad bakedquad = quads.get(i);
            int k = color;

            renderQuadColor(renderer, bakedquad, k);
        }
    }

 

Do I miss something? Why does the cobblestone_wall does not show up at all and redstone, stairs and fences only show the default state?

 

Any help would be great!

 

Thanks.

Edited by SatyPardus
Posted (edited)

I obtain the block state currently by direct block to block copy. I have a "ghost" block in my mod that can mimic any block I rightclick. It copies the blockstate of the rightclicked block and puts it on the ghost, then the custom renderer kicks in and renders the block with half transparency.

 

And yes. Every side returns 0.

About the redstone, fence and stairs - They are rendered, but as I said, only the default state with rotation (At least the stairs, the redstone and post are not easy to see if they rotated.

 

Every other block, even door, bed, rails etc work perfectly fine. It's just these 3 that wont work as expected (Which appears really weird for me) - I already tried to see if it might be because they have connected states to other blocks, but I can't figure this out.

 

I also get some debug output from my mod now to doublecheck the sides to return 0 and will edit this post.

 

Edit:

##### Rendermodel Cobblestone Wall #####
Side down: 0 quads
Side up: 0 quads
Side north: 0 quads
Side south: 0 quads
Side west: 0 quads
Side east: 0 quads
Side null: 0 quads
##### Rendermodel Oak fence post - With and without neighbor #####
Side down: 1 quads
Side up: 1 quads
Side north: 0 quads
Side south: 0 quads
Side west: 0 quads
Side east: 0 quads
Side null: 4 quads

 

Edited by SatyPardus
Posted

Oh wow. I could have tested that myself, but didn't knew that there is any difference between them.

You are absolutely right, this fixes it. Even the cobblestone_wall is showing now.

 

Thank you a lot!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.