From fec5ae1c92f1fd494530082c23b6d9f9b3b60de6 Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Mon, 17 Feb 2025 11:58:37 -0600 Subject: [PATCH] Cache translated item name --- NewHorizons/Components/Props/NHItem.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Components/Props/NHItem.cs b/NewHorizons/Components/Props/NHItem.cs index 98aed5d2..90105887 100644 --- a/NewHorizons/Components/Props/NHItem.cs +++ b/NewHorizons/Components/Props/NHItem.cs @@ -20,6 +20,8 @@ namespace NewHorizons.Components.Props public bool ClearPickupConditionOnDrop; public string PickupFact; + string _translatedName; + public ItemType ItemType { get => _type; @@ -28,7 +30,11 @@ namespace NewHorizons.Components.Props public override string GetDisplayName() { - return TranslationHandler.GetTranslation(DisplayName, TranslationHandler.TextType.UI); + if (_translatedName == null) + { + _translatedName = TranslationHandler.GetTranslation(DisplayName, TranslationHandler.TextType.UI); + } + return _translatedName; } public override bool CheckIsDroppable()