.withFade(fadeColors)
.build();
}
static CompoundTag toExplosion(FireworkEffect effect) {
CompoundTag explosion = new CompoundTag();
if (effect.hasFlicker()) explosion.putBool("Flicker", true);
if (effect.hasTrail()) explosion.putBool("Trail", true);
explosion.putByte("Type", effect.getType().ordinal());
List<Color> colors = effect.getColors();
List<Integer> colorInts = new ArrayList<>();
for (Color color : colors) {
colorInts.add(color.asRGB());
}
explosion.putIntArray("Colors", Ints.toArray(colorInts));
List<Color> fade = effect.getFadeColors();
if (!fade.isEmpty()) {
List<Integer> fadeInts = new ArrayList<>();
for (Color color : colors) {
fadeInts.add(color.asRGB());
}
explosion.putIntArray("FadeColors", Ints.toArray(fadeInts));
}
return explosion;
}