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 1642195..7588773 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, pet.entityAnimation) + ModelEnginePetEntity(pet, id) } } ) 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 db12756..685b2ce 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,7 +114,7 @@ class Pet( val entityTexture = config.getString("entity-texture") - val entityAnimation = config.getString("default-animation") + var entityAnimation = config.getStringOrNull("default-animation") private val levelXpRequirements = listOf(0) + config.getInts("level-xp-requirements") 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 1f68128..4052bf1 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 @@ -9,18 +9,18 @@ import org.bukkit.entity.ArmorStand class ModelEnginePetEntity( pet: Pet, private val modelID: String, - private val animationString: String, ) : 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(animationString); + val animationProperty = animationHandler.getAnimation(entityAnimation); if (animationProperty != null) { animationHandler.playAnimation(animationProperty, true) - } else { EcoPetsPlugin.instance.logger.warning("$animationString not found in model $modelID") } + } else { EcoPetsPlugin.instance.logger.warning("$entityAnimation not found in model $modelID") } val modelled = ModelEngineAPI.createModeledEntity(stand) modelled.addModel(model, true) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/entity/PetEntity.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/entity/PetEntity.kt index 058952c..9d2724c 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/entity/PetEntity.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/entity/PetEntity.kt @@ -27,6 +27,10 @@ abstract class PetEntity( return SkullPetEntity(pet) } + if (pet.entityAnimation == null){ + pet.entityAnimation = "walk"; + } + val id = texture.split(":")[0] val parse = registrations[id] ?: return SkullPetEntity(pet) return parse(pet, texture.removePrefix("$id:"))