From f9d74a4cb89fef572e0497ec7e89abe0358de746 Mon Sep 17 00:00:00 2001 From: toxicity Date: Mon, 26 Feb 2024 17:39:53 +0900 Subject: [PATCH] bug fix --- .../toxicity/inventory/gui/GuiBuilderImpl.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dist/src/main/kotlin/kr/toxicity/inventory/gui/GuiBuilderImpl.kt b/dist/src/main/kotlin/kr/toxicity/inventory/gui/GuiBuilderImpl.kt index 8718d02..ee21af4 100644 --- a/dist/src/main/kotlin/kr/toxicity/inventory/gui/GuiBuilderImpl.kt +++ b/dist/src/main/kotlin/kr/toxicity/inventory/gui/GuiBuilderImpl.kt @@ -87,16 +87,18 @@ class GuiBuilderImpl: GuiBuilder { player.openInventory(holder.inventory) GuiTask { if (!holder.isCancelled && player.openInventory.topInventory.holder === holder) { - var finalComp = comp - renderer.values.forEach { - if (it.enabled) { - val next = it.next() - finalComp += next + NEGATIVE_ONE_SPACE_COMPONENT + NEW_LAYER + (-next.width).toSpaceComponent() + if (renderer.isNotEmpty()) { + var finalComp = comp + renderer.values.forEach { + if (it.enabled) { + val next = it.next() + finalComp += next + NEGATIVE_ONE_SPACE_COMPONENT + NEW_LAYER + (-next.width).toSpaceComponent() + } } + holder.setInventory(finalComp.component) + player.openInventory(holder.inventory) + holder.isCancelled = false } - holder.setInventory(finalComp.component) - player.openInventory(holder.inventory) - holder.isCancelled = false false } else { player.closeInventory()