Jump to content

1.8.8-11.15.0.1591 Looking for worldrenderer functions : startDrawingQuads


Recommended Posts

Posted

Just wondering how to draw an item on the screen in 1.8.8. 

 

It tells me functions dont exist worldrenderer.startDrawingQuads  , worldrenderer.addVertexWithUV

 

In 1.8.0 i would do it like this

 

[embed=425,349]

IBakedModel iBakedModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(stack);

TextureAtlasSprite textureAtlasSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(iBakedModel.getTexture().getIconName());

 

        Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);

Tessellator tessellator = Tessellator.getInstance();

 

int height = dim, width = dim;

WorldRenderer worldrenderer = tessellator.getWorldRenderer();

//worldrenderer.addVertexData(vertexData);

 

worldrenderer.startDrawingQuads();

worldrenderer.addVertexWithUV((double)(x),          (double)(y + height),  0.0, (double)textureAtlasSprite.getMinU(), (double)textureAtlasSprite.getMaxV());

worldrenderer.addVertexWithUV((double)(x + width),  (double)(y + height),  0.0, (double)textureAtlasSprite.getMaxU(), (double)textureAtlasSprite.getMaxV());

worldrenderer.addVertexWithUV((double)(x + width),  (double)(y),          0.0, (double)textureAtlasSprite.getMaxU(), (double)textureAtlasSprite.getMinV());

worldrenderer.addVertexWithUV((double)(x),          (double)(y),          0.0, (double)textureAtlasSprite.getMinU(), (double)textureAtlasSprite.getMinV());

tessellator.draw();

 

[/embed]

Posted

Update / Progress:

 

This is not a full solution, but it looks like

 

worldrenderer.startDrawingQuads();

 

is now done like this

 

worldrenderer.func_181668_a(7, worldrenderer.getVertexFormat());

 

At least, this does not crash. I got the '7' by looking at what it did in 1.8.0 before.

 

Also i know that in 1.8.0 the definition was

 

    public void addVertexWithUV(double p_178985_1_, double p_178985_3_, double p_178985_5_, double p_178985_7_, double p_178985_9_)

    {

        this.setTextureUV(p_178985_7_, p_178985_9_);

        this.addVertex(p_178985_1_, p_178985_3_, p_178985_5_);

    }

 

just an update . I will reply again if i get this fully solved

 

 

Posted

addVertexWithUV has been removed, I believe with the replacements for addTextureUV and addVertex left behind. I haven't quite figured out how to make them and the replacement for startDrawingQuads() work correctly yet, but I think addTextureUV is now func_181673_a and addVertex is now func_181662_b, both with the same arguments as before.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

At least, this does not crash. I got the '7' by looking at what it did in 1.8.0 before.

 

The "7" is essentially a "magic number" that was compiled from an reference constant to its literal value (and thus lost during decompilation).  It's the value that tells OpenGL to render quads:

OpenGL.GL_QUADS

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Thanks The_Fireplace I will try that.

 

"GuiMaiMenu's renderSkybox"  Okay cool I will check it out.

 

"OpenGL.GL_QUADS" 

 

Thanks, I am a noob when it comes to OpenGL.  Thanks everybody.

 

Basically I am using this to render the icons on custom potion effects, and also for the backgrounds of custom GUI's, and the outlines of custom slots.  Also rendering item icons on the f3 screen. 

 

There may be better ways to do all of these things without WorldRender, if so let me know!

 

Posted

I have a solution.  Turns out there is a static function in the GUI class that does exactly this

 

Gui.drawModalRectWithCustomSizedTexture

 

No idea if this was there before 1.8.8 since i was just using code on these forums that used 'draw with uv' from world renderer. (if you look at src of that GUI method, it uses almost the exact strategy we used before using worldrenderer)

 

Below is my full method now, noting that my .png size is 176 by 166 , and :

protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)

{

GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

        this.mc.getTextureManager().bindTexture(table );

        int i = (this.width - this.xSize) / 2;

        int j = (this.height - this.ySize) / 2;

int texture_width = 176;

int texture_height = 166;

int u=0,v=0;

        Gui.drawModalRectWithCustomSizedTexture(i,j, u, v, this.xSize,this.ySize,texture_width, texture_height);

 

 

All my code is on github as "PrinceOfAmber" its all MIT lic.  Thanks to everyone who responded.

 

 

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.