aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/util
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-09-29 22:44:13 +0200
committernea <nea@nea.moe>2023-09-29 22:44:13 +0200
commitf89135db7e500571231721ac8d5b0ffff63469df (patch)
tree50d9f6ed963468194dcbaced0e508e120240b4f0 /src/main/kotlin/moe/nea/firmament/util
parent7a71e77b4cc79331b135aa95b4b8c9dbdf9e76ef (diff)
downloadFirmament-f89135db7e500571231721ac8d5b0ffff63469df.tar.gz
Firmament-f89135db7e500571231721ac8d5b0ffff63469df.tar.bz2
Firmament-f89135db7e500571231721ac8d5b0ffff63469df.zip
Add UUID Locking (per unique item locking that allows movement)
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util')
-rw-r--r--src/main/kotlin/moe/nea/firmament/util/MC.kt1
-rw-r--r--src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt9
2 files changed, 9 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/MC.kt b/src/main/kotlin/moe/nea/firmament/util/MC.kt
index 0c09306..e8611a6 100644
--- a/src/main/kotlin/moe/nea/firmament/util/MC.kt
+++ b/src/main/kotlin/moe/nea/firmament/util/MC.kt
@@ -13,6 +13,7 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen
import net.minecraft.text.Text
import net.minecraft.util.math.BlockPos
import moe.nea.firmament.events.TickEvent
+import moe.nea.firmament.mixins.accessor.AccessorHandledScreen
object MC {
diff --git a/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt b/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt
index fe2b4e5..a071107 100644
--- a/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt
+++ b/src/main/kotlin/moe/nea/firmament/util/SkyblockId.kt
@@ -5,11 +5,12 @@
*/
@file:UseSerializers(DashlessUUIDSerializer::class)
+
package moe.nea.firmament.util
import io.github.moulberry.repo.data.NEUItem
import io.github.moulberry.repo.data.Rarity
-import java.util.UUID
+import java.util.*
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import kotlinx.serialization.decodeFromString
@@ -73,6 +74,12 @@ private val jsonparser = Json { ignoreUnknownKeys = true }
val ItemStack.extraAttributes: NbtCompound
get() = getOrCreateSubNbt("ExtraAttributes")
+val ItemStack.skyblockUUIDString: String?
+ get() = extraAttributes.getString("uuid")?.takeIf { it.isNotBlank() }
+
+val ItemStack.skyblockUUID: UUID?
+ get() = skyblockUUIDString?.let { UUID.fromString(it) }
+
val ItemStack.petData: HypixelPetInfo?
get() {
val jsonString = extraAttributes.getString("petInfo")