Posted April 9, 20178 yr Hello! How to render a white .OBJ model with specified RGB color? TESR: https://pastebin.com/AgEhv513 I'm tried this, but It still not works: Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModel( world, getBakedModel(), world.getBlockState(te.getPos()), te.getPos(), Tessellator.getInstance().getBuffer(), true); tessellator.getBuffer().color(0, 255, 0, 255); tessellator.draw(); Edited April 22, 20178 yr by mrAppleXZ
April 9, 20178 yr I have an on-going project where I use a standard .obj model and have the code create copies of the .obj, .mtl and a .png for particles etc, which includes editing each individual block's colour. This might be well over-the-top depending on how you want to render this model. Is the colour permanent? I mean, it does not change? If so, you would likely only ever need to create a class that implements IBlockColor, override colorMultiplier, and register the class with the wanted block using Minecraft::getBlockColors(). I do this for Items here. Do note that it wants an integer. either convert your rgb values to one, or create a java.awt.Color with these values, and call getRGB(). (Note, you can also use the constant colours like Color#GREEN etc) Edited April 9, 20178 yr by Matryoshika Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
April 9, 20178 yr The following is all you need to turn RGB values into an int. Alpha is forced to 255 (Opaque): public static int rgb(int r,int g,int b) { return (b & 0xFF) | ((g & 0xFF) << 8) | ((r & 0xFF) << 16) | (255 << 24); } -Stu MCI Craft (Curse) | MCI Craft (Website)
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.