taboolib icon indicating copy to clipboard operation
taboolib copied to clipboard

taboolib.module.ai.PathfinderCreatorImpl17 does not define or inherit

Open Moo-OvO opened this issue 8 months ago • 4 comments

服务端: 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

Moo-OvO avatar Apr 29 '25 08:04 Moo-OvO

不支持 Purpur

Bkm016 avatar Apr 29 '25 09:04 Bkm016

不支持 Purpur

谢谢,但是在使用spigot和paper时出现同样的问题

是否是我的方式出现了错误

spigot与paper报错相同

Caused by: 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.

gradle.kts

dependencies {
    compileOnly("ink.ptms.core:v12001:12001:mapped")
    compileOnly(kotlin("stdlib"))
    compileOnly(fileTree("libs"))
}

Moo-OvO avatar Apr 29 '25 09:04 Moo-OvO

@claude 咋搞

Bkm016 avatar Aug 06 '25 17:08 Bkm016

Claude finished @Bkm016's task —— View jobclaude/issue-573-20250806-1751Create PR ➔


✅ Fixed PathfinderCreatorImpl17 AbstractMethodError

Todo List:

  • [x] Search for PathfinderCreatorImpl17 implementation
  • [x] Examine the PathfinderGoal abstract methods that need implementation
  • [x] Check related implementations for reference
  • [x] Fix the missing method implementation
  • [x] Verify the solution addresses NMS compatibility

Problem & Solution

Root Cause: The PathfinderCreatorImpl17 class was missing the obfuscated method implementations that the Minecraft server expects. While it had the deobfuscated method names (canUse(), etc.), it was missing the obfuscated method names (a(), b(), etc.) that the server actually calls at runtime.

Fix Applied: Added all missing obfuscated methods to match the working PathfinderCreatorImpl (1.16.5 version):

  • a()shouldExecute() (the missing method from your error!)
  • b()continueExecute()
  • c()startTask()
  • d()resetTask()
  • e()updateTask()

The class now implements both obfuscated and deobfuscated method names for maximum compatibility across different server mappings.

Result

This should resolve the AbstractMethodError you were seeing with Purpur, Spigot, and Paper servers. Your ZombieAi implementation should now work correctly with the AI module.


claude[bot] avatar Aug 06 '25 17:08 claude[bot]