diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-11-25 00:23:57 +0100 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-11-25 00:23:57 +0100 |
| commit | 707652b59e10371cf4826f9f65d653cac528c6bb (patch) | |
| tree | 65edeffdc0c14703771035222e18d7ff1cfd65b5 /src/main/kotlin/util | |
| parent | 6dd14e7225ff60361fe9f87020c424c0eb89a68b (diff) | |
| download | Firmament-707652b59e10371cf4826f9f65d653cac528c6bb.tar.gz Firmament-707652b59e10371cf4826f9f65d653cac528c6bb.tar.bz2 Firmament-707652b59e10371cf4826f9f65d653cac528c6bb.zip | |
feat: add item list
Diffstat (limited to 'src/main/kotlin/util')
| -rw-r--r-- | src/main/kotlin/util/accessors/GetRectangle.kt | 2 | ||||
| -rw-r--r-- | src/main/kotlin/util/accessors/castAccessor.kt | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/main/kotlin/util/accessors/GetRectangle.kt b/src/main/kotlin/util/accessors/GetRectangle.kt index 05ecfa9..109de94 100644 --- a/src/main/kotlin/util/accessors/GetRectangle.kt +++ b/src/main/kotlin/util/accessors/GetRectangle.kt @@ -7,7 +7,7 @@ import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen import moe.nea.firmament.mixins.accessor.AccessorHandledScreen fun AbstractContainerScreen<*>.getProperRectangle(): Rectangle { - this as AccessorHandledScreen + this.castAccessor() return Rectangle( getX_Firmament(), getY_Firmament(), diff --git a/src/main/kotlin/util/accessors/castAccessor.kt b/src/main/kotlin/util/accessors/castAccessor.kt new file mode 100644 index 0000000..0ac85a2 --- /dev/null +++ b/src/main/kotlin/util/accessors/castAccessor.kt @@ -0,0 +1,16 @@ +@file:OptIn(ExperimentalContracts::class) + +package moe.nea.firmament.util.accessors + +import kotlin.contracts.ExperimentalContracts +import kotlin.contracts.contract +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen +import moe.nea.firmament.mixins.accessor.AccessorHandledScreen + + +inline fun AbstractContainerScreen<*>.castAccessor(): AccessorHandledScreen { + contract { + returns() implies (this@castAccessor is AccessorHandledScreen) + } + return this as AccessorHandledScreen +} |
