diff --git a/next/src/main/kotlin/org/incendo/interfaces/next/view/AbstractInterfaceView.kt b/next/src/main/kotlin/org/incendo/interfaces/next/view/AbstractInterfaceView.kt index 9db2331..7890ec4 100644 --- a/next/src/main/kotlin/org/incendo/interfaces/next/view/AbstractInterfaceView.kt +++ b/next/src/main/kotlin/org/incendo/interfaces/next/view/AbstractInterfaceView.kt @@ -61,9 +61,6 @@ public abstract class AbstractInterfaceView( // Add listeners to all triggers and update its transforms for ((trigger, transforms) in triggers.asMap()) { trigger.addListener(this) { - // If the first paint has not completed we do not perform any updates - if (firstPaint) return@addListener - // Apply the transforms for the new ones applyTransforms(transforms) } @@ -90,7 +87,6 @@ public abstract class AbstractInterfaceView( if (firstPaint || this !is ChestInterfaceView) { firstPaint = true setup() - firstPaint = false } else { renderAndOpen() } @@ -251,7 +247,7 @@ public abstract class AbstractInterfaceView( protected open suspend fun renderToInventory(callback: (Boolean) -> Unit) { // If a new inventory is required we create one // and mark that the current one is not to be used! - val createdInventory = if (firstPaint || requiresNewInventory()) { + val createdInventory = if (requiresNewInventory()) { currentInventory = createInventory() true } else { @@ -273,6 +269,7 @@ public abstract class AbstractInterfaceView( if ((openIfClosed && !isOpen) || createdInventory) { openInventory() openIfClosed = false + firstPaint = false } } } diff --git a/next/src/main/kotlin/org/incendo/interfaces/next/view/ChestInterfaceView.kt b/next/src/main/kotlin/org/incendo/interfaces/next/view/ChestInterfaceView.kt index 4a76673..10d7cb0 100644 --- a/next/src/main/kotlin/org/incendo/interfaces/next/view/ChestInterfaceView.kt +++ b/next/src/main/kotlin/org/incendo/interfaces/next/view/ChestInterfaceView.kt @@ -37,7 +37,7 @@ public class ChestInterfaceView internal constructor( override fun requiresPlayerUpdate(): Boolean = false - override fun requiresNewInventory(): Boolean = titleState.hasChanged + override fun requiresNewInventory(): Boolean = super.requiresNewInventory() || titleState.hasChanged override fun getInventory(): Inventory = currentInventory.chestInventory diff --git a/next/src/main/kotlin/org/incendo/interfaces/next/view/CombinedInterfaceView.kt b/next/src/main/kotlin/org/incendo/interfaces/next/view/CombinedInterfaceView.kt index bf84863..ef26985 100644 --- a/next/src/main/kotlin/org/incendo/interfaces/next/view/CombinedInterfaceView.kt +++ b/next/src/main/kotlin/org/incendo/interfaces/next/view/CombinedInterfaceView.kt @@ -38,7 +38,7 @@ public class CombinedInterfaceView internal constructor( override fun requiresPlayerUpdate(): Boolean = false - override fun requiresNewInventory(): Boolean = titleState.hasChanged + override fun requiresNewInventory(): Boolean = super.requiresNewInventory() || titleState.hasChanged override fun getInventory(): Inventory = currentInventory.chestInventory diff --git a/next/src/main/kotlin/org/incendo/interfaces/next/view/PlayerInterfaceView.kt b/next/src/main/kotlin/org/incendo/interfaces/next/view/PlayerInterfaceView.kt index bfdf085..fc7ceb7 100644 --- a/next/src/main/kotlin/org/incendo/interfaces/next/view/PlayerInterfaceView.kt +++ b/next/src/main/kotlin/org/incendo/interfaces/next/view/PlayerInterfaceView.kt @@ -23,8 +23,6 @@ public class PlayerInterfaceView internal constructor( error("PlayerInventoryView's cannot have a title") } - override fun requiresNewInventory(): Boolean = false - override fun createInventory(): PlayerInterfacesInventory = PlayerInterfacesInventory(player) override fun openInventory() {