diff --git a/build.gradle.kts b/build.gradle.kts index b3ecea6..6cff17b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,6 +51,7 @@ allprojects { tasks { shadowJar { relocate("com.willfp.libreforge.loader", "com.willfp.ecobosses.libreforge.loader") + relocate("com.willfp.modelenginebridge", "com.willfp.ecobosses.modelenginebridge") } compileKotlin { diff --git a/eco-core/core-plugin/build.gradle.kts b/eco-core/core-plugin/build.gradle.kts index d627370..45fbd5a 100644 --- a/eco-core/core-plugin/build.gradle.kts +++ b/eco-core/core-plugin/build.gradle.kts @@ -4,7 +4,7 @@ version = rootProject.version dependencies { compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT") compileOnly("com.github.lokka30:LevelledMobs:3.1.4") - compileOnly("com.ticxo.modelengine:api:R3.1.8") + implementation("com.willfp:ModelEngineBridge:1.2.0") } publishing { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt index 6a1f529..650450b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt @@ -1,6 +1,5 @@ package com.willfp.ecobosses.bosses -import com.ticxo.modelengine.api.ModelEngineAPI import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.config.interfaces.Config import com.willfp.eco.core.entities.CustomEntity @@ -42,6 +41,7 @@ import com.willfp.libreforge.Holder import com.willfp.libreforge.ViolationContext import com.willfp.libreforge.conditions.Conditions import com.willfp.libreforge.effects.Effects +import com.willfp.modelenginebridge.ModelEngineBridge import net.kyori.adventure.bossbar.BossBar import org.bukkit.Bukkit import org.bukkit.Location @@ -306,8 +306,6 @@ class EcoBoss( private val modelEngineID = config.getStringOrNull("model-engine-id") - private val modelEngineAnimation = config.getStringOrNull("model-engine-animation") - private val currentlyAlive = mutableMapOf() override val conditions = Conditions.compile( @@ -357,32 +355,15 @@ class EcoBoss( } if (modelEngineID != null && Bukkit.getPluginManager().isPluginEnabled("ModelEngine")) { - val model = ModelEngineAPI.createActiveModel(modelEngineID) + val model = ModelEngineBridge.instance.createActiveModel(modelEngineID) if (model == null) { plugin.logger.warning("Invalid Model Engine ID for boss $id") + } else { + val modelled = ModelEngineBridge.instance.createModeledEntity(mob) + modelled.addModel(model) + modelled.isBaseEntityVisible = false } - - if (modelEngineAnimation != null) { - val animationHandler = model.animationHandler - val animationProperty = animationHandler.getAnimation(modelEngineAnimation) - - if (animationProperty != null) { - animationHandler.playAnimation(animationProperty, true) - } else { - plugin.logger.warning("Animation $modelEngineAnimation not found in model $modelEngineID, defaulting to walk!") - val animationPropertyWalk = animationHandler.getAnimation("walk") - if (animationPropertyWalk != null) { - animationHandler.playAnimation(animationPropertyWalk, true) - } else { - plugin.logger.warning("Walk animation not found in $modelEngineID!") - } - } - } - - val modelled = ModelEngineAPI.createModeledEntity(mob) - modelled.addModel(model, true) - modelled.isBaseEntityVisible = false } val boss = LivingEcoBoss( diff --git a/eco-core/core-plugin/src/main/resources/bosses/illusioner.yml b/eco-core/core-plugin/src/main/resources/bosses/illusioner.yml index 0bbf21f..8beceb1 100644 --- a/eco-core/core-plugin/src/main/resources/bosses/illusioner.yml +++ b/eco-core/core-plugin/src/main/resources/bosses/illusioner.yml @@ -1,7 +1,6 @@ mob: illusioner attack-damage:50 health:600 hand:"iron_sword sharpness:5" model-engine-id: "" -model-engine-animation: "" display-name: "&9Illusioner &7| &c%health%♥ &7| &e%time%"