Skip to content

Commit

Permalink
Use ItemStackEditor#andMetaConsumer(Class, Consumer)
Browse files Browse the repository at this point in the history
  • Loading branch information
md5sha256 committed Nov 9, 2024
1 parent c923daf commit 66eb00e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
<dependency>
<groupId>com.github.Slimefun.dough</groupId>
<artifactId>dough-api</artifactId>
<version>9f61fdde69</version>
<version>285312d17d</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 66eb00e

Please sign in to comment.