github.com/df-mc/dragonfly@v0.9.13/server/item/firework_star.go (about) 1 package item 2 3 // FireworkStar is an item used to determine the color, effect, and shape of firework rockets. 4 type FireworkStar struct { 5 FireworkExplosion 6 } 7 8 // EncodeNBT ... 9 func (f FireworkStar) EncodeNBT() map[string]any { 10 return map[string]any{ 11 "FireworksItem": f.FireworkExplosion.EncodeNBT(), 12 "customColor": int32FromRGBA(f.Colour.RGBA()), 13 } 14 } 15 16 // DecodeNBT ... 17 func (f FireworkStar) DecodeNBT(data map[string]any) any { 18 if i, ok := data["FireworksItem"].(map[string]any); ok { 19 f.FireworkExplosion = f.FireworkExplosion.DecodeNBT(i).(FireworkExplosion) 20 } 21 return f 22 } 23 24 // EncodeItem ... 25 func (f FireworkStar) EncodeItem() (name string, meta int16) { 26 return "minecraft:firework_star", invertColour(f.FireworkExplosion.Colour) 27 }