From 4ad211ec58864d686e195655f7dc0b3f1e2c82ca Mon Sep 17 00:00:00 2001 From: Danielle Voznyy Date: Sun, 7 Apr 2024 19:40:55 -0400 Subject: [PATCH] chore: Move out MythicMobs features to Mobzy feat: Add CustomMob component to search for custom mobs in world queries --- build.gradle.kts | 4 -- geary-papermc-bridge/build.gradle.kts | 4 -- .../geary/papermc/bridge/PaperBridge.kt | 2 - .../bridge/mythicmobs/RunMythicMobsSkills.kt | 53 ------------------- geary-papermc-plugin/build.gradle.kts | 3 -- .../papermc/plugin/commands/QueryCommand.kt | 12 ++--- .../src/main/resources/paper-plugin.yml | 4 -- geary-papermc-tracking/build.gradle.kts | 1 - .../tracking/entities/EntityTracking.kt | 15 ++---- .../tracking/entities/components/CustomMob.kt | 6 +++ .../entities/components/SetEntityType.kt | 10 ++++ .../entities/components/SetMythicMob.kt | 11 ---- .../entities/helpers/GearyMobPrefabQuery.kt | 8 +-- .../attemptspawn/AttemptSpawnMythicMob.kt | 27 ---------- .../SetBoundingBoxFromEntityType.kt | 5 +- .../SetBoundingBoxFromMythicMob.kt | 30 ----------- .../ConvertToMythicMobListener.kt | 39 -------------- .../papermc/tracking/items/ItemTracking.kt | 2 - .../items/systems/MythicMobDropSystem.kt | 24 --------- gradle/libs.versions.toml | 1 - 20 files changed, 29 insertions(+), 232 deletions(-) delete mode 100644 geary-papermc-bridge/src/main/kotlin/com/mineinabyss/geary/papermc/bridge/mythicmobs/RunMythicMobsSkills.kt create mode 100644 geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/CustomMob.kt delete mode 100644 geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/SetMythicMob.kt delete mode 100644 geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/attemptspawn/AttemptSpawnMythicMob.kt delete mode 100644 geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/boundingbox/SetBoundingBoxFromMythicMob.kt delete mode 100644 geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/updatemobtype/ConvertToMythicMobListener.kt delete mode 100644 geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/systems/MythicMobDropSystem.kt diff --git a/build.gradle.kts b/build.gradle.kts index c00d2fd..c4c8c8f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,10 +28,6 @@ allprojects { mavenCentral() maven("https://repo.mineinabyss.com/releases") maven("https://repo.mineinabyss.com/snapshots") - maven("https://raw.githubusercontent.com/TheBlackEntity/PlugMan/repository/") - maven("https://jitpack.io") - maven("https://repo.codemc.io/repository/nms/") - maven("https://mvn.lumine.io/repository/maven-public/") mavenLocal() } diff --git a/geary-papermc-bridge/build.gradle.kts b/geary-papermc-bridge/build.gradle.kts index 8748e50..abaa2e9 100644 --- a/geary-papermc-bridge/build.gradle.kts +++ b/geary-papermc-bridge/build.gradle.kts @@ -10,10 +10,6 @@ dependencies { implementation(gearyLibs.serialization) implementation(gearyLibs.autoscan) - // Plugins - compileOnly(libs.plugman) - compileOnly(idofrontLibs.minecraft.plugin.mythic.dist) - // MineInAbyss platform compileOnly(idofrontLibs.kotlin.stdlib) compileOnly(idofrontLibs.kotlinx.serialization.json) diff --git a/geary-papermc-bridge/src/main/kotlin/com/mineinabyss/geary/papermc/bridge/PaperBridge.kt b/geary-papermc-bridge/src/main/kotlin/com/mineinabyss/geary/papermc/bridge/PaperBridge.kt index bd43026..0c6c514 100644 --- a/geary-papermc-bridge/src/main/kotlin/com/mineinabyss/geary/papermc/bridge/PaperBridge.kt +++ b/geary-papermc-bridge/src/main/kotlin/com/mineinabyss/geary/papermc/bridge/PaperBridge.kt @@ -22,7 +22,6 @@ import com.mineinabyss.geary.papermc.bridge.events.entities.* import com.mineinabyss.geary.papermc.bridge.events.items.ItemBreakBridge import com.mineinabyss.geary.papermc.bridge.events.items.ItemConsumeBridge import com.mineinabyss.geary.papermc.bridge.events.items.ItemInteractBridge -import com.mineinabyss.geary.papermc.bridge.mythicmobs.createRunMMSkillAction import com.mineinabyss.geary.papermc.bridge.readers.createLocationReader import com.mineinabyss.geary.papermc.bridge.readers.createTargetBlockReader import com.mineinabyss.geary.papermc.bridge.systems.createCooldownDisplaySystem @@ -56,7 +55,6 @@ class PaperBridge { createExplosionAction() createDoSpawnAction() - createRunMMSkillAction() createDoDamageAction() createDoKnockbackAction() diff --git a/geary-papermc-bridge/src/main/kotlin/com/mineinabyss/geary/papermc/bridge/mythicmobs/RunMythicMobsSkills.kt b/geary-papermc-bridge/src/main/kotlin/com/mineinabyss/geary/papermc/bridge/mythicmobs/RunMythicMobsSkills.kt deleted file mode 100644 index 53c1090..0000000 --- a/geary-papermc-bridge/src/main/kotlin/com/mineinabyss/geary/papermc/bridge/mythicmobs/RunMythicMobsSkills.kt +++ /dev/null @@ -1,53 +0,0 @@ -package com.mineinabyss.geary.papermc.bridge.mythicmobs - -import com.google.common.collect.Lists -import com.mineinabyss.geary.modules.GearyModule -import com.mineinabyss.geary.serialization.serializers.InnerSerializer -import com.mineinabyss.geary.systems.builders.listener -import com.mineinabyss.geary.systems.query.ListenerQuery -import com.mineinabyss.idofront.typealiases.BukkitEntity -import io.lumine.mythic.api.adapters.AbstractEntity -import io.lumine.mythic.bukkit.BukkitAdapter -import io.lumine.mythic.bukkit.MythicBukkit -import io.lumine.mythic.core.skills.SkillMetadataImpl -import io.lumine.mythic.core.skills.SkillTriggers -import kotlinx.serialization.Serializable -import kotlinx.serialization.builtins.ListSerializer -import kotlinx.serialization.builtins.serializer -import kotlin.jvm.optionals.getOrNull - -@Serializable(with = RunMythicMobsSkills.Serializer::class) -class RunMythicMobsSkills( - val keys: List, -) { - class Serializer : InnerSerializer, RunMythicMobsSkills>( - serialName = "geary:run_mythic_skills", - inner = ListSerializer(String.serializer()), - inverseTransform = { it.keys }, - transform = ::RunMythicMobsSkills - ) -} - -fun GearyModule.createRunMMSkillAction() = listener( - object : ListenerQuery() { - val bukkit by get() - val skill by source.get() - } -).exec { - skill.keys.forEach { - val line = "[ - $it ]" - val entity = BukkitAdapter.adapt(bukkit) - val caster = MythicBukkit.inst().skillManager.getCaster(entity) - val skill = MythicBukkit.inst().skillManager.getSkill(line).getOrNull() - val meta = SkillMetadataImpl( - SkillTriggers.API, - caster, - entity, - entity.location, - Lists.newArrayList(*arrayOf(entity)), - null, - 1.0f - ) - skill?.execute(meta) - } -} diff --git a/geary-papermc-plugin/build.gradle.kts b/geary-papermc-plugin/build.gradle.kts index eafd645..3214bd6 100644 --- a/geary-papermc-plugin/build.gradle.kts +++ b/geary-papermc-plugin/build.gradle.kts @@ -18,9 +18,6 @@ configurations { dependencies { implementation(project(":")) - // Plugins - compileOnly(libs.plugman) - // MineInAbyss platform compileOnly(idofrontLibs.kotlin.stdlib) compileOnly(idofrontLibs.kotlinx.serialization.json) diff --git a/geary-papermc-plugin/src/main/kotlin/com/mineinabyss/geary/papermc/plugin/commands/QueryCommand.kt b/geary-papermc-plugin/src/main/kotlin/com/mineinabyss/geary/papermc/plugin/commands/QueryCommand.kt index 7f6ed83..db90a08 100644 --- a/geary-papermc-plugin/src/main/kotlin/com/mineinabyss/geary/papermc/plugin/commands/QueryCommand.kt +++ b/geary-papermc-plugin/src/main/kotlin/com/mineinabyss/geary/papermc/plugin/commands/QueryCommand.kt @@ -1,8 +1,5 @@ package com.mineinabyss.geary.papermc.plugin.commands -import com.mineinabyss.geary.components.relations.InstanceOf -import com.mineinabyss.geary.datatypes.GearyEntity -import com.mineinabyss.geary.helpers.toGeary import com.mineinabyss.geary.papermc.gearyPaper import com.mineinabyss.geary.papermc.tracking.entities.helpers.GearyMobPrefabQuery import com.mineinabyss.geary.papermc.tracking.entities.toGeary @@ -62,7 +59,9 @@ fun Command.mobsQuery() { ) if (isInfo) { val categories = entities - .groupingBy { it.toGeary().prefabs.first().get() } + .asSequence() + .flatMap { it.toGeary().prefabs } + .groupingBy { it } .eachCount() .entries .sortedByDescending { it.value } @@ -82,8 +81,3 @@ fun Command.mobsQuery() { } } } - -fun GearyEntity.deepInstanceOf(entity: GearyEntity): Boolean = - instanceOf(entity) || getRelations().any { - it.target.toGeary().deepInstanceOf(entity) - } diff --git a/geary-papermc-plugin/src/main/resources/paper-plugin.yml b/geary-papermc-plugin/src/main/resources/paper-plugin.yml index 70c7d1e..32bc2d5 100644 --- a/geary-papermc-plugin/src/main/resources/paper-plugin.yml +++ b/geary-papermc-plugin/src/main/resources/paper-plugin.yml @@ -10,10 +10,6 @@ description: An Entity Component System written for Spigot dependencies: server: - MythicMobs: - required: false - load: BEFORE - join-classpath: true Idofront: required: true load: BEFORE diff --git a/geary-papermc-tracking/build.gradle.kts b/geary-papermc-tracking/build.gradle.kts index ec62a66..ecebaeb 100644 --- a/geary-papermc-tracking/build.gradle.kts +++ b/geary-papermc-tracking/build.gradle.kts @@ -7,7 +7,6 @@ plugins { } dependencies { - compileOnly(idofrontLibs.minecraft.plugin.mythic.dist) compileOnly(idofrontLibs.idofront.nms) compileOnly(idofrontLibs.minecraft.mccoroutine) implementation(gearyLibs.uuid) diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/EntityTracking.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/EntityTracking.kt index fbdbb61..e85e462 100644 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/EntityTracking.kt +++ b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/EntityTracking.kt @@ -7,22 +7,20 @@ import com.mineinabyss.geary.helpers.componentId import com.mineinabyss.geary.modules.geary import com.mineinabyss.geary.papermc.CatchType import com.mineinabyss.geary.papermc.gearyPaper +import com.mineinabyss.geary.papermc.tracking.entities.components.markSetEntityTypeAsCustomMob import com.mineinabyss.geary.papermc.tracking.entities.helpers.GearyMobPrefabQuery import com.mineinabyss.geary.papermc.tracking.entities.systems.EntityWorldEventTracker import com.mineinabyss.geary.papermc.tracking.entities.systems.attemptspawn.createAttemptSpawnListener -import com.mineinabyss.geary.papermc.tracking.entities.systems.attemptspawn.createAttemptSpawnMythicMobListener import com.mineinabyss.geary.papermc.tracking.entities.systems.boundingbox.setBoundingBoxFromEntityType import com.mineinabyss.geary.papermc.tracking.entities.systems.createBukkitEntityRemoveListener import com.mineinabyss.geary.papermc.tracking.entities.systems.createBukkitEntitySetListener import com.mineinabyss.geary.papermc.tracking.entities.systems.removevanillamobs.RemoveVanillaMobsListener import com.mineinabyss.geary.papermc.tracking.entities.systems.updatemobtype.ConvertEntityTypesListener -import com.mineinabyss.geary.papermc.tracking.entities.systems.updatemobtype.ConvertToMythicMobListener import com.mineinabyss.geary.systems.builders.cachedQuery import com.mineinabyss.geary.systems.query.CachedQueryRunner import com.mineinabyss.idofront.di.DI import com.mineinabyss.idofront.plugin.listeners import com.mineinabyss.idofront.typealiases.BukkitEntity -import org.bukkit.Bukkit val gearyMobs by DI.observe() @@ -34,7 +32,8 @@ interface EntityTracking { companion object : GearyAddonWithDefault { override fun default(): EntityTracking = object : EntityTracking { override val bukkitEntityComponent = componentId() - override val bukkit2Geary = BukkitEntity2Geary(gearyPaper.config.catch.asyncEntityConversion == CatchType.ERROR) + override val bukkit2Geary = + BukkitEntity2Geary(gearyPaper.config.catch.asyncEntityConversion == CatchType.ERROR) override val prefabs = geary.cachedQuery(GearyMobPrefabQuery()) } @@ -43,6 +42,7 @@ interface EntityTracking { geary.createBukkitEntitySetListener() geary.createAttemptSpawnListener() geary.setBoundingBoxFromEntityType() + geary.markSetEntityTypeAsCustomMob() geary.pipeline.runOnOrAfter(GearyPhase.ENABLE) { gearyPaper.plugin.listeners( EntityWorldEventTracker(), @@ -50,13 +50,6 @@ interface EntityTracking { RemoveVanillaMobsListener(), ) - if (Bukkit.getPluginManager().plugins.any { it.name == "MythicMobs" }) { - geary.createAttemptSpawnMythicMobListener() - - gearyPaper.plugin.listeners( - ConvertToMythicMobListener(), - ) - } } } } diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/CustomMob.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/CustomMob.kt new file mode 100644 index 0000000..2275396 --- /dev/null +++ b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/CustomMob.kt @@ -0,0 +1,6 @@ +package com.mineinabyss.geary.papermc.tracking.entities.components + +import kotlinx.serialization.Serializable + +@Serializable +sealed class CustomMob diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/SetEntityType.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/SetEntityType.kt index 6111880..9070db3 100644 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/SetEntityType.kt +++ b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/SetEntityType.kt @@ -1,5 +1,8 @@ package com.mineinabyss.geary.papermc.tracking.entities.components +import com.mineinabyss.geary.modules.GearyModule +import com.mineinabyss.geary.systems.builders.listener +import com.mineinabyss.geary.systems.query.ListenerQuery import com.mineinabyss.idofront.nms.aliases.NMSEntityType import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -14,3 +17,10 @@ value class SetEntityType(val key: String) { .byString(key) .orElseGet { error("An entity type with key $key was not found.") } } + +fun GearyModule.markSetEntityTypeAsCustomMob() = listener(object : ListenerQuery() { + val entityType by get() + override fun ensure() = event.anySet(::entityType) +}).exec { + entity.add() +} diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/SetMythicMob.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/SetMythicMob.kt deleted file mode 100644 index 9f7617f..0000000 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/components/SetMythicMob.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.mineinabyss.geary.papermc.tracking.entities.components - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable -import kotlinx.serialization.Transient -import net.minecraft.world.entity.EntityType - -@JvmInline -@Serializable -@SerialName("geary:set.mythic_mob") -value class SetMythicMob(val id: String) diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/helpers/GearyMobPrefabQuery.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/helpers/GearyMobPrefabQuery.kt index a604f97..571f70e 100644 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/helpers/GearyMobPrefabQuery.kt +++ b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/helpers/GearyMobPrefabQuery.kt @@ -3,8 +3,7 @@ package com.mineinabyss.geary.papermc.tracking.entities.helpers import com.mineinabyss.geary.datatypes.GearyEntity import com.mineinabyss.geary.datatypes.family.family import com.mineinabyss.geary.helpers.contains -import com.mineinabyss.geary.papermc.tracking.entities.components.SetEntityType -import com.mineinabyss.geary.papermc.tracking.entities.components.SetMythicMob +import com.mineinabyss.geary.papermc.tracking.entities.components.CustomMob import com.mineinabyss.geary.prefabs.PrefabKey import com.mineinabyss.geary.prefabs.configuration.components.Prefab import com.mineinabyss.geary.systems.query.CachedQueryRunner @@ -22,10 +21,7 @@ class GearyMobPrefabQuery : GearyQuery() { private val mobQuery = family { has() - or { - has() - has() - } + has() } fun isMob(entity: GearyEntity): Boolean { diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/attemptspawn/AttemptSpawnMythicMob.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/attemptspawn/AttemptSpawnMythicMob.kt deleted file mode 100644 index 063b540..0000000 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/attemptspawn/AttemptSpawnMythicMob.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.mineinabyss.geary.papermc.tracking.entities.systems.attemptspawn - -import com.mineinabyss.geary.modules.GearyModule -import com.mineinabyss.geary.modules.geary -import com.mineinabyss.geary.papermc.tracking.entities.components.AttemptSpawn -import com.mineinabyss.geary.papermc.tracking.entities.components.SetMythicMob -import com.mineinabyss.geary.systems.builders.listener -import com.mineinabyss.geary.systems.query.ListenerQuery -import com.mineinabyss.idofront.typealiases.BukkitEntity -import io.lumine.mythic.api.mobs.entities.SpawnReason -import io.lumine.mythic.bukkit.BukkitAdapter -import io.lumine.mythic.bukkit.MythicBukkit -import kotlin.jvm.optionals.getOrNull - -fun GearyModule.createAttemptSpawnMythicMobListener() = listener( - object : ListenerQuery() { - val mobType by get() - val attemptSpawn by event.get() - override fun ensure() = this { not { has() } } - } -).exec { - val mythicMob = MythicBukkit.inst().mobManager.getMythicMob(mobType.id).getOrNull() ?: return@exec - mythicMob.spawn(BukkitAdapter.adapt(attemptSpawn.location), 1.0, SpawnReason.NATURAL) { mob -> - entity.set(mob) - entity.set(mythicMob) - } -} diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/boundingbox/SetBoundingBoxFromEntityType.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/boundingbox/SetBoundingBoxFromEntityType.kt index 7e95807..09b28a0 100644 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/boundingbox/SetBoundingBoxFromEntityType.kt +++ b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/boundingbox/SetBoundingBoxFromEntityType.kt @@ -10,7 +10,10 @@ import org.bukkit.util.BoundingBox fun GearyModule.setBoundingBoxFromEntityType() = listener( object : ListenerQuery() { val mobType by get() - override fun ensure() = event.anySet(::mobType) + override fun ensure() { + event.anySet(::mobType) + this { not { has() } } + } } ).exec { entity.addRelation() diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/boundingbox/SetBoundingBoxFromMythicMob.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/boundingbox/SetBoundingBoxFromMythicMob.kt deleted file mode 100644 index 5625c96..0000000 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/boundingbox/SetBoundingBoxFromMythicMob.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.mineinabyss.geary.papermc.tracking.entities.systems.boundingbox - -import com.mineinabyss.geary.components.relations.NoInherit -import com.mineinabyss.geary.modules.GearyModule -import com.mineinabyss.geary.papermc.tracking.entities.components.SetMythicMob -import com.mineinabyss.geary.systems.builders.listener -import com.mineinabyss.geary.systems.query.ListenerQuery -import com.mineinabyss.idofront.nms.aliases.NMSEntityType -import io.lumine.mythic.bukkit.MythicBukkit -import org.bukkit.NamespacedKey -import org.bukkit.util.BoundingBox -import kotlin.jvm.optionals.getOrNull - -fun GearyModule.setBoundingBoxFromMythicMob() = listener( - object : ListenerQuery() { - val mobType by get() - override fun ensure() = event.anySet(::mobType) - } -).exec { - val mythicMob = MythicBukkit.inst().mobManager.getMythicMob(mobType.id).getOrNull() ?: return@exec - -// val megModel = mythicMob.model.config.getString("Id") - val vanillaType = NamespacedKey.minecraft(mythicMob.entityType.name.lowercase()) - - val nmsType = NMSEntityType.byString(vanillaType.toString()) - .orElseGet { error("An entity type with key $vanillaType was not found.") } - - entity.addRelation() - entity.set(BoundingBoxHelpers.getForEntityType(nmsType)) -} diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/updatemobtype/ConvertToMythicMobListener.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/updatemobtype/ConvertToMythicMobListener.kt deleted file mode 100644 index a9aded4..0000000 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/entities/systems/updatemobtype/ConvertToMythicMobListener.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.mineinabyss.geary.papermc.tracking.entities.systems.updatemobtype - -import com.mineinabyss.geary.papermc.MobTypeConversion -import com.mineinabyss.geary.papermc.gearyPaper -import com.mineinabyss.geary.papermc.tracking.entities.components.SetMythicMob -import com.mineinabyss.geary.papermc.tracking.entities.events.GearyEntityAddToWorldEvent -import io.lumine.mythic.api.mobs.MythicMob -import io.lumine.mythic.bukkit.MythicBukkit -import io.lumine.mythic.core.constants.MobKeys -import org.bukkit.event.EventHandler -import org.bukkit.event.Listener - -class ConvertToMythicMobListener : Listener { - @EventHandler - fun GearyEntityAddToWorldEvent.onAdd() { - if (gearyPaper.config.mobTypeConversion == MobTypeConversion.IGNORE) return - val mm = MythicBukkit.inst() - if (mm.mobManager == null) return - - // If MM already encoded or loaded, we let it handle things itself - if (entity.persistentDataContainer.has(MobKeys.TYPE)) return - if (mm.mobManager.isActiveMob(entity.uniqueId)) return - - if (!gearyEntity.has()) return - if (gearyEntity.has()) return - - when (gearyPaper.config.mobTypeConversion) { - MobTypeConversion.MIGRATE -> { - UpdateMob.scheduleRecreation(entity, gearyEntity) - } - - MobTypeConversion.REMOVE -> { - UpdateMob.scheduleRemove(entity) - } - - MobTypeConversion.IGNORE -> Unit - } - } -} diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/ItemTracking.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/ItemTracking.kt index 57ea315..f932ad0 100644 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/ItemTracking.kt +++ b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/ItemTracking.kt @@ -12,7 +12,6 @@ import com.mineinabyss.geary.papermc.tracking.items.migration.SetItemIgnoredProp import com.mineinabyss.geary.papermc.tracking.items.migration.createCustomModelDataToPrefabTracker import com.mineinabyss.geary.papermc.tracking.items.migration.createItemMigrationListener import com.mineinabyss.geary.papermc.tracking.items.systems.LoginListener -import com.mineinabyss.geary.papermc.tracking.items.systems.MythicMobDropSystem import com.mineinabyss.geary.papermc.tracking.items.systems.createInventoryTrackerSystem import com.mineinabyss.geary.prefabs.PrefabKey import com.mineinabyss.geary.systems.query.CachedQueryRunner @@ -46,7 +45,6 @@ interface ItemTracking { gearyPaper.plugin.listeners( loginListener, SetItemIgnoredPropertyListener(), - MythicMobDropSystem() ) } } diff --git a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/systems/MythicMobDropSystem.kt b/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/systems/MythicMobDropSystem.kt deleted file mode 100644 index 4c0aa53..0000000 --- a/geary-papermc-tracking/src/main/kotlin/com/mineinabyss/geary/papermc/tracking/items/systems/MythicMobDropSystem.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.mineinabyss.geary.papermc.tracking.items.systems - -import com.mineinabyss.geary.papermc.tracking.items.gearyItems -import com.mineinabyss.geary.papermc.tracking.items.helpers.GearyItemPrefabQuery.Companion.getKeys -import com.mineinabyss.geary.prefabs.PrefabKey -import io.lumine.mythic.bukkit.adapters.BukkitItemStack -import io.lumine.mythic.bukkit.events.MythicDropLoadEvent -import io.lumine.mythic.core.drops.droppables.ItemDrop -import io.lumine.mythic.core.drops.droppables.VanillaItemDrop -import org.bukkit.event.EventHandler -import org.bukkit.event.Listener - - -class MythicMobDropSystem : Listener { - - @EventHandler - fun MythicDropLoadEvent.onMythicDropLoad() { - if (dropName.lowercase() != "geary") return - val prefabKey = PrefabKey.of(container.line.split(" ")[1]) - if (prefabKey !in gearyItems.prefabs.getKeys()) return - - register(VanillaItemDrop(container.line, config, BukkitItemStack(gearyItems.createItem(prefabKey)))) - } -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 144b7fa..62584b2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,2 +1 @@ [libraries] -plugman = "com.rylinaux:PlugMan:2.2.5"