Jump to content

Grayscale


BuilderDan

Recommended Posts

Hello,

I've noticed a reoccurring issue with flowers in modpacks where the flowers stems never really go quite well with the biomes they are put in, even the vanilla flowers can be questionable at times in specific biomes because of color differences. I was simply wondering if it were possible to easily make it so all of the flowers could be edited to follow a grayscale, that way they would act the same way foliage and grass does with biome colors. I noticed that the biome's o plenty mod uses this with their Berry Bush, but I wasn't able to replicate it since It obviously can't be done by just changing what you want to a grayscale. Any help would be greatly appreciated.

Thanks,
Dan

(Sorry if this is in the wrong thread, first time using the forums - figured this was related to mod support enough to post it here...)

Link to comment
Share on other sites

Not really. You'd have to replace the classes involved with new ones that implement IBlockColor.

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

You don't need to replace the Blocks themselves, just register IBlockColor instances for them and replace the textures using a resource pack (e.g. your mod's assets diretory).

 

Do this using the BlockColors class, which also contains the Vanilla IBlockColor implementations.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I have no idea how to do that, nor do I have any experience. But if you would be kind and willing enough to explain to me how to do this or point me in the right direction to do this properly I'd love to be able to do this to make Vanilla and modded flowers conform to the vanilla colormap. I understand if you can't help because you're likely busy but I'd really appreciate it.

Thanks,
Dan

Link to comment
Share on other sites

You first need to implement IBlockColor, you'll probably want to do this with a lambda or anonymous class. Look at the BlockColors#init method for the vanilla IBlockColor implementations for leaves and grass.

 

You'll also need to create an IItemColor implementation that returns the Block's colour. Look at the ItemColors#init method for the vanilla IItemColor implementation for leaves and grass.

 

Call BlockColors#registerBlockColorHandler with an instance of your IBlockColor implementation and the Blocks that you want coloured at runtime.

 

Call ItemColors#registerItemColorHandler with an instance of your IItemColor implementation and the Blocks (or their Item forms) that you want coloured at runtime.

 

Do this from a client-only class (e.g. your client proxy) in the init phase.

 

I have an example of an IBlockColor/IItemColor implementation for a block that uses the grass colours here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I think normally someone would say thank you, which I am thankful. Because you responded kindly and logically and even with an example. But I don't think I made it very clear that I have 0 experience in coding and editing code, I'm even questioning myself right now whether it can be defined as code because I'm just that unaware of all the technicalities. Most all of the wonderful and likely very useful information you're providing is going right over my head. This is completely new and untouched territory for me, and I don't want to disrespect these forums guidelines or make it something it's not supposed to be - A lesson in coding, a very basic one I am assuming, this doesn't seem very difficult... I think. The point is I have no idea if this will ever click for me, but I definitely want to try because I really want to do this. Plus I don't know anyone who would be kind enough to do it for me with more experience, besides if I have to do it for every flower; it would be too daunting of a task to give someone. Anyways, if you don't want to waste more of your time on this somewhat hopeless but hopeful thread, I understand.

Thanks,

Dan   

Link to comment
Share on other sites

well you picked a bothersome (and not too easy) task to start with.

you may consider actually doing a few simple things to get a handle of things.

 

to make the dandelion obey the biome grass color, you need to do the following:

1) separate the texture into two textures - stem and yellow part. desaturate the stem (make it grayscale).

2) make a new model based on cross - duplicate the two elements that the model is composed of (there should be four now). set two to use one texture (you may call it cross_fixed or something like that); set the other two to use the other texture (call it cross_green or something like that); for the later two elements set tintindex to 0 (compare cross and tinted cross models that come with vanilla)

3) now the part Choonster tried to explain - you have two elements that will be given one texture (the non-green part of the flower) and two elements that will be given another texture (the stem) and then these two elements will be tinted and they have a tint index of 0. now what does 0 mean? nothing yet. you will add one call in your client proxy class which will say "for block X and the index 0, apply this color multiplier". you are giving a meaning to each tint index you use in your model file. for example i have a block where tint index 0 is water color (so that the block looks ok in swamps where the water is greenish) and index 1 is the grass color (so that the plant looks ok in biomes where the grass is paler or yellowish or whatever.

4) you need plenty of blockstates of course, to make use of the new flower model you made (luckily you only need to make one model). in blockstates (for each block), specify your new cross model and two textures.

Edited by MFMods
Link to comment
Share on other sites

I doubt anyone here really wants to write the code for you. Most of us are here because we have our own ideas we are trying to implement. But you never know.

 

If you want to try this yourself but have no experience with coding, you need to take a Java class or some online tutorials. I used Codecademy when I first started modding. There are others. Then you'll want to follow a basic modding tutorial. I recommend Shadowfacts tutorials since they are simple and up to date. Modding is very challenging for a complete beginner, but it can be really rewarding as well.

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.

Announcements



×
×
  • Create New...

Important Information

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