Fabric API

Fabric API

106M Downloads

[ENHANCEMENT/ SUGGESTION] ItemMeta (Block meta, ecc...) implementation

CamperSamu opened this issue ยท 5 comments

commented

An implementation of item/blocks metadata utility like Bukkit/Spigot (to add things like getLore(), setLore()...)

commented

fabric api is not an abstraction layer, nor is bukkit api something to base any api on.

commented

Helper methods to set item lore makes sense to me (assuming there isn't already a method for it).

Otherwise a whole abstraction doesn't make sense to me

commented

I'm not sure enough people use lore to justify FAPI having helpers for it.

What would definitely be of use, in FAPI or elsewhere; is a less verbose way of creating, modifying, and inspecting nested NBT. When only setting NBT, it can often be done succinctly with Streams, e.g.

CompoundTag display = stack.getOrCreateSubTag("display");
display.put("Lore", Arrays.stream(loreLines)
    .map(line -> StringTag.of(Text.Serializer.toJson(line)))
    .collect(Collectors.toCollection(ListTag::new)));

Appending to existing tags, creating them if they do not exist; is not so nice.
It's possible to collect into a compound tag, but a custom collector is required.
That collector would also fit well in any NBT helper API.

commented

So can someone close this, and @Daomephsta can you create another enhancement issue for a better CopoundTag api ? (just to clean up a bit).

commented

Closing since this does not seem to be too relevant to Fabric API.