minecraft-dev / MinecraftDev

Plugin for IntelliJ IDEA that gives special support for Minecraft modding projects.
https://minecraftdev.org/
GNU Lesser General Public License v3.0
1.48k stars 183 forks source link

Detecting usages of SideOnly classes doesn't "know" about SidedProxy defaults #325

Open Barteks2x opened 6 years ago

Barteks2x commented 6 years ago

Consider the following code:

public abstract class SomeClass {
    @SidedProxy
    public static SomeClass INSTANCE = null;

    public abstract void onInit();

    public static class ClientProxy extends SomeClass {
        @Override
        public void onInit() {
            SomeClientOnlyClass.something();
        }
    }

    public static class ServerProxy extends SomeClass {
        @Override
        public void onInit() {
        }
    }
}

The line SomeClientOnlyClass.something(); will still show an error even when it's in actual client proxy.

DenWav commented 6 years ago

Can you explain these defaults please?

TehNut commented 6 years ago

If a value for clientSide or serverSide isn't specified, it defaults to using an inner class named ClientProxy or ServerProxy respectively.

This is noted in the javadoc:

https://github.com/MinecraftForge/MinecraftForge/blob/eda4fb231bc0e7bb3387d3a8458cc678932a74f7/src/main/java/net/minecraftforge/fml/common/SidedProxy.java#L59-L69