diff --git a/gradle.properties b/gradle.properties index 145d2a333..b692ba066 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.mineinabyss -version=0.16 +version=0.17 useNMS=true idofrontVersion=0.11.95 kotlinVersion=1.6.10 diff --git a/gradle/mobzylibs.versions.toml b/gradle/mobzylibs.versions.toml index 114cb2df8..b5d29c5a4 100644 --- a/gradle/mobzylibs.versions.toml +++ b/gradle/mobzylibs.versions.toml @@ -1,5 +1,5 @@ [versions] -geary = "0.16.100" +geary = "0.17.102" [libraries] protocolburrito = "com.mineinabyss:protocolburrito:0.4.33" diff --git a/mobzy-nms-injection/src/main/kotlin/com/mineinabyss/mobzy/injection/MobzyNMSTypeInjector.kt b/mobzy-nms-injection/src/main/kotlin/com/mineinabyss/mobzy/injection/MobzyNMSTypeInjector.kt index 38af94abd..bf9735faa 100644 --- a/mobzy-nms-injection/src/main/kotlin/com/mineinabyss/mobzy/injection/MobzyNMSTypeInjector.kt +++ b/mobzy-nms-injection/src/main/kotlin/com/mineinabyss/mobzy/injection/MobzyNMSTypeInjector.kt @@ -2,14 +2,12 @@ package com.mineinabyss.mobzy.injection import com.mineinabyss.geary.annotations.AutoScan import com.mineinabyss.geary.annotations.Handler -import com.mineinabyss.geary.components.Processed -import com.mineinabyss.geary.datatypes.family.MutableFamilyOperations.Companion.has +import com.mineinabyss.geary.components.relations.Processed import com.mineinabyss.geary.datatypes.family.family import com.mineinabyss.geary.prefabs.PrefabKey import com.mineinabyss.geary.prefabs.configuration.components.Prefab import com.mineinabyss.geary.systems.GearyListener import com.mineinabyss.geary.systems.accessors.TargetScope -import com.mineinabyss.geary.systems.accessors.get import com.mineinabyss.geary.systems.query.GearyQuery import com.mineinabyss.mobzy.ecs.components.initialization.MobzyType import com.mineinabyss.mobzy.ecs.components.toMobzyCategory @@ -23,14 +21,14 @@ object MobzyTypesQuery : GearyQuery() { has() } - fun getKeys() = map { it.key } + fun getKeys() = MobzyTypesQuery.run { map { it.key } } } fun PrefabKey.toResourceKey(): ResourceLocation = ResourceLocation(namespace, key) @AutoScan class MobzyNMSTypeInjector : GearyListener() { - private val TargetScope.info by added() + private val TargetScope.info by onSet() private val TargetScope.prefab by family { has() } @Handler @@ -40,6 +38,6 @@ class MobzyNMSTypeInjector : GearyListener() { } entity.set(nmsEntityType) entity.set(info.mobCategory ?: info.creatureType.toMobzyCategory()) - entity.setRelation(MobzyType::class, Processed) + entity.addRelation() } } diff --git a/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/PathfinderAttachSystem.kt b/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/PathfinderAttachSystem.kt index f47d077e1..89bb037ad 100644 --- a/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/PathfinderAttachSystem.kt +++ b/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/PathfinderAttachSystem.kt @@ -13,8 +13,8 @@ import org.bukkit.entity.Mob @AutoScan class PathfinderAttachSystem : GearyListener() { - val TargetScope.bukkit by added() - val TargetScope.pathfinders by added() + val TargetScope.bukkit by onSet() + val TargetScope.pathfinders by onSet() @Handler fun TargetScope.attachPathfinders() { diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/MobCountManager.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/MobCountManager.kt index f70f50f85..ef8d80a69 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/MobCountManager.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/MobCountManager.kt @@ -30,8 +30,8 @@ object MobCountManager : Listener, GearyMCContext by GearyMCContextKoin() { @AutoScan class CountMobsSystem : GearyListener() { - val TargetScope.bukkitEntity by added() - val TargetScope.category by added() + val TargetScope.bukkitEntity by onSet() + val TargetScope.category by onSet() @Handler fun TargetScope.count() { diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnRegistry.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnRegistry.kt index 38af60e57..4663e8123 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnRegistry.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnRegistry.kt @@ -7,7 +7,6 @@ import com.mineinabyss.geary.prefabs.PrefabManager import com.mineinabyss.geary.prefabs.PrefabManagerContext import com.mineinabyss.geary.systems.GearyListener import com.mineinabyss.geary.systems.accessors.TargetScope -import com.mineinabyss.geary.systems.accessors.get import com.mineinabyss.geary.systems.query.GearyQuery import com.mineinabyss.mobzy.spawning.SpawnRegistry.regionSpawns import com.sk89q.worldguard.WorldGuard @@ -23,8 +22,8 @@ import org.koin.core.component.inject object SpawnRegistry : GearyListener(), PrefabManagerContext { override val prefabManager: PrefabManager by inject() - private val TargetScope.parentRegions by added() - private val TargetScope.spawn by added() + private val TargetScope.parentRegions by onSet() + private val TargetScope.spawn by onSet() private val regionContainer = WorldGuard.getInstance().platform.regionContainer private val regionSpawns: MutableMap> = HashMap() diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/BlockCompositionCondition.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/BlockCompositionCondition.kt index 8a43f60ca..a04dc2dcc 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/BlockCompositionCondition.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/BlockCompositionCondition.kt @@ -5,7 +5,6 @@ import com.mineinabyss.geary.annotations.Handler import com.mineinabyss.geary.systems.GearyListener import com.mineinabyss.geary.systems.accessors.EventScope import com.mineinabyss.geary.systems.accessors.TargetScope -import com.mineinabyss.geary.systems.accessors.get import com.mineinabyss.idofront.serialization.DoubleRangeSerializer import com.mineinabyss.idofront.util.DoubleRange import com.mineinabyss.mobzy.spawning.vertical.SpawnInfo diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/LocalGroupConditions.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/LocalGroupConditions.kt index 77ec52886..bae79ba56 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/LocalGroupConditions.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/LocalGroupConditions.kt @@ -6,7 +6,6 @@ import com.mineinabyss.geary.prefabs.PrefabKey import com.mineinabyss.geary.systems.GearyListener import com.mineinabyss.geary.systems.accessors.EventScope import com.mineinabyss.geary.systems.accessors.TargetScope -import com.mineinabyss.geary.systems.accessors.get import com.mineinabyss.mobzy.spawning.SpawnType import com.mineinabyss.mobzy.spawning.vertical.SpawnInfo import kotlinx.serialization.SerialName diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnCategoryCapCondition.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnCategoryCapCondition.kt index 7dc6f60da..006de8335 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnCategoryCapCondition.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnCategoryCapCondition.kt @@ -3,12 +3,9 @@ package com.mineinabyss.mobzy.spawning.conditions.components import com.mineinabyss.geary.annotations.AutoScan import com.mineinabyss.geary.annotations.Handler import com.mineinabyss.geary.datatypes.family.family -import com.mineinabyss.geary.datatypes.family.MutableFamilyOperations.Companion.has -import com.mineinabyss.geary.datatypes.family.MutableFamilyOperations.Companion.not import com.mineinabyss.geary.systems.GearyListener import com.mineinabyss.geary.systems.accessors.EventScope import com.mineinabyss.geary.systems.accessors.TargetScope -import com.mineinabyss.geary.systems.accessors.get import com.mineinabyss.mobzy.ecs.components.MobCategory import com.mineinabyss.mobzy.spawning.MobCountManager import com.mineinabyss.mobzy.spawning.SpawnType @@ -18,7 +15,7 @@ import kotlinx.serialization.Serializable @Serializable @SerialName("mobzy:ignore.spawn.category_cap") -class IgnoreSpawnCategoryCap() +class IgnoreSpawnCategoryCap @AutoScan class SpawnCategoryCapCondition : GearyListener() { diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnDelayCondition.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnDelayCondition.kt index 8b246f7ef..c0cf0d48e 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnDelayCondition.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnDelayCondition.kt @@ -4,7 +4,6 @@ import com.mineinabyss.geary.annotations.AutoScan import com.mineinabyss.geary.annotations.Handler import com.mineinabyss.geary.systems.GearyListener import com.mineinabyss.geary.systems.accessors.TargetScope -import com.mineinabyss.geary.systems.accessors.get import com.mineinabyss.idofront.serialization.DurationSerializer import com.mineinabyss.mobzy.mobzyConfig import com.mineinabyss.mobzy.spawning.GlobalSpawnInfo diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnGapCondition.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnGapCondition.kt index a3aacea88..a6bb5d591 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnGapCondition.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/conditions/components/SpawnGapCondition.kt @@ -5,7 +5,6 @@ import com.mineinabyss.geary.annotations.Handler import com.mineinabyss.geary.systems.GearyListener import com.mineinabyss.geary.systems.accessors.EventScope import com.mineinabyss.geary.systems.accessors.TargetScope -import com.mineinabyss.geary.systems.accessors.get import com.mineinabyss.idofront.serialization.IntRangeSerializer import com.mineinabyss.mobzy.spawning.vertical.SpawnInfo import kotlinx.serialization.SerialName diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/vertical/SpawnInfo.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/vertical/SpawnInfo.kt index 9a391912f..9f01239a2 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/vertical/SpawnInfo.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/vertical/SpawnInfo.kt @@ -1,9 +1,7 @@ package com.mineinabyss.mobzy.spawning.vertical import com.mineinabyss.geary.systems.accessors.TargetScope -import com.mineinabyss.geary.systems.accessors.get import com.mineinabyss.geary.systems.query.GearyQuery -import com.mineinabyss.geary.systems.query.invoke import com.mineinabyss.idofront.location.down import com.mineinabyss.idofront.location.up import com.mineinabyss.idofront.typealiases.BukkitEntity @@ -42,7 +40,7 @@ class SpawnInfo( //TODO more efficiently finding all ECS entities nearby val localMobs: List by lazy { - NearbyQuery { + NearbyQuery.run { map { it.bukkit }.filter { it.location.world == bottom.world && it.location.distanceSquared(bottom) < searchRadiusSquared } diff --git a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/ApplyItemModelListener.kt b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/ApplyItemModelListener.kt index 5fa73bb08..75e293784 100644 --- a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/ApplyItemModelListener.kt +++ b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/ApplyItemModelListener.kt @@ -9,8 +9,8 @@ import org.bukkit.entity.Snowball @AutoScan class ApplyItemModelListener : GearyListener() { - val TargetScope.model by added() - val TargetScope.bukkit by added() + val TargetScope.model by onSet() + val TargetScope.bukkit by onSet() @Handler fun TargetScope.applyModel() { diff --git a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/AttributesListener.kt b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/AttributesListener.kt index 068f20f6f..7fa882aff 100644 --- a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/AttributesListener.kt +++ b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/AttributesListener.kt @@ -15,8 +15,8 @@ import org.bukkit.entity.LivingEntity //TODO Make sure this is the first thing to run when priority support comes @AutoScan class AddPrefabFromNMSTypeSystem : GearyListener() { - private val TargetScope.bukkitEntity by added() - private val TargetScope.attributes by added() + private val TargetScope.bukkitEntity by onSet() + private val TargetScope.attributes by onSet() @Handler fun TargetScope.addPrefab() { diff --git a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/GearySpawningListener.kt b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/GearySpawningListener.kt index c7a892a33..210316253 100644 --- a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/GearySpawningListener.kt +++ b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/GearySpawningListener.kt @@ -24,7 +24,6 @@ object GearySpawningListener : Listener { spawned.toGeary().apply { addPrefab(prefab) - set(spawned.toBukkit()) GearyMinecraftSpawnEvent(this).call() } if (spawned is Mob) { diff --git a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/CopyNBTSystem.kt b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/CopyNBTSystem.kt index e5a95592e..b35b8bd82 100644 --- a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/CopyNBTSystem.kt +++ b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/CopyNBTSystem.kt @@ -18,8 +18,8 @@ import com.mineinabyss.mobzy.ecs.components.CopyNBT */ @AutoScan class CopyNBTSystem : GearyListener() { - private val TargetScope.nbt by added() - private val TargetScope.bukkitEntity by added() + private val TargetScope.nbt by onSet() + private val TargetScope.bukkitEntity by onSet() @Handler fun TargetScope.copyNBT() { diff --git a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/ModelEngineSystem.kt b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/ModelEngineSystem.kt index 2da4efb59..615e0084c 100644 --- a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/ModelEngineSystem.kt +++ b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/ModelEngineSystem.kt @@ -38,8 +38,8 @@ object ModelEngineSystem : GearySystem, Listener, AnimationController, GearyCont ?.forEach { it.removeState(state, ignoreLerp) } class ModelEngineTracker : GearyListener() { - val TargetScope.bukkit by added() - val TargetScope.model by added() + val TargetScope.bukkit by onSet() + val TargetScope.model by onSet() @Handler fun TargetScope.registerModelEngine() { diff --git a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/WalkingAnimationSystem.kt b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/WalkingAnimationSystem.kt index 9b0d2a7b9..911a47830 100644 --- a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/WalkingAnimationSystem.kt +++ b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/WalkingAnimationSystem.kt @@ -3,7 +3,6 @@ package com.mineinabyss.mobzy.systems.systems import com.mineinabyss.geary.annotations.AutoScan import com.mineinabyss.geary.systems.TickingSystem import com.mineinabyss.geary.systems.accessors.TargetScope -import com.mineinabyss.geary.systems.accessors.get import com.mineinabyss.idofront.nms.aliases.toNMS import com.mineinabyss.idofront.typealiases.BukkitEntity import com.mineinabyss.mobzy.ecs.components.initialization.Model diff --git a/src/main/kotlin/com/mineinabyss/mobzy/MobzyCommands.kt b/src/main/kotlin/com/mineinabyss/mobzy/MobzyCommands.kt index 1fef7e2d1..535446a52 100644 --- a/src/main/kotlin/com/mineinabyss/mobzy/MobzyCommands.kt +++ b/src/main/kotlin/com/mineinabyss/mobzy/MobzyCommands.kt @@ -5,7 +5,6 @@ import com.mineinabyss.geary.papermc.GearyMCContextKoin import com.mineinabyss.geary.papermc.access.toGeary import com.mineinabyss.geary.papermc.helpers.spawnFromPrefab import com.mineinabyss.geary.prefabs.PrefabKey -import com.mineinabyss.geary.systems.query.invoke import com.mineinabyss.idofront.commands.arguments.booleanArg import com.mineinabyss.idofront.commands.arguments.intArg import com.mineinabyss.idofront.commands.arguments.optionArg @@ -195,7 +194,7 @@ class MobzyCommands : IdofrontCommandExecutor(), TabCompleter, GearyContext by G if (subCommand == "spawn" || subCommand == "s") if (args.size == 2) { - return MobzyTypesQuery { + return MobzyTypesQuery.run { filter { val arg = args[1].lowercase() it.key.key.startsWith(arg) || it.key.full.startsWith(arg)