Fabricmc cannot cast minecraft class to injected interface

16 Views Asked by At

I have interface PackItemStack and ItemStackMixin that implement it. Mixin is registered in mixin.json config. But when I try to cast main class ItemStack to interface, IDE gives an error Inconvertible types; cannot cast 'net.minecraft.item.ItemStack' to 'net.smok.PackItemStack'

Fabric 0.92.0+1.20.1, Java 17.

I have interface PackItemStack and ItemStackMixin that implement it. Mixin is registered in mixin.json config. But when I try to cast main class ItemStack to interface, IDE gives an error Inconvertible types; cannot cast 'net.minecraft.item.ItemStack' to 'net.smok.PackItemStack'

Fabric 0.92.0+1.20.1, Java 17.

In all guides it is just work without any other steps. Fabricmc wiki says that I need somehow register injected interface with reference to compiled class. But I don't understand how to do it.

0

There are 0 best solutions below