Skip to content

NoClassDefFoundError when cancelling mixins #2

Description

@Vekhove

Using CallbackInfo#cancel inside a mixin causes NoClassDefFoundError.

This code:

@Mixin(Player.class)
public final class PlayerMixin {

    @Inject(
            method = "notifyPickupItem",
            at = @At("HEAD"),
            cancellable = true
    )
    public void mixintests_injectNotifyPickupItem(Ref<EntityStore> ref, ItemStack itemStack, Vector3d position, ComponentAccessor<EntityStore> componentAccessor, CallbackInfo ci) {
        System.out.println("Picked up!");
        ci.cancel();
    }

}

causes this error:

java.lang.NoClassDefFoundError: org/spongepowered/asm/mixin/injection/callback/CallbackInfo
	at com.hypixel.hytale.server.core.entity.entities.Player.notifyPickupItem(Player.java)
	at com.hypixel.hytale.server.core.modules.entity.player.PlayerItemEntityPickupSystem.tick(PlayerItemEntityPickupSystem.java:190)
	at com.hypixel.hytale.component.system.tick.EntityTickingSystem.doTick(EntityTickingSystem.java:92)
	at com.hypixel.hytale.component.system.tick.EntityTickingSystem.tick(EntityTickingSystem.java:36)
	at com.hypixel.hytale.component.Store.tick(Store.java:1971)
	at com.hypixel.hytale.component.system.tick.ArchetypeTickingSystem.tick(ArchetypeTickingSystem.java:36)
	at com.hypixel.hytale.component.Store.tickInternal(Store.java:1927)
	at com.hypixel.hytale.component.Store.tick(Store.java:1897)
	at com.hypixel.hytale.server.core.universe.world.World.tick(World.java:398)
	at com.hypixel.hytale.server.core.util.thread.TickingThread.run(TickingThread.java:89)
	at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: java.lang.ClassNotFoundException: org.spongepowered.asm.mixin.injection.callback.CallbackInfo
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:377)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:557)
	at com.hypixel.hytale.plugin.early.TransformingClassLoader.loadClass(TransformingClassLoader.java:89)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
	... 11 more

Removing ci.cancel() works as expected, prints the message when the item is picked up.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions