From 43a8bc924c0b5110d4e6dcab0a922ad8ee46d146 Mon Sep 17 00:00:00 2001 From: Boy Date: Sun, 27 Oct 2024 15:36:01 +0100 Subject: [PATCH] refactor: pass initial argument in withGeary block --- .../main/kotlin/com/mineinabyss/geary/papermc/Helpers.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/geary-papermc-core/src/main/kotlin/com/mineinabyss/geary/papermc/Helpers.kt b/geary-papermc-core/src/main/kotlin/com/mineinabyss/geary/papermc/Helpers.kt index b8865e2..b808789 100644 --- a/geary-papermc-core/src/main/kotlin/com/mineinabyss/geary/papermc/Helpers.kt +++ b/geary-papermc-core/src/main/kotlin/com/mineinabyss/geary/papermc/Helpers.kt @@ -5,10 +5,13 @@ import com.mineinabyss.geary.prefabs.PrefabKey import com.mineinabyss.geary.prefabs.entityOfOrNull import com.mineinabyss.idofront.typealiases.BukkitEntity import org.bukkit.block.Block +import org.bukkit.block.TileState context(Geary) fun PrefabKey.toEntityOrNull() = entityOfOrNull(this) -inline fun BukkitEntity.withGeary(run: Geary.() -> T) = with(world.toGeary()) { run() } +inline fun R.withGeary(run: Geary.(R) -> T) = with(world.toGeary()) { run(this@withGeary) } -inline fun Block.withGeary(run: Geary.() -> T) = with(world.toGeary()) { run() } +inline fun R.withGeary(run: Geary.(R) -> T) = with(world.toGeary()) { run(this@withGeary) } + +inline fun R.withGeary(run: Geary.(R) -> T) = with(world.toGeary()) { run(this@withGeary) }