@@ -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
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.willfp.ecopets.pets.entity
|
||||
|
||||
import com.ticxo.modelengine.api.ModelEngineAPI
|
||||
import com.willfp.ecopets.EcoPetsPlugin
|
||||
import com.willfp.ecopets.pets.Pet
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.entity.ArmorStand
|
||||
@@ -11,8 +12,24 @@ class ModelEnginePetEntity(
|
||||
) : PetEntity(pet) {
|
||||
override fun spawn(location: Location): ArmorStand {
|
||||
val stand = emptyArmorStandAt(location, pet)
|
||||
val entityAnimation = pet.entityAnimation
|
||||
|
||||
val model = ModelEngineAPI.createActiveModel(modelID)
|
||||
val animationHandler = model.animationHandler
|
||||
val animationProperty = animationHandler.getAnimation(entityAnimation)
|
||||
|
||||
if (animationProperty != null) {
|
||||
animationHandler.playAnimation(animationProperty, true)
|
||||
} else {
|
||||
EcoPetsPlugin.instance.logger.warning("$entityAnimation not found in model $modelID, im use walk animation")
|
||||
val animationPropertyWalk = animationHandler.getAnimation("walk")
|
||||
if (animationPropertyWalk != null) {
|
||||
animationHandler.playAnimation(animationPropertyWalk, true)
|
||||
} else {
|
||||
EcoPetsPlugin.instance.logger.warning("walk animation not found in $modelID, you have any animation!?")
|
||||
}
|
||||
}
|
||||
|
||||
val modelled = ModelEngineAPI.createModeledEntity(stand)
|
||||
modelled.addModel(model, true)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user