Jump to content

Recommended Posts

Posted

I'd like to start off with what I think is an obvious statement:  I am an idiot.  I have a bad habit of looking over the obvious and not finding the simple.

 

That being said, I have a block that adapts its color based on the element it is, but I have set it up in such a way that certain colors are brightened and others are darkened based on various events.  I used to utilize the getRenderColor(BlockState) function, but it seems to now be missing.

 

I was wondering if there is a way of doing a block coloring without the recolorBlock function as it only takes an EnumDye.  (Or a way to trick EnumDye into taking an adaptive color...)

 

Thank you in advance!

Posted

As of 1.9, the block color stuff has been moved to it's own interface. So now, you can either do two things. First, have your block implement IBlockColor, which will give you your colorMultiplier method in your block class, or do something like this:

 

 

BlockColors blockcolors = BlockColors.init();

blockcolors.registerBlockColorHandler(new IBlockColor()

        {

            public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex)

            {

                return your rgb int here ;

            }

        }, new Block[] { your block here });

 

 

 

If your block class does implements IBlockColor:

 

 

BlockColors blockcolors = BlockColors.init();

blockcolors.registerBlockColorHandler( your block here , new Block[] { your block here });

 

 

 

In any case, these methods should be put in your main class after you register your block with GameRegistry#registerBlock. If the first method is unclear, the actual file is at net.minecraft.client.renderer.color.BlockColors. Keep in mind that you should create only one instance of BlockColors, as every time you call BlockColors#init, the registered map gets cleared.

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.