Jump to content

Textures with programmatic colors


gotet

Recommended Posts

Where should I look in the server code to find where textures with gray pixels are tinted?

(Examples are grass or redstone dust).

 

I have found out that they do that according to the colors calculated from BlockColors.java

but I dont know where the math or opengl tricks occurs.

 

Is it like I assume, color multiplication that is happening?

 

I am maybe blind, but where do I find the possible color values for redstone dust?

Edited by gotet
Link to comment
Share on other sites

1 hour ago, gotet said:

server code

1 hour ago, gotet said:

textures

 

Textures are client side only. You will not find any server code related to colorization.

 

For redstone wire, the math is in RedstoneWire#colorMultiplier().

All it does is return a color (255 RGB as a single unsigned integer) that is then multiplied against the texture when it is rendered.

As for where OpenGL gets involved? Dunno, its buried inside the ModelBakery.

Edited by Draco18s

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.

Link to comment
Share on other sites

I don't have a 1.16 workspace, but its a method that returns an int and has a line that looks like "return -16777216 | i << 16 | j << 8 | k;" (the "-16777216" part is just FF for alpha, already bit-shifted).

Alternatively, dig into where BlockColors gets referenced and how.

  • Like 1

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.

Link to comment
Share on other sites

Don't search the whole project for that string, search in RedstoneWireBlock. Or go to BlockColors and look at how RedstoneWire's color gets registered and work backwards.

  • Like 1

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.

Link to comment
Share on other sites

Yeah, got it!

 

static {
      for(int i = 0; i <= 15; ++i) {
         float f = (float)i / 15.0F;
         float f1 = f * 0.6F + (f > 0.0F ? 0.4F : 0.3F);
         float f2 = MathHelper.clamp(f * f * 0.7F - 0.5F, 0.0F, 1.0F);
         float f3 = MathHelper.clamp(f * f * 0.6F - 0.7F, 0.0F, 1.0F);
         field_235542_k_ = new Vector3f(f1, f2, f3);
      }

   }

Link to comment
Share on other sites

57 minutes ago, gotet said:

Yeah, got it!

Yep, definitely changed and a lot. Didn't really expect that, but I knew the process that I'd use to locate the relevant bit of code. That is, I knew BlockColors was involved and that something got registered.

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.