I wanted to test the compatibility of this mod with another one I'm working on. However, mavapi causes a crash when I run it in my development environment. (The crash does not occur when using the same two mods in a regular minecraft instance !)
java.lang.IllegalAccessError: Update to non-static final field net.minecraft.item.EntityBucketItem.entityType attempted from a different method (handler$zdb000$mavapi$onInit) than the initializer method <init>
at net.minecraft.item.EntityBucketItem.handler$zdb000$mavapi$onInit(EntityBucketItem.java:568)
at net.minecraft.item.EntityBucketItem.<init>(EntityBucketItem.java:48)
at net.minecraft.item.Items.<clinit>(Items.java:1117)
Faulty code:
|
@Mixin(MobBucketItem.class) |
|
public abstract class MobBucketItemMixin { |
|
private EntityType<?> entityType; |
|
|
|
@Inject(method = "<init>", at = @At("RETURN")) |
|
public void onInit(EntityType<?> entityType, Fluid fluid, SoundEvent soundEvent, Item.Properties properties, CallbackInfo ci) { |
|
this.entityType = entityType; |
|
} |
With Yarn, the field entityType that you declare already exists in the base class (with mojmap you know it as simply type), so this mixin ends up shadowing the original final field instead of creating its own mutable one.
The quickest fix would be to add @Unique to your own field. However at a glance, it looks like your field serves the same purpose as the original, so I'd suggest @Shadowing it instead, and removing onInit completely.
I wanted to test the compatibility of this mod with another one I'm working on. However, mavapi causes a crash when I run it in my development environment. (The crash does not occur when using the same two mods in a regular minecraft instance !)
Faulty code:
MoreAxolotlVariantsAPI-Common/Common/src/main/java/io/github/akashiikun/mavapi/v1/mixin/MobBucketItemMixin.java
Lines 61 to 68 in c692a50
With Yarn, the field
entityTypethat you declare already exists in the base class (with mojmap you know it as simplytype), so this mixin ends up shadowing the original final field instead of creating its own mutable one.The quickest fix would be to add
@Uniqueto your own field. However at a glance, it looks like your field serves the same purpose as the original, so I'd suggest@Shadowing it instead, and removingonInitcompletely.