From 66eb00e15e3dba13a002615cc124eecf5f47ca3f Mon Sep 17 00:00:00 2001 From: Andrew Wong <42793301+md5sha256@users.noreply.github.com> Date: Sat, 9 Nov 2024 18:40:30 +1100 Subject: [PATCH] Use ItemStackEditor#andMetaConsumer(Class, Consumer) --- pom.xml | 2 +- .../slimefun4/utils/itemstack/ColoredFireworkStar.java | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 21d2924dd3..4e2387c91f 100644 --- a/pom.xml +++ b/pom.xml @@ -357,7 +357,7 @@ com.github.Slimefun.dough dough-api - 9f61fdde69 + 285312d17d compile diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ColoredFireworkStar.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ColoredFireworkStar.java index 7de5beb11a..36ccef1cb8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ColoredFireworkStar.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/itemstack/ColoredFireworkStar.java @@ -22,15 +22,12 @@ public class ColoredFireworkStar { @ParametersAreNonnullByDefault public static ItemStack create(Color color, String name, String... lore) { + FireworkEffect effect = FireworkEffect.builder().with(Type.BURST).withColor(color).build(); return new ItemStackEditor(Material.FIREWORK_STAR) .setDisplayName(name) .setLore(lore) .addFlags(VersionedItemFlag.HIDE_ADDITIONAL_TOOLTIP) - .withMetaConsumer(meta -> { - if (meta instanceof FireworkEffectMeta effectMeta) { - effectMeta.setEffect(FireworkEffect.builder().with(Type.BURST).withColor(color).build()); - } - }) + .andMetaConsumer(FireworkEffectMeta.class, meta -> meta.setEffect(effect)) .create(); }