artemis-odb icon indicating copy to clipboard operation
artemis-odb copied to clipboard

[BUG] Randomly get MundaneWireException while doing injection

Open cypai opened this issue 2 years ago • 0 comments

I seem to be getting MundaneWireException randomly while injecting a custom class. The stack trace:

Caused by: com.artemis.MundaneWireException: Error while wiring com.pipai.dragontiles.artemis.systems.animation.AdjustHandAnimation
        at com.artemis.injection.CachedInjector.inject(CachedInjector.java:80)
        at com.artemis.World.inject(World.java:136)
        at com.artemis.World.inject(World.java:109)
        at com.pipai.dragontiles.artemis.systems.animation.Animation.init(Animation.kt:15)
        at com.pipai.dragontiles.artemis.systems.animation.CombatAnimationSystem.queueAnimation(CombatAnimationSystem.kt:38)
        at com.pipai.dragontiles.artemis.systems.animation.CombatAnimationSystem.adjustHand(CombatAnimationSystem.kt:84)
        at com.pipai.dragontiles.artemis.systems.animation.CombatAnimationSystem.handleHandAdjustedEvent(CombatAnimationSystem.kt:80)
        ... 19 more
Caused by: com.artemis.MundaneWireException: Failed to inject com.artemis.ComponentMapper into com.pipai.dragontiles.artemis.systems.animation.AdjustHandAnimation: ComponentMapper not registered with world.
        at com.artemis.injection.CachedInjector.onFailedInjection(CachedInjector.java:179)
        at com.artemis.injection.CachedInjector.injectField(CachedInjector.java:165)
        at com.artemis.injection.CachedInjector.injectValidFields(CachedInjector.java:90)
        at com.artemis.injection.CachedInjector.inject(CachedInjector.java:75)
        ... 25 more

The offending code (truncated a bit):

abstract class Animation {
    protected lateinit var world: World

    fun init(world: World) {
        this.world = world
        world.inject(this)
    }
}

cypai avatar Dec 24 '21 16:12 cypai