9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-31 04:46:37 +00:00

feat: split lore components

This commit is contained in:
ᑕᖇEEᑭYᑕᖇEEᑭEᖇ
2025-07-19 00:28:55 +08:00
parent c737eb31f0
commit 453c1f5c1f
3 changed files with 27 additions and 7 deletions

View File

@@ -90,11 +90,7 @@ public class ComponentItemFactory1_21_5 extends ComponentItemFactory1_21_4 {
if (lore == null || lore.isEmpty()) {
item.resetComponent(ComponentTypes.LORE);
} else {
List<Tag> loreTags = new ArrayList<>();
for (Component component : lore) {
loreTags.add(AdventureHelper.componentToTag(component));
}
item.setSparrowNBTComponent(ComponentTypes.LORE, new ListTag(loreTags));
item.setSparrowNBTComponent(ComponentTypes.LORE, new ListTag(lore.stream().map(AdventureHelper::split).flatMap(List::stream).map(AdventureHelper::componentToTag).toList()));
}
}