Lothrazar Posted November 27, 2015 Share Posted November 27, 2015 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] Quote http://www.curse.com/users/Lothrazar/projects Link to comment Share on other sites More sharing options...
Lothrazar Posted November 28, 2015 Author Share Posted November 28, 2015 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 Quote http://www.curse.com/users/Lothrazar/projects Link to comment Share on other sites More sharing options...
The_Fireplace Posted November 28, 2015 Share Posted November 28, 2015 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. Quote If I helped please press the Thank You button. Check out my mods at http://www.curse.com/users/The_Fireplace/projects Link to comment Share on other sites More sharing options...
Degubi Posted November 28, 2015 Share Posted November 28, 2015 Take a look at GuiMaiMenu's renderSkybox method. You can see how drawing is done after the WorldRender obj is inited. Quote Link to comment Share on other sites More sharing options...
Draco18s Posted November 28, 2015 Share Posted November 28, 2015 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 Quote 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. Link to comment Share on other sites More sharing options...
Lothrazar Posted November 28, 2015 Author Share Posted November 28, 2015 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! Quote http://www.curse.com/users/Lothrazar/projects Link to comment Share on other sites More sharing options...
Lothrazar Posted November 29, 2015 Author Share Posted November 29, 2015 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. Quote http://www.curse.com/users/Lothrazar/projects Link to comment Share on other sites More sharing options...
FLUFFY2 Posted December 5, 2015 Share Posted December 5, 2015 Thank you Lothrazar, you saved me a lot of time with that! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.