Coda1552 / Breezy

Other
1 stars 9 forks source link

Fix error casting net.minecraft.client.multiplayer.ClientLevel to class net.minecraft.server.level.ServerLevel #22

Closed koenigstag closed 1 year ago

koenigstag commented 1 year ago

Issue: On minecraft load it sometimes crashes with error

java.lang.ClassCastException: class net.minecraft.client.multiplayer.ClientLevel cannot be cast to class net.minecraft.server.level.ServerLevel (net.minecraft.client.multiplayer.ClientLevel and net.minecraft.server.level.ServerLevel are in module minecraft@1.18.2 of loader 'TRANSFORMER' @48277712)
    at coda.breezy.Breezy.lambda$resetWindDirection$1(Breezy.java:88) ~[breezy-1.18.2-1.0.3.jar%23151!/:1.18.2-1.0.3] {re:classloading}

Found another mod which had the same issue resolved: https://github.com/TheCBProject/CBMultipart/issues/87

Adding if (level.isClientSide) return; has fixed game load crash for my test setup. This fix switches off logic if it is run on client side.

Fix for issues: https://github.com/Coda1552/Breezy/issues/17 https://github.com/Coda1552/Breezy/issues/19 https://github.com/Coda1552/Breezy/issues/21

Coda1552 commented 1 year ago

Appreciate it, thanks.

vediis commented 1 year ago

I was brought to this thread by the same crash - Curseforge latest version is from Jan, from before commits were made to fix this bug. Any chance of a new Curseforge version to hotfix this?

Coda1552 commented 1 year ago

I was brought to this thread by the same crash - Curseforge latest version is from Jan, from before commits were made to fix this bug. Any chance of a new Curseforge version to hotfix this?

Working on it, sorry for the delay. Took a bit of a break from this. I was originally going to switch off of Geckolib, and I had done that before this issue was brought up and I hadn't made a branch for it. Long story short, I'm sticking with GeckoLib so I had to change some code back. Hotfix soon, hopefully.