Jump to content

[1.7.2] leaf colorization


phyre

Recommended Posts

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 :)

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • The mod I'm working on is in 1.19.2. The portal works correctly in Intellij but when I publish the jar, put it in the mods folder of the game it crashes with the following error whenever any entity collides with it: java.lang.IllegalAccessError: class com.github.warrentode.turtleblockacademy.blocks.TBAMiningPortalBlock tried to access protected field net.minecraft.world.entity.Entity.f_19819_ (com.github.warrentode.turtleblockacademy.blocks.TBAMiningPortalBlock is in module [email protected] of loader 'TRANSFORMER' @16c5b50a; net.minecraft.world.entity.Entity is in module [email protected] of loader 'TRANSFORMER' @16c5b50a)     at com.github.warrentode.turtleblockacademy.blocks.TBAMiningPortalBlock.m_7892_(TBAMiningPortalBlock.java:124) ~[turtleblockacademy-2024.2025-1.0.0.jar%23572!/:2024.2025-1.0.0] {re:classloading} The thing is, I have Entity.f_19819_ in my accessTransformer.cfg file in this line: public net.minecraft.world.entity.Entity f_19819_ # portalEntrancePos So what do I need to do to fix this error?
    • It will be about medeaival times
    • the mods are crashing and I'm not sure why so heres everything  crash log https://pastebin.com/RxLKbMNR  L2 Library (12library) has failed to load correctly java.lang.NoClassDefFoundError: org/antarcticgardens/newage/content/energiser/EnergiserBlock L2 Screen Tracker (12screentracker) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.12library.base.L2Registrate Create: Interiors (interiors) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.tterrag.registrate.AbstractRegistrate L2 Damage Tracker (12damagetracker) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.l2library.base.L2Registrate Create Enchantment Industry (create_enchantment_industry) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.foundation.data.Createfiegistrate Create Crafts & Additions (createaddition) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.foundation.data.CreateRegistrate Create Slice & Dice (sliceanddice) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.foundation.data.CreateRegistrate L2 Tabs (12tabs) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.l2library.base.L2Registrate Modular Golems (modulargolems) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.l2library.base.L2Registrate Create: Steam 'n' FRails (railways) has failed to load correctly java.lang.NoClassDefFoundError : Could not initialize class com.simibubi.create.foundation.data.Createfregistrate Cuisine Delight (cuisinedelight) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.12library.base.L2Registrate Create (create) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.Create Guardian Beam Defense (creategbd) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.foundation.data.CreateRegistrate L2 Item Selector (12itemselector) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.l2library.base.L2Registrate
    • hey there, I have been using Forge for years without any problems, but for some time now I have been getting this error message when I click on “Installer” under the downloads. This happens on all versions. I have tried various things but have not gotten any results. If anyone has a solution, I would be very grateful!
    • I don't have mcreator installed.
  • Topics

×
×
  • Create New...

Important Information

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