Option to set beacon beam color multiplier of custom blocks

Published by Zilver on Tue, 06/02/2020 - 12:06
Upvotes: 4
Issue description

Recently, I made a custom glass block along with its 16 stained variants. However, I noticed that there is no obvious way to give custom stained glass blocks the ability to recolor Beacon beams like regular stained glass does.


Here's what I would like to suggest: 

An option to enable Beacon beam color manipulation for a block, and a color selector via either RGB values or color hexcode for what color the Beacon's beam will change to upon interaction with the custom block.

 

It would be a great feature to have as part of a future update as it would give creators the ability to access another vanilla mechanic.

 

 

Attachment Size
beaconcolor.png276.93 KB 276.93 KB

Issue comments

This is the method used from the IForgeBlock class (1.15, probably the same in 1.14, but haven't checked yet):

@Nullable
default float[] getBeaconColorMultiplier(BlockState state, IWorldReader world, BlockPos pos, BlockPos beaconPos)
{
    if (getBlock() instanceof IBeaconBeamColorProvider)
        return ((IBeaconBeamColorProvider)getBlock()).getColor().getColorComponentValues();
    return null;
}

You can override it in your block class and return an array of three floats to multiply the beam color (ex. {1F, 0F, 0F} will make the beam red)



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.