|
11 | 11 | import net.kyori.adventure.text.Component; |
12 | 12 | import net.kyori.adventure.text.minimessage.MiniMessage; |
13 | 13 | import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; |
| 14 | +import org.bukkit.Color; |
14 | 15 | import org.bukkit.Material; |
15 | 16 | import org.bukkit.inventory.ItemStack; |
16 | 17 | import org.jspecify.annotations.Nullable; |
17 | 18 | import xyz.xenondevs.invui.i18n.Languages; |
18 | 19 | import xyz.xenondevs.invui.internal.util.ComponentUtils; |
19 | 20 |
|
20 | | -import java.awt.*; |
21 | | -import java.util.List; |
22 | 21 | import java.util.*; |
23 | 22 | import java.util.function.Function; |
24 | 23 | import java.util.stream.Collectors; |
@@ -430,6 +429,16 @@ public ItemBuilder addCustomModelData(Color value) { |
430 | 429 | return this; |
431 | 430 | } |
432 | 431 |
|
| 432 | + /** |
| 433 | + * Adds the given custom model data entry to the `colors` section. |
| 434 | + * |
| 435 | + * @param value The value to add |
| 436 | + * @return The builder instance |
| 437 | + */ |
| 438 | + public ItemBuilder addCustomModelData(java.awt.Color value) { |
| 439 | + return addCustomModelData(Color.fromARGB(value.getRGB())); |
| 440 | + } |
| 441 | + |
433 | 442 | /** |
434 | 443 | * Sets the custom model data entry in `floats` at the given index to the given value, |
435 | 444 | * filling smaller indices with zeros if necessary. |
@@ -546,6 +555,18 @@ public ItemBuilder setCustomModelData(int index, Color value) { |
546 | 555 | return this; |
547 | 556 | } |
548 | 557 |
|
| 558 | + /** |
| 559 | + * Sets the custom model data entry in `colors` at the given index to the given value, |
| 560 | + * filling smaller indices with white if necessary. |
| 561 | + * |
| 562 | + * @param index The index |
| 563 | + * @param value The value |
| 564 | + * @return The builder instance |
| 565 | + */ |
| 566 | + public ItemBuilder setCustomModelData(int index, java.awt.Color value) { |
| 567 | + return setCustomModelData(index, Color.fromARGB(value.getRGB())); |
| 568 | + } |
| 569 | + |
549 | 570 | /** |
550 | 571 | * Sets all custom model data entries. |
551 | 572 | * |
|
0 commit comments