It might be a nicer, and more developer friendly to make fluent builders to allow us to append extra data & properties to items or blocks (which presumably can be inherited from attribute interfaces somehow or another). If you don’t know what I mean by fluent builders, here’s a link I came across when looking at the Fanciful chat formatting library. As you can probably tell from the linked library, it uses fluent builders to compile effects for chat formatting. Similarly, I personally think it’d be nice if we could add enchantments to items, effects to fireworks, potentially even raw NBT data via fluent builders. I’m not the most experience java developer by far, so I’m not sure if this is a wise decision or even remotely plausible, but from what I’ve seem from Fanciful, it can be a more pleasant way to work. I’m not aware of any practices that say it’s a bad thing at least. This is probably going to end terribly, but I’ll try to add a small code excerpt as to what that may look like
// Sorry for the Bukkit-like code, but it should hopefully get my point across
ItemStack is = new ItemStack(Material.DIAMOND_SWORD, 1);
is.addEnchant(Enchantment.DAMAGE_ALL, 1, true).addEnchant(Enchantment.KNOCKBACK, 2, true);
Although I understand the result of the returns of the addEnchant() in Bukkit is boolean to determine whether the enchant is applied, so I guess there may be more important uses for returns. Just thinking fluent building may be something to consider for the sake of convenience, or at least in events that another return type isn’t necessary.
Thoughts on this? Or perchance where fluent builders can be used otherwise if at all? (I’m just a fan of fluent builders, if you can’t tell)