Posted October 9, 201311 yr hi, i created a custom modeled block with a tileentityspecialrenderer, tileentity, IItemRenderer and a Block file. now when i go too far from this block, it stop being rendered, and, of course, it renders again when i back. I want this block to have a normal rendering distance like other blocks Actually i don't know what to write in this signature soooo.... anyway
October 9, 201311 yr Try override and increse this in your TE: @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { return 4096.0D; } mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
October 9, 201311 yr Author Try override and increse this in your TE: @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { return 4096.0D; } Thank you, but is there a way to change 4096.0D to the dynamic "Max Rendering Distance" Setting value? Actually i don't know what to write in this signature soooo.... anyway
October 9, 201311 yr I would guess the render distance can be obtained from that (but I didn't test it, you have to try it on your own): FMLClientHandler.instance().getClient().gameSettings.renderDistance mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
October 10, 201311 yr Author I would guess the render distance can be obtained from that (but I didn't test it, you have to try it on your own): FMLClientHandler.instance().getClient().gameSettings.renderDistance i did it and now the object doesn't render, i can see only the box Actually i don't know what to write in this signature soooo.... anyway
October 10, 201311 yr Author I would guess the render distance can be obtained from that (but I didn't test it, you have to try it on your own): FMLClientHandler.instance().getClient().gameSettings.renderDistance Ok i got something the int renderdistance may be 1, 2, 3... and each number indicates the render distances (normal, small, tiny....) so public double getMaxRenderDistanceSquared() { if (FMLClientHandler.instance().getClient().gameSettings.renderDistance == 1) {return WHATEVER;} else if.... } so now to make it right i have to replace WHATEVER with the correct render distance value for each option.... the problem is, what are those values? Actually i don't know what to write in this signature soooo.... anyway
October 10, 201311 yr Chunks get rendered up to (64 << (3 - renderDistance)) or 400 blocks, whatever is bigger, far. The far clipping plane (which "cuts off" the rendering) is at (256 >> renderDistance) meters (blocks) in the direction your camera is pointing at. ItemBlock is not a Block ItemStack is not an Item Damage value is not metadata Stop confusing them.
October 10, 201311 yr Author Chunks get rendered up to (64 << (3 - renderDistance)) or 400 blocks, whatever is bigger, far. The far clipping plane (which "cuts off" the rendering) is at (256 >> renderDistance) meters (blocks) in the direction your camera is pointing at. Do you know if is there a way to render a block like mine like any other blocks in a chunk (like Piston block does)? I mean, rendering it as a block and not like an entity anyway i found this code perfect: public double getMaxRenderDistanceSquared() { if (FMLClientHandler.instance().getClient().gameSettings.renderDistance == 0) {return 30000;} else if (FMLClientHandler.instance().getClient().gameSettings.renderDistance == 1) {return 15900;} else if (FMLClientHandler.instance().getClient().gameSettings.renderDistance == 2) {return 4000;} else return 3000; } Actually i don't know what to write in this signature soooo.... anyway
October 10, 201311 yr Hi You only need to use a TileEntity if you're trying to store more information that you can fit into the Block metadata (16 values). There's no need to use TileEntity if you're just wanting to make a block which looks different. Even if you need to use TileEntity for storing extra data, you can usually still render using the Block rendering code only (for example see BlockFurnace.) The only trick is if your custom block has an animation (eg opening the lid like a chest) - then Block Rendering won't help because the Block rendering code only gets called when the block or its metadata are updated. These pages go into a fair bit more detail which might help: http://greyminecraftcoder.blogspot.com.au/2013/07/block-rendering.html http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html (has example of ISimpleBlockRenderingHandler). http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html -TGG
October 11, 201311 yr Author Hi You only need to use a TileEntity if you're trying to store more information that you can fit into the Block metadata (16 values). There's no need to use TileEntity if you're just wanting to make a block which looks different. Even if you need to use TileEntity for storing extra data, you can usually still render using the Block rendering code only (for example see BlockFurnace.) The only trick is if your custom block has an animation (eg opening the lid like a chest) - then Block Rendering won't help because the Block rendering code only gets called when the block or its metadata are updated. These pages go into a fair bit more detail which might help: http://greyminecraftcoder.blogspot.com.au/2013/07/block-rendering.html http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html (has example of ISimpleBlockRenderingHandler). http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html -TGG how could I render my block (wich has a custom model) without the tileentity? how should i change this code (i of course have to keep tileeentityspecialrenderer) GlaciaColumn = new BlockGlaciaColumn(224 ,net.minecraft.src.TileEntityGlaciaColumn.class).setResistance(0.5F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("Column").setHardness(0.5f); RenderGlaciaColumn ENTColumn = new RenderGlaciaColumn(); ModLoader.registerTileEntity(net.minecraft.src.TileEntityGlaciaColumn.class, "TileEntityGlaciaColumn",ENTColumn); MinecraftForgeClient.registerItemRenderer(GlaciaColumn.blockID, new RenderItemGlaciaColumn()); PS: if i use my custom model and GL11 in a render that implements ISimpleBlockRenderingHandler, how could i bind a texture to it? Actually i don't know what to write in this signature soooo.... anyway
October 11, 201311 yr You bind texture with gl11 just like you would for any gui or other bind texture call. A gui texture 1.6 google search should give you the code line as I cant recall it atm. If you guys dont get it.. then well ya.. try harder...
October 11, 201311 yr Author You bind texture with gl11 just like you would for any gui or other bind texture call. A gui texture 1.6 google search should give you the code line as I cant recall it atm. i'm a little confused now Actually i don't know what to write in this signature soooo.... anyway
October 11, 201311 yr From memory I think it's like this: GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture(texture)); With texture being a ResourceLocation If you guys dont get it.. then well ya.. try harder...
October 11, 201311 yr He means you can simply use GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID) with textureID being an integer with the (OpenGL-internal) texture number, usually from GL11.glGenTextures(), which you previously assigned some image data to via GL11.glTexImage2D(), GL11.GL11.glTexSubImage2D() or similar methods. If you have the textures referenced as Minecraft's ResourceLocation though (and you should), it can do all of it for you "automagically" by simply calling Minecraft.getMinecraft().renderEngine.bindTexture(textureResourceLocation). ItemBlock is not a Block ItemStack is not an Item Damage value is not metadata Stop confusing them.
October 11, 201311 yr Author He means you can simply use GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID) with textureID being an integer with the (OpenGL-internal) texture number, usually from GL11.glGenTextures(), which you previously assigned some image data to via GL11.glTexImage2D(), GL11.GL11.glTexSubImage2D() or similar methods. If you have the textures referenced as Minecraft's ResourceLocation though (and you should), it can do all of it for you "automagically" by simply calling Minecraft.getMinecraft().renderEngine.bindTexture(textureResourceLocation). ok i really need an example.... let's suppose my texture is "assets/minecraft/textures/entity/MYTEXTURE.png" how should the whole code wich assigns the texture to the model (created with techne) look like? Actually i don't know what to write in this signature soooo.... anyway
October 11, 201311 yr He means you can simply use GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID) with textureID being an integer with the (OpenGL-internal) texture number, usually from GL11.glGenTextures(), which you previously assigned some image data to via GL11.glTexImage2D(), GL11.GL11.glTexSubImage2D() or similar methods. If you have the textures referenced as Minecraft's ResourceLocation though (and you should), it can do all of it for you "automagically" by simply calling Minecraft.getMinecraft().renderEngine.bindTexture(textureResourceLocation). ok i really need an example.... let's suppose my texture is "assets/minecraft/textures/entity/MYTEXTURE.png" DON'T. Mod resources go into "assets/(modID, lower case)" and no-where else. In other words, this should be "assets/modid/textures/entity/MYTEXTURE.png" how should the whole code wich assigns the texture to the model (created with techne) look like? In your entity renderer (extends one of the sub-classes of net.minecraft.classes.renderer.entity.Render): private static final ResourceLocation texture = new ResourceLocation("modid", "textures/entity/MYTEXTURE.png"); @Override protected ResourceLocation getEntityTexture(Entity entity) { return texture; } That's it. It gets automatically called for entities which use that (for example by RenderLiving.renderModel() if you extend RenderLiving). If you want to implement your own doRender(Entity entity, double posX, double posY, double posZ, float yaw, float partialTickTime) method, that's how you bind it and then call the model to render: bindEntityTexture(entity); renderLivingAt(entity, posX, posY, posZ); // or use GL11.glTranslatef() yourself /* Remember to rotate the entity properly if needed, via GL11.glRotatef() or the helper function rotateCorpse() if you're rendering a living */ /* Calculate the other animation-related values for the next call */ mainModel.render(entity, limbSwingTime, limbSwingMaxDist, entity.ticksExisted + partialTickTime, headRotY, headRotX, scale); ItemBlock is not a Block ItemStack is not an Item Damage value is not metadata Stop confusing them.
October 11, 201311 yr Author He means you can simply use GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID) with textureID being an integer with the (OpenGL-internal) texture number, usually from GL11.glGenTextures(), which you previously assigned some image data to via GL11.glTexImage2D(), GL11.GL11.glTexSubImage2D() or similar methods. If you have the textures referenced as Minecraft's ResourceLocation though (and you should), it can do all of it for you "automagically" by simply calling Minecraft.getMinecraft().renderEngine.bindTexture(textureResourceLocation). ok i really need an example.... let's suppose my texture is "assets/minecraft/textures/entity/MYTEXTURE.png" DON'T. Mod resources go into "assets/(modID, lower case)" and no-where else. In other words, this should be "assets/modid/textures/entity/MYTEXTURE.png" how should the whole code wich assigns the texture to the model (created with techne) look like? In your entity renderer (extends one of the sub-classes of net.minecraft.classes.renderer.entity.Render): private static final ResourceLocation texture = new ResourceLocation("modid", "textures/entity/MYTEXTURE.png"); @Override protected ResourceLocation getEntityTexture(Entity entity) { return texture; } That's it. It gets automatically called for entities which use that (for example by RenderLiving.renderModel() if you extend RenderLiving). If you want to implement your own doRender(Entity entity, double posX, double posY, double posZ, float yaw, float partialTickTime) method, that's how you bind it and then call the model to render: bindEntityTexture(entity); renderLivingAt(entity, posX, posY, posZ); // or use GL11.glTranslatef() yourself /* Remember to rotate the entity properly if needed, via GL11.glRotatef() or the helper function rotateCorpse() if you're rendering a living */ /* Calculate the other animation-related values for the next call */ mainModel.render(entity, limbSwingTime, limbSwingMaxDist, entity.ticksExisted + partialTickTime, headRotY, headRotX, scale); I'm trying to render a custom modeled block, not an'entity Actually i don't know what to write in this signature soooo.... anyway
October 11, 201311 yr What is meant for you above is that the correct way which I couldn't recall while at work was this: ResourceLocation texture = new ResourceLocation("modid", "textures/block/MYTEXTURE.png"); Minecraft.getMinecraft().renderEngine.bindTexture(texture ). If you guys dont get it.. then well ya.. try harder...
October 11, 201311 yr Author What is meant for you above is that the correct way which I couldn't recall while at work was this: ResourceLocation texture = new ResourceLocation("modid", "textures/block/MYTEXTURE.png"); Minecraft.getMinecraft().renderEngine.bindTexture(texture ). anyway i can't do this with modelWHATEVER and GL11, strangely, the block doesn't render. i'll do it with tessellator, but i dunno how to take only a part of texture to assign to a specific face es: in texturewhatever.png i want to assign the texture that goes from pixel(12,3) to pixel(23,5) and how to assign different texture parts to any tessellactor face Actually i don't know what to write in this signature soooo.... anyway
October 11, 201311 yr Hi This might help http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html -TGG
October 11, 201311 yr This might help http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html A little forewarning. The tessellator is very difficult to work with. When I was working on rail bridges (can't find any pictures) I spent probably 4 hours individually drawing planes with the tessellator to get it to look right. I kept getting them backwards, or in the wrong place, even twisted on a few occasions. 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.
October 11, 201311 yr Author This might help http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html A little forewarning. The tessellator is very difficult to work with. When I was working on rail bridges (can't find any pictures) I spent probably 4 hours individually drawing planes with the tessellator to get it to look right. I kept getting them backwards, or in the wrong place, even twisted on a few occasions. I tried it out, it doesn't seem too difficult, just a bit time expensive No... very time expensive, my block have 4 shapes based on its metadata Actually i don't know what to write in this signature soooo.... anyway
October 13, 201311 yr Author This might help http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html A little forewarning. The tessellator is very difficult to work with. When I was working on rail bridges (can't find any pictures) I spent probably 4 hours individually drawing planes with the tessellator to get it to look right. I kept getting them backwards, or in the wrong place, even twisted on a few occasions. So you have experience with tessellator... could you help me i have another problem, the block, when destroyng, doesn't show the destroying animation and it only glows more details and codes in the other topic: http://www.minecraftforge.net/forum/index.php/topic,13032.0.html Actually i don't know what to write in this signature soooo.... anyway
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.