diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/EcoPetsPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/EcoPetsPlugin.kt index 7588773..1642195 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/EcoPetsPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/EcoPetsPlugin.kt @@ -54,7 +54,7 @@ class EcoPetsPlugin : LibReforgePlugin() { return listOf( IntegrationLoader("ModelEngine") { PetEntity.registerPetEntity("modelengine") { pet, id -> - ModelEnginePetEntity(pet, id) + ModelEnginePetEntity(pet, id, pet.entityAnimation) } } ) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/Pet.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/Pet.kt index 45edae6..db12756 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/Pet.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/Pet.kt @@ -114,6 +114,8 @@ class Pet( val entityTexture = config.getString("entity-texture") + val entityAnimation = config.getString("default-animation") + private val levelXpRequirements = listOf(0) + config.getInts("level-xp-requirements") val maxLevel = levelXpRequirements.size diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/entity/ModelEnginePetEntity.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/entity/ModelEnginePetEntity.kt index 133074c..2636480 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/entity/ModelEnginePetEntity.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/entity/ModelEnginePetEntity.kt @@ -7,12 +7,18 @@ import org.bukkit.entity.ArmorStand class ModelEnginePetEntity( pet: Pet, - private val modelID: String + private val modelID: String, + private val animationString: String, ) : PetEntity(pet) { override fun spawn(location: Location): ArmorStand { val stand = emptyArmorStandAt(location, pet) val model = ModelEngineAPI.createActiveModel(modelID) + val animationHandler = model.animationHandler; + val modelAnimation = animationHandler.getAnimation(animationString); + + if (modelAnimation != null) animationHandler.playAnimation(modelAnimation, true); + val modelled = ModelEngineAPI.createModeledEntity(stand) modelled.addModel(model, true)