package mezz.jei.input;

import mezz.jei.config.Constants;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Mouse;

@Mod.EventBusSubscriber(modid = Constants.MOD_ID)
public final class MouseHelper {
	private static class DisplayInfo {
		private final ScaledResolution scaledresolution;
		private final int displayWidth;
		private final int displayHeight;

		public DisplayInfo() {
			Minecraft minecraft = Minecraft.getMinecraft();
			displayWidth = minecraft.displayWidth;
			displayHeight = minecraft.displayHeight;
			scaledresolution = new ScaledResolution(minecraft);
		}

		public int getX() {
			int i = scaledresolution.getScaledWidth();
			return Mouse.getX() * i / displayWidth;
		}

		public int getY() {
			int j = scaledresolution.getScaledHeight();
			return j - Mouse.getY() * j / displayHeight - 1;
		}
	}

	private static DisplayInfo INFO = new DisplayInfo();

	private MouseHelper() {

	}

	public static int getX() {
		return INFO.getX();
	}

	public static int getY() {
		return INFO.getY();
	}

	@SubscribeEvent
	public static void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
		INFO = new DisplayInfo();
	}
}

@@ -300,24 +300,71 @@
 cribeEvent;%0A
+import net.minecraftforge.fml.relauncher.Side;%0A
 import org.l
@@ -430,16 +430,39 @@
 s.MOD_ID
+, value = %7BSide.CLIENT%7D
 )%0Apublic

Fix #795 Crash on dedicated server at startup