Besmirchment 2

Besmirchment 2

4M Downloads

bermichment server crashes when loading on fabric 1.20.1 0.15.3

WhalerP opened this issue ยท 8 comments

commented

Hey there, I was running besmirchment 2 version 1.20.1-2 and it crashed my server upon launch. Error Specified was something with 'java.lang.NoSuchFieldError: bsm_lastRoll' as it seems that it could not either access it or find it. I will be linking the associated crash log file.
2024-01-03-6.log

commented

Can someone help me with this fix on 1.19.2? I have no idea how to code.

commented

Can someone help me with this fix on 1.19.2? I have no idea how to code.

It should be relatively safe to remove the mod from your world. That's where I'm ending up, I guess.

commented

I browsed through the code and it seems that the bsm_lastRoll member is somehow being accessed on the server. I don't have time right now to browse through the chain of inheritance to figure out where this is happening. I suspect the culprit is the function at https://github.com/BloomhouseMC/Besmirchment/blob/f5693f2b516b70c85806e9fd4cf8551d609638d5/src/main/java/dev/mrsterner/besmirchment/mixin/LivingEntityMixin.java#L238C4-L238C4 being called on the server side, but since this is a mixin and an implementation of an interface, when this function is called isn't immediately obvious to me.

commented

+1 I'm also having an issue on my server.

commented

Besmirchment runs perfectly fine on servers with Fabric Loader 0.14.25. But it fails to run on servers with Fabric Loader 0.15.0 and above.

Fabric Loader 0.15.0 fixed environment annotation stripping for fields. It must have to do with the @Environment(EnvType.CLIENT) annotation here.

I think the fix is to remove any @Environment(EnvType.CLIENT), restoring the behaviour where Fabric Loader ignored it. I think the right way to do environment-only mixins is to have two completely separate mixins: one for common, one for client.

See MoriyaShiine/extra-origins@e6d4cd4 for example

commented

Note that removing only the @Environment(EnvType.CLIENT) annotations in LivingEntityMixin.java and playerentitymixin.java results in a java.lang.NoSuchFieldError: jumpBeginProgress crash on the server when a Werepyre is spawned. There's more that needs to be removed.

You need to remove the environment annotations in the following mixins:














I've gone and compiled it: https://github.com/Poopooracoocoo/Besmirchment-fork/releases

commented

@Poopooracoocoo I can confirm this solves the issue. I compiled a custom version that does this about a week ago and have been running it on the server without issue. Notably, this fix only needs to be applied on the server .jar, so it didn't require modifying the client modpack at all.

Also to note, there is another field that will raise this error if not also stripped of its environment annotation:

@Environment(EnvType.CLIENT)
public float bsmJumpBeginProgress = 0;

If I remember correctly, these are the only two modifications I had to make.

I think the right way to do environment-only mixins is to have two completely separate mixins: one for common, one for client.

I agree this is probably correct. Since the issue is caused by the initializer not being removed while the field is, I attempted a few things like making a second constructor that only runs on the client and manually initializes the member there, but everything I tried ended up with compile errors due to the stripping happening at runtime. I actually used the solution you came up with as a last resort after not being able to figure out how to do it correctly, and I had not thought of your suggestion.

commented

I fixed it for 1.19.2 but I honestly cant be bothered to make a github page for it, so heres the jar:
https://www.mediafire.com/file/6wf2f64ubhfixjj/besmirchment-1.19.2-11.jar/file
https://we.tl/t-Q40LmMSYmS
https://file.io/gHXbCN3wlYCB
https://filetransfer.io/data-package/2EK1etPH#link

https://drive.google.com/file/d/1XUBfNUe454gAcLt7891Yty03LMFJaSN-/view?usp=drive_link

also if anyone is wondering how, I just did what Poopooracoocoo said to do so all credits to him

(also I use multiple upload sites just incase one doesnt work anymore)