diff --git a/build.gradle.kts b/build.gradle.kts index 48d8b77a..5889d308 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,7 @@ plugins { alias(idofrontLibs.plugins.mia.kotlin.jvm) alias(idofrontLibs.plugins.kotlinx.serialization) alias(idofrontLibs.plugins.mia.papermc) + alias(idofrontLibs.plugins.mia.nms) alias(idofrontLibs.plugins.mia.copyjar) alias(idofrontLibs.plugins.mia.publication) alias(idofrontLibs.plugins.mia.testing) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d421e73b..98f137aa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -gearyPaper = "0.30.1-dev.5" +gearyPaper = "0.30.1-dev.9" [libraries] geary-papermc = { module = "com.mineinabyss:geary-papermc", version.ref = "gearyPaper" } diff --git a/mobzy-plugin-integrations/src/main/kotlin/com/mineinabyss/mobzy/mythicmobs/spawning/MarkMMAsCustomMob.kt b/mobzy-plugin-integrations/src/main/kotlin/com/mineinabyss/mobzy/mythicmobs/spawning/MarkMMAsCustomMob.kt new file mode 100644 index 00000000..55d4756c --- /dev/null +++ b/mobzy-plugin-integrations/src/main/kotlin/com/mineinabyss/mobzy/mythicmobs/spawning/MarkMMAsCustomMob.kt @@ -0,0 +1,17 @@ +package com.mineinabyss.mobzy.mythicmobs.spawning + +import com.mineinabyss.geary.autoscan.AutoScan +import com.mineinabyss.geary.modules.GearyModule +import com.mineinabyss.geary.papermc.tracking.entities.components.CustomMob +import com.mineinabyss.geary.systems.builders.listener +import com.mineinabyss.geary.systems.query.ListenerQuery + +@AutoScan +fun GearyModule.markMMAsCustomMob() = listener( + object : ListenerQuery() { + val mobType by get() + override fun ensure() = event.anySet(::mobType) + } +).exec { + entity.add() +} diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/PlayerSpawnInfo.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/PlayerSpawnInfo.kt index 54bbc74f..659d6a0d 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/PlayerSpawnInfo.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/PlayerSpawnInfo.kt @@ -3,7 +3,6 @@ package com.mineinabyss.mobzy.spawning import com.mineinabyss.geary.datatypes.GearyEntity import com.mineinabyss.geary.helpers.fastForEach import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull -import com.mineinabyss.mobzy.spawning.conditions.collectPrefabs import org.bukkit.Chunk class PlayerSpawnInfo { diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnDefinition.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnDefinition.kt index 4ff1e406..7f6175be 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnDefinition.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnDefinition.kt @@ -14,7 +14,6 @@ import com.mineinabyss.geary.systems.builders.listener import com.mineinabyss.geary.systems.query.ListenerQuery import com.mineinabyss.idofront.serialization.IntRangeSerializer import com.mineinabyss.idofront.util.randomOrMin -import com.mineinabyss.mobzy.spawning.conditions.collectPrefabs import com.mineinabyss.mobzy.spawning.event.MobzySpawnEvent import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -155,7 +154,7 @@ fun GearyModule.spawnRequestListener() = listener(object : ListenerQuery() { } else { ensureSuitableLocationOrNull( chosenLoc, - (boundingBox?.clone()?.shift(chosenLoc)) ?: BoundingBox.of(chosenLoc.toVector(), 1.0, 2.0, 1.0) + (boundingBox.clone().shift(chosenLoc)) ) ?: return@repeat } diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/MobCapHasSpaceCondition.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/MobCapHasSpaceCondition.kt deleted file mode 100644 index 698d1b4c..00000000 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/MobCapHasSpaceCondition.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.mineinabyss.mobzy.spawning.conditions - -import com.mineinabyss.geary.datatypes.Entity -import com.mineinabyss.geary.datatypes.GearyEntity - - -//TODO move into geary -fun GearyEntity.collectPrefabs(): Set { - return collectPrefabs(mutableSetOf(), listOf(this)) -} - -private tailrec fun collectPrefabs(collected: MutableSet, search: List): Set { - if (search.isEmpty()) return collected - val new = search.flatMap { it.prefabs } - collected - collected.addAll(new) - return collectPrefabs(collected, new) -} - -fun GearyEntity.deepInstanceOf(prefab: Entity): Boolean { - return if (instanceOf(prefab)) return true - else deepInstanceOf(mutableSetOf(), prefabs, prefab) -} - - -private tailrec fun deepInstanceOf(seen: MutableSet, search: List, prefab: Entity): Boolean { - if (search.isEmpty()) return false - if (search.any { it.instanceOf(prefab) }) return true - seen.addAll(search) - return deepInstanceOf(seen, search.flatMap { it.prefabs } - seen, prefab) -} diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/event/SpawnStrip.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/event/SpawnStrip.kt index 94b9f044..cbee2e80 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/event/SpawnStrip.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/event/SpawnStrip.kt @@ -3,6 +3,7 @@ package com.mineinabyss.mobzy.spawning.event import com.mineinabyss.mobzy.spawning.SpawnPosition import com.mineinabyss.mobzy.spawning.mobzySpawning import org.bukkit.Chunk +import org.bukkit.Material import org.bukkit.block.Block import org.bukkit.entity.Entity import kotlin.math.min @@ -72,7 +73,7 @@ class SpawnStrip { } SpawnPosition.WATER -> if (!block.isLiquid) return null - SpawnPosition.AIR -> if (block.isSolid) return null + SpawnPosition.AIR -> if (block.type != Material.AIR) return null } return block diff --git a/settings.gradle.kts b/settings.gradle.kts index e6e47724..09747c56 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,14 +8,6 @@ pluginManagement { google() mavenLocal() } - - val idofrontVersion: String by settings - resolutionStrategy { - eachPlugin { - if (requested.id.id.startsWith("com.mineinabyss.conventions")) - useVersion(idofrontVersion) - } - } } dependencyResolutionManagement {