Jump to content

Recommended Posts

Posted

I became really annoyed while trying to create a multipart mob and the hitboxes were not visible. It turns out that minecraft does not actually render the hitboxes when pressing F3+B but just a box with a size of width*height*width centered on the mobs position.

 

I modified the code slightly and thought it might be a good idea to incorporate this into forge.

 

Here is the changed function in net.minecraft.client.renderer.entity.RenderManager.java

 

private void func_85094_b(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    {
        //GL11.glDepthMask(false);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glPushMatrix();
        Tessellator var10 = Tessellator.instance;
        var10.startDrawingQuads();
        var10.setColorRGBA(255, 255, 255, 32);
        
        var10.addVertex(par1Entity.boundingBox.minX, par1Entity.boundingBox.minY, par1Entity.boundingBox.minZ);
        var10.addVertex(par1Entity.boundingBox.minX, par1Entity.boundingBox.maxY, par1Entity.boundingBox.minZ);
        var10.addVertex(par1Entity.boundingBox.minX, par1Entity.boundingBox.maxY, par1Entity.boundingBox.maxZ);
        var10.addVertex(par1Entity.boundingBox.minX, par1Entity.boundingBox.minY, par1Entity.boundingBox.maxZ);
                   
        var10.addVertex(par1Entity.boundingBox.minX, par1Entity.boundingBox.minY, par1Entity.boundingBox.minZ);
        var10.addVertex(par1Entity.boundingBox.maxX, par1Entity.boundingBox.minY, par1Entity.boundingBox.minZ);
        var10.addVertex(par1Entity.boundingBox.maxX, par1Entity.boundingBox.maxY, par1Entity.boundingBox.minZ);
        var10.addVertex(par1Entity.boundingBox.minX, par1Entity.boundingBox.maxY, par1Entity.boundingBox.minZ);
                       
        var10.addVertex(par1Entity.boundingBox.maxX, par1Entity.boundingBox.minY, par1Entity.boundingBox.minZ);
        var10.addVertex(par1Entity.boundingBox.maxX, par1Entity.boundingBox.maxY, par1Entity.boundingBox.minZ);
        var10.addVertex(par1Entity.boundingBox.maxX, par1Entity.boundingBox.maxY, par1Entity.boundingBox.maxZ);
        var10.addVertex(par1Entity.boundingBox.maxX, par1Entity.boundingBox.minY, par1Entity.boundingBox.maxZ);
                     
        var10.addVertex(par1Entity.boundingBox.minX, par1Entity.boundingBox.minY, par1Entity.boundingBox.maxZ);
        var10.addVertex(par1Entity.boundingBox.maxX, par1Entity.boundingBox.minY, par1Entity.boundingBox.maxZ);
        var10.addVertex(par1Entity.boundingBox.maxX, par1Entity.boundingBox.maxY, par1Entity.boundingBox.maxZ);
        var10.addVertex(par1Entity.boundingBox.minX, par1Entity.boundingBox.maxY, par1Entity.boundingBox.maxZ);
        
        Entity[] parts = par1Entity.getParts();
        if(parts != null)
        {
        for(Entity part : parts)
        {
            var10.addVertex(part.boundingBox.minX, part.boundingBox.minY, part.boundingBox.minZ);
            var10.addVertex(part.boundingBox.minX, part.boundingBox.maxY, part.boundingBox.minZ);
            var10.addVertex(part.boundingBox.minX, part.boundingBox.maxY, part.boundingBox.maxZ);
            var10.addVertex(part.boundingBox.minX, part.boundingBox.minY, part.boundingBox.maxZ);
                 
            var10.addVertex(part.boundingBox.minX, part.boundingBox.minY, part.boundingBox.minZ);
            var10.addVertex(part.boundingBox.maxX, part.boundingBox.minY, part.boundingBox.minZ);
            var10.addVertex(part.boundingBox.maxX, part.boundingBox.maxY, part.boundingBox.minZ);
            var10.addVertex(part.boundingBox.minX, part.boundingBox.maxY, part.boundingBox.minZ);
               
            var10.addVertex(part.boundingBox.maxX, part.boundingBox.minY, part.boundingBox.minZ);
            var10.addVertex(part.boundingBox.maxX, part.boundingBox.maxY, part.boundingBox.minZ);
            var10.addVertex(part.boundingBox.maxX, part.boundingBox.maxY, part.boundingBox.maxZ);
            var10.addVertex(part.boundingBox.maxX, part.boundingBox.minY, part.boundingBox.maxZ);
                    
            var10.addVertex(part.boundingBox.minX, part.boundingBox.minY, part.boundingBox.maxZ);
            var10.addVertex(part.boundingBox.maxX, part.boundingBox.minY, part.boundingBox.maxZ);
            var10.addVertex(part.boundingBox.maxX, part.boundingBox.maxY, part.boundingBox.maxZ);
            var10.addVertex(part.boundingBox.minX, part.boundingBox.maxY, part.boundingBox.maxZ);
        }
        }
        
        GL11.glTranslatef((float)(par2-par1Entity.posX), (float)(par4-par1Entity.posY), (float)(par6-par1Entity.posZ));
        var10.draw();
        GL11.glPopMatrix();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        //GL11.glDepthMask(true);
    }

  • 4 weeks later...

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.