-
Notifications
You must be signed in to change notification settings - Fork 117
Open
Description
服务端: Purpur-1.20.1-build1996
问题: 似乎是nms版本不兼容的问题,请问如何解决
SimpleAi使用
class ZombieAi(val zombie: Zombie) : SimpleAi() {
private var target: Skeleton? = null
override fun shouldExecute(): Boolean {
target = zombie.world.getNearbyEntities(zombie.location, 10.0, 10.0, 10.0)
.filterIsInstance<Skeleton>()
.firstOrNull { it.equipment?.itemInMainHand?.type?.name?.contains("BOW") == true }
return target != null
}
override fun updateTask() {
target?.let { skeleton ->
// 向目标移动
zombie.navigationMove(skeleton, speed = 1.2)
// 如果距离小于 2 格,发动攻击
if (zombie.location.distance(skeleton.location) < 2.0) {
zombie.attack(skeleton)
}
}
}
override fun resetTask() {
target = null
}
}
@SubscribeEvent
fun onMobsSpawn(e: EntitySpawnEvent) {
if(e.entityType == EntityType.ZOMBIE) {
(e.entity as LivingEntity).apply {
clearGoalAi()
addGoalAi(ZombieAi(e.entity as Zombie), 1)
}
}
}
问题
java.lang.AbstractMethodError:
Receiver class com.gitee.mooovo.test.taboolib.module.ai.PathfinderCreatorImpl17
does not define or inherit an implementation of the resolved method 'abstract boolean a()' of abstract class
net.minecraft.world.entity.ai.goal.PathfinderGoal
Metadata
Metadata
Assignees
Labels
No labels