Jump to content

[1.13.2] WorldRenderer Issue


OldManMorris

Recommended Posts

I'm upgrading my mod from 1.12.2 to 1.13.2 and the block highlighting (WorldRenderer.drawSelectionBoundingBox(box, red, green, blue, alpha);) produces a miniature set of block images in a cluster rather than highlighting the blocks themselves as in DrawBlockHighlightEvent. Does anyone know how the new WorlRenderer/Bufferbuilder parameters need to be set? Thanks.

Link to comment
Share on other sites

Post your code.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

12 hours ago, OldManMorris said:

I'm upgrading my mod from 1.12.2 to 1.13.2 and the block highlighting (WorldRenderer.drawSelectionBoundingBox(box, red, green, blue, alpha);) produces a miniature set of block images in a cluster rather than highlighting the blocks themselves as in DrawBlockHighlightEvent. Does anyone know how the new WorlRenderer/Bufferbuilder parameters need to be set? Thanks.

    AxisAlignedBB box = new AxisAlignedBB(pos).expand(1, 1, 1);

        red = ((color >> 16) & 0xff);
        green =((color >> 8) & 0xff) / 255f;
        blue = ((color) & 0xff) / 255f;
        alpha = 1.0f;
        
        GlStateManager.pushMatrix();
        GlStateManager.disableTexture2D();
        GlStateManager.disableDepthTest();
        GlStateManager.enableBlend();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        
        WorldRenderer.drawSelectionBoundingBox(box, red, green, blue, alpha);
        
        GlStateManager.enableDepthTest();
        GlStateManager.disableBlend();
        GlStateManager.enableTexture2D();
        GlStateManager.popMatrix();

Link to comment
Share on other sites

Post your entire code & don’t just copy paste it. Show where the code is being called from etc. A link to a GitHub repository is preferred, but a Gist will usually also work

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

I’m not able to reproduce this, please post a video of the issue

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

If it works for you, then the issue is probably in my configuration somehow. Still can't get it to work but I'm setting it aside for now till I can find 1.13/1.14 example that works. It works fine in my 1.12.2 version.

Again, thanks for your time and help.

Link to comment
Share on other sites

I found the solution inside WorldRenderer. Here's my slightly modified version:

 

BlockPos blockpos = pos;
        IBlockState iblockstate = this.world.getBlockState(blockpos);
        red = ((color >> 16) & 0xff);
        green = ((color >> 8) & 0xff) / 255f;
        blue = ((color) & 0xff) / 255f;
        alpha = 1.0f;
        
        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.disableDepthTest();        
        GlStateManager.lineWidth(3.0F);
        GlStateManager.disableTexture2D();
        GlStateManager.depthMask(false);
        GlStateManager.matrixMode(5889);
        GlStateManager.scalef(1.0F, 1.0F, 0.999F);
        double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
        double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
        double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
        WorldRenderer.drawShape(iblockstate.getShape(this.world, blockpos), (double) blockpos.getX() - d0 - 1,
                (double) blockpos.getY() - d1, (double) blockpos.getZ() - d2, red, green, blue, 1.0F);
        GlStateManager.popMatrix();
        GlStateManager.matrixMode(5888);
        GlStateManager.depthMask(true);
        GlStateManager.enableDepthTest();
        GlStateManager.enableTexture2D();
        GlStateManager.disableBlend();

Link to comment
Share on other sites

Pls use the code block tags

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

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.