Merge branch 'main' of https://github.com/sainagh/meatballcraft into tooltips-and-more

This commit is contained in:
ZHAY10086
2024-10-23 08:57:18 +08:00
5000 changed files with 257217 additions and 10082 deletions
+3 -5
View File
@@ -104,21 +104,19 @@ zenClass SuperEnchantedItem {
// Writes the name/tooltip to display on the wrapper item.
function writeDisplayData(item as IItemStack) {
val displayedName = this.wrapperItem.displayName + " §r§f(" + item.displayName + ")";
var displayedEnchants = [] as string[];
var info = ["§r§fItem: " + item.displayName] as string[];
for enchantEntry in this.mapNBT.delayedEnch.asList() {
for name, level in enchantEntry.asMap() {
val enchant = <enchantment:${name}>.makeEnchantment(level);
// Localization for level isn't loaded yet for some reason, let's just use the numeric level if needed.
displayedEnchants += "§r§7" + StaticString.remove(enchant.displayName, "enchantment.level.");
info += "§r§7" + StaticString.remove(enchant.displayName, "enchantment.level.");
}
}
// Just use an IItemStack to easily store and copy lore.
val tempCopy = this.wrapperItem.withLore(displayedEnchants) as IItemStack;
val tempCopy = this.wrapperItem.withLore(info) as IItemStack;
this.mapNBT += {
"display": {
"Lore": tempCopy.tag.display.Lore,
"Name": displayedName
}
} as IData;
}