Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.