mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-20 15:39:31 +00:00
Switched to ModelEngineBridge
This commit is contained in:
@@ -51,6 +51,7 @@ allprojects {
|
|||||||
tasks {
|
tasks {
|
||||||
shadowJar {
|
shadowJar {
|
||||||
relocate("com.willfp.libreforge.loader", "com.willfp.ecobosses.libreforge.loader")
|
relocate("com.willfp.libreforge.loader", "com.willfp.ecobosses.libreforge.loader")
|
||||||
|
relocate("com.willfp.modelenginebridge", "com.willfp.ecobosses.modelenginebridge")
|
||||||
}
|
}
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ version = rootProject.version
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
|
compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
|
||||||
compileOnly("com.github.lokka30:LevelledMobs:3.1.4")
|
compileOnly("com.github.lokka30:LevelledMobs:3.1.4")
|
||||||
compileOnly("com.ticxo.modelengine:api:R3.1.8")
|
implementation("com.willfp:ModelEngineBridge:1.2.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.willfp.ecobosses.bosses
|
package com.willfp.ecobosses.bosses
|
||||||
|
|
||||||
import com.ticxo.modelengine.api.ModelEngineAPI
|
|
||||||
import com.willfp.eco.core.EcoPlugin
|
import com.willfp.eco.core.EcoPlugin
|
||||||
import com.willfp.eco.core.config.interfaces.Config
|
import com.willfp.eco.core.config.interfaces.Config
|
||||||
import com.willfp.eco.core.entities.CustomEntity
|
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.ViolationContext
|
||||||
import com.willfp.libreforge.conditions.Conditions
|
import com.willfp.libreforge.conditions.Conditions
|
||||||
import com.willfp.libreforge.effects.Effects
|
import com.willfp.libreforge.effects.Effects
|
||||||
|
import com.willfp.modelenginebridge.ModelEngineBridge
|
||||||
import net.kyori.adventure.bossbar.BossBar
|
import net.kyori.adventure.bossbar.BossBar
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
@@ -306,8 +306,6 @@ class EcoBoss(
|
|||||||
|
|
||||||
private val modelEngineID = config.getStringOrNull("model-engine-id")
|
private val modelEngineID = config.getStringOrNull("model-engine-id")
|
||||||
|
|
||||||
private val modelEngineAnimation = config.getStringOrNull("model-engine-animation")
|
|
||||||
|
|
||||||
private val currentlyAlive = mutableMapOf<UUID, LivingEcoBoss>()
|
private val currentlyAlive = mutableMapOf<UUID, LivingEcoBoss>()
|
||||||
|
|
||||||
override val conditions = Conditions.compile(
|
override val conditions = Conditions.compile(
|
||||||
@@ -357,33 +355,16 @@ class EcoBoss(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (modelEngineID != null && Bukkit.getPluginManager().isPluginEnabled("ModelEngine")) {
|
if (modelEngineID != null && Bukkit.getPluginManager().isPluginEnabled("ModelEngine")) {
|
||||||
val model = ModelEngineAPI.createActiveModel(modelEngineID)
|
val model = ModelEngineBridge.instance.createActiveModel(modelEngineID)
|
||||||
|
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
plugin.logger.warning("Invalid Model Engine ID for boss $id")
|
plugin.logger.warning("Invalid Model Engine ID for boss $id")
|
||||||
}
|
|
||||||
|
|
||||||
if (modelEngineAnimation != null) {
|
|
||||||
val animationHandler = model.animationHandler
|
|
||||||
val animationProperty = animationHandler.getAnimation(modelEngineAnimation)
|
|
||||||
|
|
||||||
if (animationProperty != null) {
|
|
||||||
animationHandler.playAnimation(animationProperty, true)
|
|
||||||
} else {
|
} else {
|
||||||
plugin.logger.warning("Animation $modelEngineAnimation not found in model $modelEngineID, defaulting to walk!")
|
val modelled = ModelEngineBridge.instance.createModeledEntity(mob)
|
||||||
val animationPropertyWalk = animationHandler.getAnimation("walk")
|
modelled.addModel(model)
|
||||||
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
|
modelled.isBaseEntityVisible = false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val boss = LivingEcoBoss(
|
val boss = LivingEcoBoss(
|
||||||
plugin,
|
plugin,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
mob: illusioner attack-damage:50 health:600 hand:"iron_sword sharpness:5"
|
mob: illusioner attack-damage:50 health:600 hand:"iron_sword sharpness:5"
|
||||||
|
|
||||||
model-engine-id: ""
|
model-engine-id: ""
|
||||||
model-engine-animation: ""
|
|
||||||
|
|
||||||
display-name: "&9Illusioner &7| &c%health%♥ &7| &e%time%"
|
display-name: "&9Illusioner &7| &c%health%♥ &7| &e%time%"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user