JamCoreModding / right-click-harvest

Right click crops to harvest them - with style.
MIT License
14 stars 11 forks source link

Crashes with Fabric Loader 0.12 #2

Closed Fourmisain closed 3 years ago

Fourmisain commented 3 years ago

Right clicking crops started crashing with the new loader:

java.lang.NullPointerException: Cannot invoke "org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable.setReturnValue(Object)" because "info" is null at net.minecraft.class_2302.handler$zho000$onUseMixin(class_2302.java:558)

This very much looks like a Mixin issue so I've reported it here: https://github.com/FabricMC/Mixin/issues/68

There is a workaround however and that is to add a reference to info inside the currently empty AbstractBlockMixin.onUseMixin(), e.g. something like throw new AssertionError(info); That seems to ensure that Mixin actually generates the CallbackInfoReturnable object and the cancelling logic, so maybe you wanna add that until the root cause is found.

Jamalam360 commented 3 years ago

Thanks for this. I won't be able to fix anything until Friday as I'm away

Fourmisain commented 3 years ago

No problem, I wouldn't actually call this an issue until Fabric Loader 0.12 isn't called experimental anymore anyway. Player just said it should be possible to fix this issue properly, so maybe this workaround won't be required afterall.

I also realize I wasn't thinking when I suggested throw new AssertionError(info); because that'd cause a crash when right clicking anything that's not a crop block (or any crop block that's not targeted by one of the mixins), a better workaround would be info.getId();, since it has no further side-effects.

BrekiTomasson commented 3 years ago

Any news on this?

Jamalam360 commented 3 years ago

I could be wrong but I'm fairly certain this issue got fixed in floader

Jamalam360 commented 3 years ago

image

It should be fixed, I'm unsure whether this has actually been released yet though

Fourmisain commented 3 years ago

The first PR aimed to fix it was released with 0.12.3 but it didn't solve the issue. The new PR mentioned above was merged but isn't yet released. This issue will likely be solved with 0.12.4, I'll test it once it releases.

Jamalam360 commented 3 years ago

thanks

Jamalam360 commented 3 years ago

SmartSelect_20211030-220455_Discord.jpg

Fourmisain commented 3 years ago

Tested it in the dev env and (after clearing the gradle cache) it worked!

Gonna do some more testing tomorrow, but I'm pretty sure this can be considered fixed.

Jamalam360 commented 3 years ago

Thanks for testing it :+1: