Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ allprojects {
compileOnly("org.jetbrains:annotations:26.0.2")
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.3.0")
compileOnly("com.github.ben-manes.caffeine:caffeine:3.2.3")
compileOnly("io.github.toxicity188:bettermodel-bukkit-api:2.2.0") {
exclude("*", "kotlin-stdlib")
}
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.willfp.ecomobs.handler.MountHandler
import com.willfp.ecomobs.handler.SpawnEggHandler
import com.willfp.ecomobs.handler.SpawnTotemHandler
import com.willfp.ecomobs.handler.VanillaCompatibilityHandlers
import com.willfp.ecomobs.integrations.bettermodel.IntegrationBetterModel
import com.willfp.ecomobs.integrations.levelledmobs.IntegrationLevelledMobs
import com.willfp.ecomobs.integrations.libsdisguises.IntegrationLibsDisguises
import com.willfp.ecomobs.integrations.modelengine.IntegrationModelEngine
Expand Down Expand Up @@ -79,6 +80,7 @@ class EcoMobsPlugin : LibreforgePlugin() {
return listOf(
IntegrationLoader("LevelledMobs") { this.eventManager.registerListener(IntegrationLevelledMobs) },
IntegrationLoader("ModelEngine") { this.eventManager.registerListener(IntegrationModelEngine) },
IntegrationLoader("BetterModel") { this.eventManager.registerListener(IntegrationBetterModel) },
IntegrationLoader("LibsDisguises") { this.eventManager.registerListener(IntegrationLibsDisguises) },
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.willfp.ecomobs.integrations.bettermodel

import com.willfp.eco.core.integrations.Integration
import com.willfp.ecomobs.event.EcoMobSpawnEvent
import com.willfp.ecomobs.integrations.MobIntegration
import kr.toxicity.model.api.BetterModel
import kr.toxicity.model.api.bukkit.platform.BukkitAdapter
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener

object IntegrationBetterModel : Listener, Integration {
private val integration = MobIntegration("better-model")

@EventHandler
fun handle(event: EcoMobSpawnEvent) {
val mob = event.mob.mob
val entity = event.mob.entity

val betterModelID = mob.getIntegrationConfig(integration).getStringOrNull("id") ?: return

val model = BetterModel.modelOrNull(betterModelID) ?: return

model.getOrCreate(BukkitAdapter.adapt(entity))
}

override fun getPluginName(): String {
return "BetterModel"
}
}
4 changes: 4 additions & 0 deletions eco-core/core-plugin/src/main/resources/mobs/_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ integrations:
model-engine:
id: ""

# Options for BetterModel
better-model:
id: ""

# Options for LibsDisguises
libs-disguises:
id: ""
Expand Down
1 change: 1 addition & 0 deletions eco-core/core-plugin/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ softdepend:
- LevelledMobs
- ModelEngine
- LibsDisguises
- BetterModel

commands:
ecomobs:
Expand Down