Option to set beacon beam color multiplier of custom blocks

Published by Zilver on
Status
Fixed
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.

 

 

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)