From a40b9f64351ac3be996e1b194153a1e79884021e Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 7 Oct 2022 13:03:34 +0700 Subject: [PATCH] Always cache skin elements --- .../dbotthepony/mc/otm/client/render/AtlasSkinElement.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AtlasSkinElement.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AtlasSkinElement.kt index 9f87c4616..7fc35f2c1 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AtlasSkinElement.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AtlasSkinElement.kt @@ -115,7 +115,14 @@ class AtlasSkinElement private constructor( @JvmStatic fun create(location: ResourceLocation): AtlasSkinElement { if (!isWidgetAtlasAvailable) { - return AtlasSkinElement(location, null) + var element = skinElementCache[location] + + if (element == null) { + element = AtlasSkinElement(location, null) + skinElementCache[location] = element + } + + return element } return createImpl(location)