Charset (1.10.x)

Charset (1.10.x)

3M Downloads

[1.10.2] Crash on sponge server start.

rmnaderdev opened this issue ยท 9 comments

commented

Just updated the mod and it seems to be crashing when I start my server. Or is it something else?

http://pastebin.com/PXG0nfHK

commented

A bug in MalisisDoors - it's missing a @SideOnly somewhere.

commented
commented

And that's why you don't reflect on other mod classes...
This is the class that doesn't work : https://github.com/Ordinastie/MalisisDoors/blob/1.9.4/src/main/java/net/malisis/doors/block/VerticalHatchDoor.java
I have no idea how to fix it.

[Edit: so I really don't understand why, but the lambda seems to be the issue. Without it, it doesn't crash. So it'll be fixed in the next update.]

commented

@Ordinastie if the lambada is the issue i think i know what's going on: lambada's are nice but when the code get's compiled at runtime for usage it basicly makes a class and object with it this is heapening before the @SideOnly annotation could have removed the function on the server side but the lambada needs the class

commented

@Ordinastie There is no other way I can reliably detect if other modded doors can be used by my tweak.

The trick is @SideOnly. You're not using it correctly.

On the server side, you should mark every method and field that uses client-side-only classes/fields/methods with it so that they get stripped on the server. It happens with my mod this time, but it could realistically happen with any other mod. It's a bug.

commented

@asiekierka I don't think you can add @SideOnly to to a lambda, can you? So you'd have to write your own class manually which implements IIconProvider. I suppose, ideally, a compiler generated lambda class used in a side-only context should be removed if on the wrong side, but is that possible?

commented

This is actually an extremely tricky issue, I'm fixing this with a Forge PR.

commented

Hmm I can't fix it completely, the reflection method will still throw an exception. I'll make sure it throws the right exception at least (UnableToFindMethodException).
Basically the lambda inside a @SideOnly method causes the reflection call to crash completely. Ordinastie is using @SideOnly properly and everything works if they avoid using a lambda in the method.

commented

Hum, I thought I responded earlier, but I apparently, I forgot to send the comment.

I did use @SideOnly correctly. The issue is that lambdas are compiled into static methods into the class. Obviously, those ones are not annotated with @SideOnly, and getDeclaredMethod still loop through them.
In this current case, the IIconProvider method has Icon as return type, so, the static method has it too hence the crash.