Add separate slot locking profile for the Rift
This commit is contained in:
@@ -6,8 +6,10 @@
|
|||||||
|
|
||||||
package moe.nea.firmament.features.inventory
|
package moe.nea.firmament.features.inventory
|
||||||
|
|
||||||
|
import org.lwjgl.glfw.GLFW
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.serializer
|
import kotlinx.serialization.serializer
|
||||||
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import moe.nea.firmament.events.HandledScreenKeyPressedEvent
|
import moe.nea.firmament.events.HandledScreenKeyPressedEvent
|
||||||
import moe.nea.firmament.events.IsSlotProtectedEvent
|
import moe.nea.firmament.events.IsSlotProtectedEvent
|
||||||
import moe.nea.firmament.events.SlotRenderEvents
|
import moe.nea.firmament.events.SlotRenderEvents
|
||||||
@@ -16,9 +18,8 @@ import moe.nea.firmament.gui.config.ManagedConfig
|
|||||||
import moe.nea.firmament.mixins.accessor.AccessorHandledScreen
|
import moe.nea.firmament.mixins.accessor.AccessorHandledScreen
|
||||||
import moe.nea.firmament.util.CommonSoundEffects
|
import moe.nea.firmament.util.CommonSoundEffects
|
||||||
import moe.nea.firmament.util.MC
|
import moe.nea.firmament.util.MC
|
||||||
|
import moe.nea.firmament.util.SBData
|
||||||
import moe.nea.firmament.util.data.ProfileSpecificDataHolder
|
import moe.nea.firmament.util.data.ProfileSpecificDataHolder
|
||||||
import net.minecraft.entity.player.PlayerInventory
|
|
||||||
import org.lwjgl.glfw.GLFW
|
|
||||||
|
|
||||||
object SlotLocking : FirmamentFeature {
|
object SlotLocking : FirmamentFeature {
|
||||||
override val identifier: String
|
override val identifier: String
|
||||||
@@ -27,6 +28,7 @@ object SlotLocking : FirmamentFeature {
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class Data(
|
data class Data(
|
||||||
val lockedSlots: MutableSet<Int> = mutableSetOf(),
|
val lockedSlots: MutableSet<Int> = mutableSetOf(),
|
||||||
|
val lockedSlotsRift: MutableSet<Int> = mutableSetOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
object TConfig : ManagedConfig(identifier) {
|
object TConfig : ManagedConfig(identifier) {
|
||||||
@@ -34,11 +36,17 @@ object SlotLocking : FirmamentFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val config: TConfig
|
override val config: TConfig
|
||||||
get() = TConfig
|
get() = TConfig
|
||||||
|
|
||||||
object DConfig : ProfileSpecificDataHolder<Data>(serializer(), "locked-slots", ::Data)
|
object DConfig : ProfileSpecificDataHolder<Data>(serializer(), "locked-slots", ::Data)
|
||||||
|
|
||||||
val lockedSlots get() = DConfig.data?.lockedSlots
|
val lockedSlots
|
||||||
|
get() = when (SBData.skyblockLocation) {
|
||||||
|
"rift" -> DConfig.data?.lockedSlotsRift
|
||||||
|
null -> null
|
||||||
|
else -> DConfig.data?.lockedSlots
|
||||||
|
}
|
||||||
|
|
||||||
override fun onLoad() {
|
override fun onLoad() {
|
||||||
HandledScreenKeyPressedEvent.subscribe {
|
HandledScreenKeyPressedEvent.subscribe {
|
||||||
if (!it.matches(TConfig.lock)) return@subscribe
|
if (!it.matches(TConfig.lock)) return@subscribe
|
||||||
|
|||||||
Reference in New Issue
Block a user