aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/inventory/SlotLocking.kt32
-rw-r--r--src/main/resources/assets/firmament/textures/gui/sprites/slot_locked.pngbin0 -> 595 bytes
-rw-r--r--src/main/resources/assets/firmament/textures/gui/sprites/slot_locked.png.license3
-rw-r--r--src/main/resources/assets/firmament/textures/gui/sprites/uuid_locked.pngbin0 -> 597 bytes
-rw-r--r--src/main/resources/assets/firmament/textures/gui/sprites/uuid_locked.png.license3
5 files changed, 26 insertions, 12 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/features/inventory/SlotLocking.kt b/src/main/kotlin/moe/nea/firmament/features/inventory/SlotLocking.kt
index 6ef9cf4..2f4f84b 100644
--- a/src/main/kotlin/moe/nea/firmament/features/inventory/SlotLocking.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/inventory/SlotLocking.kt
@@ -7,6 +7,7 @@
package moe.nea.firmament.features.inventory
+import com.mojang.blaze3d.systems.RenderSystem
import java.util.*
import org.lwjgl.glfw.GLFW
import kotlinx.serialization.Serializable
@@ -15,6 +16,7 @@ import kotlinx.serialization.serializer
import net.minecraft.client.gui.screen.ingame.HandledScreen
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.screen.slot.SlotActionType
+import net.minecraft.util.Identifier
import moe.nea.firmament.events.HandledScreenKeyPressedEvent
import moe.nea.firmament.events.IsSlotProtectedEvent
import moe.nea.firmament.events.SlotRenderEvents
@@ -157,25 +159,31 @@ object SlotLocking : FirmamentFeature {
if (IsSlotProtectedEvent.shouldBlockInteraction(null, SlotActionType.THROW, stack))
anyBlocked = true
}
- if(anyBlocked) {
+ if (anyBlocked) {
event.protectSilent()
}
}
- SlotRenderEvents.Before.subscribe {
+ SlotRenderEvents.After.subscribe {
val isSlotLocked = it.slot.inventory is PlayerInventory && it.slot.index in (lockedSlots ?: setOf())
val isUUIDLocked = (it.slot.stack?.skyblockUUID) in (lockedUUIDs ?: setOf())
if (isSlotLocked || isUUIDLocked) {
- it.context.fill(
- it.slot.x,
- it.slot.y,
- it.slot.x + 16,
- it.slot.y + 16,
- when {
- isSlotLocked -> 0xFFFF0000.toInt()
- isUUIDLocked -> 0xFF00FF00.toInt()
- else -> error("Slot is locked, but not by slot or uuid")
- }
+ RenderSystem.disableDepthTest()
+ it.context.drawSprite(
+ it.slot.x, it.slot.y, 0,
+ 16, 16,
+ MC.guiAtlasManager.getSprite(
+ when {
+ isSlotLocked ->
+ (Identifier("firmament:slot_locked"))
+
+ isUUIDLocked ->
+ (Identifier("firmament:uuid_locked"))
+ else ->
+ error("unreachable")
+ }
+ )
)
+ RenderSystem.enableDepthTest()
}
}
}
diff --git a/src/main/resources/assets/firmament/textures/gui/sprites/slot_locked.png b/src/main/resources/assets/firmament/textures/gui/sprites/slot_locked.png
new file mode 100644
index 0000000..612d2e3
--- /dev/null
+++ b/src/main/resources/assets/firmament/textures/gui/sprites/slot_locked.png
Binary files differ
diff --git a/src/main/resources/assets/firmament/textures/gui/sprites/slot_locked.png.license b/src/main/resources/assets/firmament/textures/gui/sprites/slot_locked.png.license
new file mode 100644
index 0000000..c01d463
--- /dev/null
+++ b/src/main/resources/assets/firmament/textures/gui/sprites/slot_locked.png.license
@@ -0,0 +1,3 @@
+SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+
+SPDX-License-Identifier: CC0-1.0
diff --git a/src/main/resources/assets/firmament/textures/gui/sprites/uuid_locked.png b/src/main/resources/assets/firmament/textures/gui/sprites/uuid_locked.png
new file mode 100644
index 0000000..9e66cb5
--- /dev/null
+++ b/src/main/resources/assets/firmament/textures/gui/sprites/uuid_locked.png
Binary files differ
diff --git a/src/main/resources/assets/firmament/textures/gui/sprites/uuid_locked.png.license b/src/main/resources/assets/firmament/textures/gui/sprites/uuid_locked.png.license
new file mode 100644
index 0000000..c01d463
--- /dev/null
+++ b/src/main/resources/assets/firmament/textures/gui/sprites/uuid_locked.png.license
@@ -0,0 +1,3 @@
+SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+
+SPDX-License-Identifier: CC0-1.0