From ad490f2ea7967cb6bb97cb797b33aa3554de46a5 Mon Sep 17 00:00:00 2001 From: nea Date: Sat, 28 Oct 2023 04:07:47 +0200 Subject: Rename mixins after what they do, rather than where they do it [no changelog] Mixins are now named after what they do, and mixins for the same class that do different things should be in two separate mixins now. --- .../kotlin/moe/nea/firmament/events/ScreenChangeEvent.kt | 13 +++++++++++++ src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt | 13 ------------- .../moe/nea/firmament/features/debug/PowerUserTools.kt | 4 ++-- .../features/inventory/storageoverlay/StorageOverlay.kt | 4 ++-- src/main/kotlin/moe/nea/firmament/util/data/IDataHolder.kt | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 src/main/kotlin/moe/nea/firmament/events/ScreenChangeEvent.kt delete mode 100644 src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt (limited to 'src/main/kotlin') diff --git a/src/main/kotlin/moe/nea/firmament/events/ScreenChangeEvent.kt b/src/main/kotlin/moe/nea/firmament/events/ScreenChangeEvent.kt new file mode 100644 index 0000000..c6b0a7f --- /dev/null +++ b/src/main/kotlin/moe/nea/firmament/events/ScreenChangeEvent.kt @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2023 Linnea Gräf + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +package moe.nea.firmament.events + +import net.minecraft.client.gui.screen.Screen + +data class ScreenChangeEvent(val old: Screen?, val new: Screen?) : FirmamentEvent.Cancellable() { + companion object : FirmamentEventBus() +} diff --git a/src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt b/src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt deleted file mode 100644 index 034fe13..0000000 --- a/src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt +++ /dev/null @@ -1,13 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 Linnea Gräf - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -package moe.nea.firmament.events - -import net.minecraft.client.gui.screen.Screen - -data class ScreenOpenEvent(val old: Screen?, val new: Screen?) : FirmamentEvent.Cancellable() { - companion object : FirmamentEventBus() -} diff --git a/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt b/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt index 52834f3..8c9baf7 100644 --- a/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt +++ b/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt @@ -15,7 +15,7 @@ import net.minecraft.util.hit.HitResult import moe.nea.firmament.events.CustomItemModelEvent import moe.nea.firmament.events.HandledScreenKeyPressedEvent import moe.nea.firmament.events.ItemTooltipEvent -import moe.nea.firmament.events.ScreenOpenEvent +import moe.nea.firmament.events.ScreenChangeEvent import moe.nea.firmament.events.TickEvent import moe.nea.firmament.events.WorldKeyboardEvent import moe.nea.firmament.features.FirmamentFeature @@ -91,7 +91,7 @@ object PowerUserTools : FirmamentFeature { lastCopiedStack = null lastCopiedStackViewTime = false } - ScreenOpenEvent.subscribe { + ScreenChangeEvent.subscribe { lastCopiedStack = null } HandledScreenKeyPressedEvent.subscribe { diff --git a/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlay.kt b/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlay.kt index 7d1c72e..cb8a8d8 100644 --- a/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlay.kt +++ b/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlay.kt @@ -8,7 +8,7 @@ package moe.nea.firmament.features.inventory.storageoverlay import java.util.* import kotlinx.serialization.serializer -import moe.nea.firmament.events.ScreenOpenEvent +import moe.nea.firmament.events.ScreenChangeEvent import moe.nea.firmament.events.TickEvent import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.gui.config.ManagedConfig @@ -36,7 +36,7 @@ object StorageOverlay : FirmamentFeature { var currentHandler: StorageBackingHandle? = StorageBackingHandle.None override fun onLoad() { - ScreenOpenEvent.subscribe { event -> + ScreenChangeEvent.subscribe { event -> currentHandler = StorageBackingHandle.fromScreen(event.new) if (event.old is StorageOverlayScreen && !event.old.isClosing) { event.old.setHandler(currentHandler) diff --git a/src/main/kotlin/moe/nea/firmament/util/data/IDataHolder.kt b/src/main/kotlin/moe/nea/firmament/util/data/IDataHolder.kt index 1e7853c..1643ab1 100644 --- a/src/main/kotlin/moe/nea/firmament/util/data/IDataHolder.kt +++ b/src/main/kotlin/moe/nea/firmament/util/data/IDataHolder.kt @@ -13,7 +13,7 @@ import net.minecraft.client.MinecraftClient import net.minecraft.server.command.CommandOutput import net.minecraft.text.Text import moe.nea.firmament.Firmament -import moe.nea.firmament.events.ScreenOpenEvent +import moe.nea.firmament.events.ScreenChangeEvent interface IDataHolder { companion object { @@ -60,7 +60,7 @@ interface IDataHolder { } fun registerEvents() { - ScreenOpenEvent.subscribe { event -> + ScreenChangeEvent.subscribe { event -> performSaves() val p = MinecraftClient.getInstance().player if (p != null) { -- cgit