Posted July 26, 20178 yr Hello, I'm attempting to change the color of a block (of leaves) dynamically based on how close they are to the end of a progress. I get the model of the leaf to render, but it always renders in greyscale, no matter how I try to modify the color. I've attached my TileEntityRenderer's render function, along with a lot of the debug code I've attempted. Color output looks like this: Color:-4665437 R:0.72156864 G:0.8117647 B:0.6392157 Any help is appreciated. @Override public void render(TileExplosiveLeaves te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { GlStateManager.pushMatrix(); GlStateManager.enableRescaleNormal(); RenderHelper.disableStandardItemLighting(); GlStateManager.enableColorMaterial(); int color = te.getColor().toInt(); float colorRed = (float) (color >> 16 & 255) / 255.0F; float colorGreen = (float) (color >> 8 & 255) / 255.0F; float colorBlue = (float) (color & 255) / 255.0F; float colorAlpha = (float) (color >> 24 & 255) / 255.0F; System.out.println("Color:" + color + " R:" + colorRed + " G:" + colorGreen + " B:" + colorBlue); // GlStateManager.resetColor(); // GL11.glColor3f(color.r, color.g, color.b); // GL11. GlStateManager.enableBlend(); // GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); World world = te.getWorld(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); tessellator.getBuffer().color(colorRed, colorGreen, colorBlue, colorAlpha); Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModel( world, Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(te.getLeafBlock()), world.getBlockState(te.getPos()), te.getPos(), Tessellator.getInstance().getBuffer(), false); tessellator.draw(); // RenderHelper.enableStandardItemLighting(); // GlStateManager.enableLighting(); GlStateManager.popMatrix(); GlStateManager.disableBlend();
July 26, 20178 yr Author The process is fairly fast. The leaves go to black, and from black to color in 2 seconds (or so)
July 26, 20178 yr Author 4 minutes ago, diesieben07 said: Is that process continuous? Or does it happen once? Once per lifetime of the block (which is destroyed after the process)
July 26, 20178 yr Author The colors are dynamic though. So I'd have to define a state for every possible color combination that I want to implement, no?
July 26, 20178 yr Author Biome, type of item used to cause it to explode, how far along in the Exploding process it is.
July 28, 20178 yr Author 17 hours ago, diesieben07 said: Ok, so. If you want a continuous color transition (which you still have not answered!) then you need to indeed stick with the TESR. Otherwise use IBlockColors. In your current TESR method the issue is that the model rendering method you are using already applies the block's "native" color modifier, overwriting yours. Sorry! I thought I did! I do want it to be a continuous. Can you recommend an alternative method to look at for rendering? (I don't need examples, just a general gist will be enough)
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.