Posted July 30, 201411 yr Is there a way, to get a single Pixel out of a Image, and draw it over an item or a block? I created a Image with all colors I want to use, but I don't want to create over 1000 Icons for my Items and Blocks, I only want them to use a template Texture, and then draw the specific Color from the Pixel of the Texture. For Example I have an Ingot, with white Color(my Template), and then I want to draw over the Color from my Image with all Colors, so I don't need to Create every Icon for every Ingot. Is this possible, and if so, how is this possible? Creator of Extra Shoes Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then
July 30, 201411 yr Is there a way, to get a single Pixel out of a Image, and draw it over an item or a block? I created a Image with all colors I want to use, but I don't want to create over 1000 Icons for my Items and Blocks, I only want them to use a template Texture, and then draw the specific Color from the Pixel of the Texture. For Example I have an Ingot, with white Color(my Template), and then I want to draw over the Color from my Image with all Colors, so I don't need to Create every Icon for every Ingot. Is this possible, and if so, how is this possible? Do I understand it correctly? You want to basically colorize your item? Why not use getColorFromItemStack ? 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.
July 30, 201411 yr Author Is there a way, to get a single Pixel out of a Image, and draw it over an item or a block? I created a Image with all colors I want to use, but I don't want to create over 1000 Icons for my Items and Blocks, I only want them to use a template Texture, and then draw the specific Color from the Pixel of the Texture. For Example I have an Ingot, with white Color(my Template), and then I want to draw over the Color from my Image with all Colors, so I don't need to Create every Icon for every Ingot. Is this possible, and if so, how is this possible? Do I understand it correctly? You want to basically colorize your item? Why not use getColorFromItemStack ? What does getColorFromItemStack? I looked up the code in the Item class, but it only return a Number. What does it? Creator of Extra Shoes Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then
July 30, 201411 yr Is there a way, to get a single Pixel out of a Image, and draw it over an item or a block? I created a Image with all colors I want to use, but I don't want to create over 1000 Icons for my Items and Blocks, I only want them to use a template Texture, and then draw the specific Color from the Pixel of the Texture. For Example I have an Ingot, with white Color(my Template), and then I want to draw over the Color from my Image with all Colors, so I don't need to Create every Icon for every Ingot. Is this possible, and if so, how is this possible? Do I understand it correctly? You want to basically colorize your item? Why not use getColorFromItemStack ? What does getColorFromItemStack? I looked up the code in the Item class, but it only return a Number. What does it? The number returned is a hexadecimal color code. For example the number 0xFF00FF The 0x denotes a hexadecimal number the first FF denotes the amount of red the 00 denotes the amount of green and the last FF denotes the blue color: 0xFF00FF The range of those sections go from 00 to FF, translated into decimal values from 0 to 255 Here is a link for an online color picker, which will give you the hexadecimal value for the selected color: http://www.colorpicker.com/ 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.
July 30, 201411 yr Author Is there a way, to get a single Pixel out of a Image, and draw it over an item or a block? I created a Image with all colors I want to use, but I don't want to create over 1000 Icons for my Items and Blocks, I only want them to use a template Texture, and then draw the specific Color from the Pixel of the Texture. For Example I have an Ingot, with white Color(my Template), and then I want to draw over the Color from my Image with all Colors, so I don't need to Create every Icon for every Ingot. Is this possible, and if so, how is this possible? Do I understand it correctly? You want to basically colorize your item? Why not use getColorFromItemStack ? What does getColorFromItemStack? I looked up the code in the Item class, but it only return a Number. What does it? The number returned is a hexadecimal color code. For example the number 0xFF00FF The 0x denotes a hexadecimal number the first FF denotes the amount of red the 00 denotes the amount of green and the last FF denotes the blue color: 0xFF00FF The range of those sections go from 00 to FF, translated into decimal values from 0 to 255 Here is a link for an online color picker, which will give you the hexadecimal value for the selected color: http://www.colorpicker.com/ I already figured out, that the number is a hexadecimalcode, but I have actually no Idea, how to change the Colors of a Specific Pixel Creator of Extra Shoes Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then
July 30, 201411 yr An approach to this would be using different blend modes. If you want to get into OpenGL, you might want to look into shaders, but that might be a bit complex. --- Alternatively, you can try GL11.glColor3b() and GL11.glBlendFunc(). The first takes the rgb components of the color (use bitwise operators to get the bits from the integer). The second takes some constants from GL11. You would use a base texture that's grayscale and draw that normally. Then call the color and blendfunc methods. Then draw a second texture that's all white above the first. The color method should change the all white texture to your color, and the blendfunc will blend that in with the gray texture. (You'll probably have to play around with the blendfunc method a bit before getting something you like.) You'll need to override some methods too (whenever icon rendering takes place). This is a good reference. --- I don't have any code examples at the moment, but using blend modes is how I would approach this. -Nephroid Also, the color is an integer, meaning it's 4 bytes. Each byte is 2 hexadecimal digits. The color is usually 0xAARRGGBB, where AA is the alpha (transparency) component. You normally don't need to worry about this, but it's nice to keep in mind. GitHub|Recipe API Proposal
August 1, 201411 yr Author An approach to this would be using different blend modes. If you want to get into OpenGL, you might want to look into shaders, but that might be a bit complex. --- Alternatively, you can try GL11.glColor3b() and GL11.glBlendFunc(). The first takes the rgb components of the color (use bitwise operators to get the bits from the integer). The second takes some constants from GL11. You would use a base texture that's grayscale and draw that normally. Then call the color and blendfunc methods. Then draw a second texture that's all white above the first. The color method should change the all white texture to your color, and the blendfunc will blend that in with the gray texture. (You'll probably have to play around with the blendfunc method a bit before getting something you like.) You'll need to override some methods too (whenever icon rendering takes place). This is a good reference. --- I don't have any code examples at the moment, but using blend modes is how I would approach this. -Nephroid Also, the color is an integer, meaning it's 4 bytes. Each byte is 2 hexadecimal digits. The color is usually 0xAARRGGBB, where AA is the alpha (transparency) component. You normally don't need to worry about this, but it's nice to keep in mind. I'm not sure what you mean, can you please make a short code example, please. Not for copy and paste, only understanding what you mean Creator of Extra Shoes Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then
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.