diff --git a/geary-papermc-features/src/main/kotlin/com/mineinabyss/geary/papermc/features/entities/sounds/PlayAmbientSounds.kt b/geary-papermc-features/src/main/kotlin/com/mineinabyss/geary/papermc/features/entities/sounds/PlayAmbientSounds.kt index 3ffb55f..a8af44a 100644 --- a/geary-papermc-features/src/main/kotlin/com/mineinabyss/geary/papermc/features/entities/sounds/PlayAmbientSounds.kt +++ b/geary-papermc-features/src/main/kotlin/com/mineinabyss/geary/papermc/features/entities/sounds/PlayAmbientSounds.kt @@ -2,15 +2,14 @@ package com.mineinabyss.geary.papermc.features.entities.sounds import com.mineinabyss.geary.modules.Geary import com.mineinabyss.geary.papermc.features.entities.sounds.OverrideMobSoundsListener.Companion.makeSound -import com.mineinabyss.geary.systems.query.Query +import com.mineinabyss.geary.systems.query.query import com.mineinabyss.idofront.time.ticks import com.mineinabyss.idofront.typealiases.BukkitEntity import kotlin.random.Random -fun Geary.playAmbientSounds() = system(object : Query(this) { - val bukkit by get<BukkitEntity>() - val sounds by get<Sounds>() -}).every(1.ticks).exec { - if (Random.nextDouble() < sounds.ambientChance) - makeSound(bukkit, sounds.ambient) -} +fun Geary.playAmbientSounds() = system(query<BukkitEntity, Sounds>()) + .every(1.ticks) + .exec { (bukkit, sounds) -> + if (Random.nextDouble() < sounds.ambientChance) + makeSound(bukkit, sounds.ambient) + } diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/systems/PeriodicSaveSystem.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/systems/PeriodicSaveSystem.kt index 1739923..204d10b 100644 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/systems/PeriodicSaveSystem.kt +++ b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/systems/PeriodicSaveSystem.kt @@ -13,7 +13,7 @@ fun Geary.createPeriodicSaveSystem() = system( val persisting by getRelationsWithData<Persists, Any>() val item by get<ItemStack>() } -).every(5.seconds).exec { +).every(5.seconds).exec { q -> // val forceSave = every(iterations = 100) // // if (forceSave) { @@ -21,8 +21,8 @@ fun Geary.createPeriodicSaveSystem() = system( // return // } - item.editItemMeta { - persisting.forEach { + q.item.editItemMeta { + q.persisting.forEach { val newHash = it.targetData.hashCode() if (newHash != it.data.hash) { it.data.hash = newHash diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7730c12..1f75dc5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -geary = "0.27.0-dev.8" +geary = "0.27.0-dev.9" [libraries] geary-core = { module = "com.mineinabyss:geary-core", version.ref = "geary" }