Skip to content

Commit

Permalink
Fix akashic tome compat in the lexica render
Browse files Browse the repository at this point in the history
  • Loading branch information
artemisSystem committed Aug 8, 2024
1 parent 2b2b45e commit 3a217ac
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import net.minecraft.ChatFormatting;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.TagKey;
Expand Down Expand Up @@ -84,9 +85,11 @@ public static Component getEdition() {
public static Component getTitle(ItemStack stack) {
Component title = stack.getHoverName();

// Akashic tome tag contains a `text` field, which is a stringified text component
String akashicTomeNBT = "akashictome:displayName";
if (stack.hasTag() && stack.getTag().contains(akashicTomeNBT)) {
title = Component.Serializer.fromJson(stack.getTag().getString(akashicTomeNBT));
CompoundTag nameTextComponent = stack.getTag().getCompound(akashicTomeNBT);
title = Component.Serializer.fromJson(nameTextComponent.getString("text"));
}

return title;
Expand Down

0 comments on commit 3a217ac

Please sign in to comment.