Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
444 views
in Technique[技术] by (71.8m points)

minecraft - What colour format is used in command block commands?

I just started using command blocks in Minecraft and I'm stuck. I'm trying to make a custom firework rocket colour with this command.

give @p minecraft:firework_rocket{
    Fireworks:{
        Flight:2,
        Explosions:[{
            Type:1,
            Flicker:0,
            Trail:1,
            Colors:[I;86219204], // What is this colour format?
            FadeColors:[I;16886219] // same here
        }]
    }
} 1

I have tried with HEX and RGB and it doesn't seem like it's any of those. For reference I;2651799 is cyan; I;1973019 is black; and I;15790320 is white.

I used this page to check these values by just ticking the boxes in the Select the Explosion Colors section, generating the command, and checking the value.

Thanks for your help,
Huky


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I have tried with HEX and RGB and it doesn't seem like it's any of those.

But it is! Colors specified through NBT use the hex format (#RRGGBB). However, Minecraft's NBT parser does not support hexadecimal numbers, only base 10. So this means you have to convert between base 10 and hex. For example, the color #FF0000 in hex is 16711680 in base 10!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...