Posted November 5, 201410 yr comment_127647 Hello, I am making a mod with a block with 16*16 cubes in a block so 256 cubes in the model, and when I try to render it, it causes the fps to drop the more that are placed, this is caused by the for loop I think. I don't know if there is an alternative to this. Thanks. Also, the cubes have to be individual, because I am going to have a gui, so the user can remove cubes and path redstone down them etc. So I need each cube to be removable Model Code: package com.tattyseal.circuits.client.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; /** * Created by Toby on 04/11/2014. */ public class ModelCircuitBoard extends ModelBase { public ModelRenderer[] etchings; public ModelRenderer base; public ModelCircuitBoard() { etchings = new ModelRenderer[16 * 16 + 1]; int id = 0; for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { etchings[id] = new ModelRenderer(this, 0, 0); //* Creates a textured box. Args: originX, originY, originZ, width, height, depth, scaleFactor. etchings[id].addBox(x, 0, z, 1, 1, 1, 0.0f); id++; } } } } Renderer Code: package com.tattyseal.circuits.client.renderer; import com.tattyseal.circuits.client.model.ModelCircuitBoard; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import org.lwjgl.opengl.GL11; /** * Created by Toby on 04/11/2014. */ public class RenderCircuitBoard extends TileEntitySpecialRenderer { public ModelCircuitBoard model; public RenderCircuitBoard() { this.model = new ModelCircuitBoard(); } @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); for(ModelRenderer renderer : model.etchings) { if(renderer != null) renderer.render(0.0625f); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); } }
November 5, 201410 yr comment_127659 You realize that one of your TEs is worth 3072 triangles, right? A standard block is 12... 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.
November 6, 201410 yr comment_127699 So your 16x16 structure is placed and removed at once? If so, why not making a model with only one block which occupies that space? Then have one TE render it and the rest just won't render anything. Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
November 6, 201410 yr comment_127716 Maybe I don't quite understand the structure your trying to make, but what is specific reason you need TESR? What is the rendering doing that needs to update every tick? Otherwise can't this be done with normal custom blocks? Why can't you just place blocks like normal and "move" them by destroying and swapping block placements? Also is an ISBRH useful for what you want to do -- are the changes in the rendering only when blocks are "moved"? Check out my tutorials here: http://jabelarminecraft.blogspot.com/
November 6, 201410 yr comment_127721 I think ISBRH is appropriate for this purpose, as jabelar said. You can use worldObj.markBlockForUpdate(xCoord, yCoord, zCoord) when it is changed. It will call the render to update block rendering. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
November 6, 201410 yr comment_127727 Hi If you don't need your model to update every frame, you could compile your model to a render list. That is quite a bit faster. 256*6 faces takes very little time at all to render. For example that's what I used in this mod to show the blocks being copied. http://www.planetminecraft.com/mod/build-faster--four-tools-to-make-your-creative-life-easier/ Alternatively, you could create a renderlist for a cube, then render the renderlist at each cube location (using glTranslate) using your for loop. That's probably much faster than the model renderer. -TGG
November 6, 201410 yr comment_127728 Forgot to mention - what you're doing sounds very similar to how vanilla takes an item's icon and gives it thickness when rendering in the hand. It might help to look at that (i.e. each of your cubes is one texel of the item icon). http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-first-person-view-items.html ItemRenderer.renderItemIn2D() -TGG
November 6, 201410 yr Author comment_127741 Hi If you don't need your model to update every frame, you could compile your model to a render list. That is quite a bit faster. 256*6 faces takes very little time at all to render. For example that's what I used in this mod to show the blocks being copied. http://www.planetminecraft.com/mod/build-faster--four-tools-to-make-your-creative-life-easier/ Alternatively, you could create a renderlist for a cube, then render the renderlist at each cube location (using glTranslate) using your for loop. That's probably much faster than the model renderer. -TGG After working on a 3D game, I should have thought of a render list I will try that. Thanks
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.