DanilMK
DanilMK

Reputation: 19

Fabricmc cannot cast minecraft class to injected interface

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.

Upvotes: 0

Views: 231

Answers (0)

Related Questions