Jump to content

Recommended Posts

Posted

Hello,

 

I'm new to forge modding.  I've been dabbling around a bit, and I've made some custom trees that generate beautifully.  However, the one snag that I keep running into, is that the leaves are not the colors I made in the textures.

 

I've done some researching, and I'm assuming that the reason the colors aren't changing to what I want is because of the vanilla coding that uses the gray toned textures and colorizes the leaves with the ColorizerFoilage class?  ( I may be totally off, but this is what I read so far).

 

Is there a way for me to have my trees ignore that and instead use the textures I have already made? 

 

If anyone could kindly point me in the right direction, I would greatly appreciate it.  Thank you so much for your time.

 

 

Edit:  I'm dabbling around with 1.7.2, - I'm sure that makes a difference :)

Posted

You need to override the method

public int getBlockColor()

and

public int getRenderColor(int)

to return 16777215, so it won't get colored, but use your texture. (Don't ask me how you get this number, found it in Block.getBlockColor())

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Thank you for the response.

 

I'm a bit closer, -

 

I added this to my code:

 

 

 

    @Override

    public int getBlockColor()

    {

        double d0 = 0.5D;

        double d1 = 1.0D;

        return 16777215;

    }

   

    @Override

    public int getRenderColor(int p_149741_1_)

    {

        return 16777215;

    }

 

 

 

And it did change slightly.  The leaves should show as red, blue, and silver for the three different trees.  They show up as red, green, and red respectively.

 

Did I add the override correctly?

Posted

The integer you give is a color multiplier so every pixel on the texture gets premultiplied by the value. It is a RGB value as integer so the you have 0xFFFFFF = (255, 255, 255)rgb, 0x00FF00 = (0, 255, 0)rgb, etc. This explains the default in Item which is 0xFFFFFF or 16777215.

 

Now you have to override this method because Block#getRenderType() returns 0 which causes RenderBlocks#renderBlockByRenderType() to call RenderBlocks#renderStandardBlock() which will ultimately call for Block#colorMultiplier() which is overridden by BlockLeaves an thus has to be overridden by you again to return the correct result.

 

This is how I understand it, so try and override colorMultiplier(IBlockAccess block, int x, int y, int z).

 

PS: I have added the second paragraph so that you can figure this out by yourself next time :) Feel free to ask for more explanation

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.