From 0e1ddd2c913656a631e26dd0c560f25179a7dc2d Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 8 Nov 2024 22:02:10 +0100 Subject: Fix missing tags in REI rendering --- .../firmament/compat/rei/NEUItemEntryRenderer.kt | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/compat/rei/java/moe') diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt index da0b645..de173ff 100644 --- a/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt @@ -26,12 +26,12 @@ import net.minecraft.client.render.OverlayTexture import net.minecraft.client.render.VertexConsumerProvider import net.minecraft.client.render.model.BakedModel import net.minecraft.client.texture.SpriteAtlasTexture -import net.minecraft.item.Item import net.minecraft.item.ModelTransformationMode -import net.minecraft.item.tooltip.TooltipType import moe.nea.firmament.compat.rei.FirmamentReiPlugin.Companion.asItemEntry import moe.nea.firmament.repo.SBItemStack import moe.nea.firmament.util.MC +import moe.nea.firmament.util.mc.displayNameAccordingToNbt +import moe.nea.firmament.util.mc.loreAccordingToNbt object NEUItemEntryRenderer : EntryRenderer, BatchedEntryRenderer { override fun render( @@ -49,11 +49,19 @@ object NEUItemEntryRenderer : EntryRenderer, BatchedEntryRenderer, tooltipContext: TooltipContext): Tooltip? { val stack = entry.value.asImmutableItemStack() - val lore = stack.getTooltip( - Item.TooltipContext.DEFAULT, - null, - TooltipType.BASIC - ) + + val lore = mutableListOf(stack.displayNameAccordingToNbt) + lore.addAll(stack.loreAccordingToNbt) + + // TODO: tags aren't sent as early now so some tooltip components that use tags will crash the game +// stack.getTooltip( +// Item.TooltipContext.create( +// tooltipContext.vanillaContext().registryLookup +// ?: MC.defaultRegistries +// ), +// MC.player, +// TooltipType.BASIC +// ) return Tooltip.create(lore) } -- cgit